Description
Fixed in 1.7
Choosing Render As Docbook on a page with internal links renders as <ulink url=PageName>see here</ulink> when it should really use <link linkend="#section_foobar">see here</link>. I a sample page that would render badly:
Blah di blah [[#section_foobar|See the foobar section]] <<Anchor(section_foobar)>> Foobar the frobnicator...
Steps to reproduce
- Create a page with internal references like described above
- Choose action "Render as docbook" 3: Look at the output
Example
See for example http://xesam.org/XesamUsers
Component selection
Inside the docbook formatter
Details
MoinMoin Version |
1.6.1 |
OS and Version |
RHEL 4 |
Python Version |
2.5 |
Server Setup |
Twisted 2.5 |
Server Details |
|
Language you are using the wiki in (set in the browser/UserPreferences) |
en |
Patch
Proposed patch
1 diff -r a48c49030593 MoinMoin/formatter/text_docbook.py
2 --- a/MoinMoin/formatter/text_docbook.py Sun Mar 09 20:09:31 2008 +0100
3 +++ b/MoinMoin/formatter/text_docbook.py Wed Mar 12 14:43:00 2008 +0100
4 @@ -360,22 +360,26 @@ class Formatter(FormatterBase):
5 def pagelink(self, on, pagename='', page=None, **kw):
6 FormatterBase.pagelink(self, on, pagename, page, **kw)
7
8 - return self.interwikilink(on, 'Self', pagename)
9 + return self.interwikilink(on, 'Self', pagename, **kw)
10
11 # FIXME: This is even more crappy
12 def interwikilink(self, on, interwiki='', pagename='', **kw):
13 if not on:
14 - return self.url(on, kw)
15 + return self.url(on, **kw)
16
17 wikitag, wikiurl, wikitail, wikitag_bad = wikiutil.resolve_interwiki(self.request, interwiki, pagename)
18 wikiurl = wikiutil.mapURL(self.request, wikiurl)
19 href = wikiutil.join_wiki(wikiurl, wikitail)
20
21 - return self.url(on, href)
22 + return self.url(on, href, **kw)
23
24 def url(self, on, url=None, css=None, **kw):
25 - return self._handleNode("ulink", on, (('url', url), ))
26 -
27 + # Handle internal references as docbook <link>, otherwise <ulink>
28 + if kw.has_key("anchor"):
29 + return self._handleNode("link", on, (('linkend', kw["anchor"]), ))
30 + else:
31 + return self._handleNode("ulink", on, (('url', url), ))
32 +
33 def anchordef(self, name):
34 self._handleNode("anchor", True, (('id', name), ))
35 self._handleNode("ulink", False)
Discussion
Thanks for the excellent bugreport. There is also another bug with links within the wiki loosing their anchors: A link SomePageName#section1 will result in a link to http://example.com/SomePageName and not in http://example.com/SomePageName#section. That bug was fixed as well.
Plan
- Priority:
- Assigned to: Mikko Virkkilä
- Status: Fixed in main, will be in 1.7