I've got a (perhaps uncommon[*]) wish for moin to generate relative
links. For example, I'd like /path/to/moin/SomePage to have
href="OtherPage" rather than href="/path/to/moin/OtherPage".
I've put together an initial attempt at this. The patch is available
The patch is against version 1.2.4 (as found in recent
Debian/unstable). Let me know if I should regenerate it against a newer
This patch adds a new configuration option "relative_links" which
defaults to False.
I was hoping to be able to write the patch such that it would be easy to
guarantee that the behavior was unchanged if the new option stayed at
it's default setting. However, the code often has:
"%s/%s" % (request.getScriptname(), pagename)
which has an explicit '/' in it. In order to get relative links, I had
to change all instances of this construct into:
"%s%s" % (request.getRelativeScriptname(), pagename)
where the new getRelativeScriptname is quite simply:
return self.getScriptname() + '/'
I've tested the patch by bringing up a test wiki and clicking on pretty
much everything. It seems to work, but I haven't test inter-wiki things
at all, so they are likely broken.
If anyone could take a look at this patch and provide feedback, that
would be great.
[*] Here's the motivation for this patch. I'm trying to serve a website
that consists of mixed wiki and non-wiki content, but I'm trying to
completely hid this implementation detail from the user.
For example, I might have:
And I want to be able to use URLs of the form:
where the wiki vs. non-wiki nature is hidden from the URL.
The approach I'm using right now is to point the web server document
root at my static pages, and then configure htpp://foo.org/wiki to point
at the wiki stuff.
Then, I hide the "/wiki" prefix with Apache's rewrite module to achieve
a conditional proxy pass for existing wiki pages:
RewriteCond /var/wiki/data/text$1 -f
RewriteRule (.*) http://foo.org/wiki$1 [proxy,last]
That does work for typing in a URL directly, such as:
But as soon as I click on a link I get what I don't want:
With the patch, I get the desired URL: