[Moin-user] Handling local extended links as "normal" link instead of interwiki

Thomas Werschlein thomas.werschlein at netcetera.ch
Mon Aug 15 05:26:03 EDT 2005

Hi everyone

For our internal moinmoin Wiki I plan to "simplify" the various
linking schemes to the following styles (BTW: we use the "nocamelcase"

[:normal Page]
[:normal Page:with different link text]
[:/subpage:with different link text]
[wiki:MailStore:123 real interwiki link with param 123]

All the above links work without modification to the moinmoin codebase
as described on HelpOnLinking ("Use the syntax of [:WikiPage:Label
text] to achieve a link to a current Wiki page without creating an
InterWiki link.")

The only problem with this approach is, that these sort of links
internally still are treated as interwiki links, i.e. they don't
receive a question mark, if the page does not exist, and don't show up
in OrphanedPages or WantedPages.

Now I had a look at the codebase in order to change this behaviour and
found the following code in parsers/wiki.py:

def _url_bracket_repl(self, word):
         """Handle bracketed URLs."""

         # Local extended link?
         if word[1] == ':':
             words = word[2:-1].split(':', 1)
             if len(words) == 1:
                 words = words * 2
             words[0] = 'wiki:Self:%s' % words[0]
             return self.interwiki(words, pretty_url=1)
             #return self._word_repl(words[0], words[1])

Note the last, commented line: it exactly does what I planned to do
myself - treating such a link as an internal page link. A quick test
with the last 3 lines looking as follows:

#words[0] = 'wiki:Self:%s' % words[0]
#return self.interwiki(words, pretty_url=1)
return self._word_repl(words[0], words[1])

seems to produce the required result.

My question now:

Has anyone experience with this type of setup? Does it really work as
intended? Why is this line commented? Is it really an alternative or
was it commented because it doesn't work?

I tried to find out myself, but my arch know how is definitely to bad
for this type of thing :-(

Any help or comments are greatly appreciated!


More information about the Moin-user mailing list