"Christensen, Courtney" wrote
For this reason I need links refering to the existing site to be
relative.
Has anyone got any suggestions as to the changes I would need to make
in >the Wiki source?
I think a first suggestion would be to write an extension that takes <siteLink href="../myOldSite/page.html">Link</siteLink> and returns <a href="../myOldSite/page.html">Link</a>
I'll look into that.
Or really if your users are that savvy then just write out a link surrounded by <nowiki> tags. (i.e. <nowiki><a href="../link">Link</a></nowiki> )
Tried this, but it just displays the HTML of what is between the nowiki tags.
In the meantime I have identified that the parsing is being done in the Parser.php class, using the relative expression, defined by the following code:
define( 'EXT_LINK_BRACKETED', '/[(\b(' . wfUrlProtocols() . ')'. EXT_LINK_URL_CLASS.'+) *('.EXT_LINK_TEXT_CLASS.'*?)]/S' );
this is used by the preg_split method creating an array of groups of four elements where elements n to n+3 are: url, protocol, text and trail. I have attempted to come up with a regular expression that will allow me to identify the bracketed sections that start with '/':
define( 'EXT_REL_LINK_BRACKETED','/[(/([A-Za-z0-9_-]*)'. '+) *('.EXT_LINK_TEXT_CLASS.'*?)]/S' );
but this fails when I put it together:
define( 'EXT_REL_LINK_BRACKETED','[(/([A-Za-z0-9_-]*)'. '+) *('.EXT_LINK_TEXT_CLASS.'*?)]' ); define( 'EXT_LINK_BRACKETED', '/('.EXT_REL_LINK_BRACKETED.')|([(\b(' . wfUrlProtocols() . ')'. EXT_LINK_URL_CLASS.'+) *('.EXT_LINK_TEXT_CLASS.'*?)])/S' );
I am not a regex expert, so there is probably something obvious I am doing wrong.
Andre
wikitech-l@lists.wikimedia.org