Description

Steps to reproduce

  1. Anchors in internal links are being escaped. This makes it impossible to link to an anchor on a different wiki page.

Example

Details

MoinMoin Version

1.5.4

OS and Version

Python Version

Server Setup

Server Details

Language you are using the wiki in (set in the browser/UserPreferences)

Workaround

Apply the following patch to fix:

--- MoinMoin/parser/rst.orig    2006-07-25 16:39:48.904765400 -0400
+++ MoinMoin/parser/rst.py      2006-07-25 16:45:03.798157400 -0400
@@ -376,8 +376,13 @@ class MoinTranslator(html4css1.HTMLTrans
                     node['classes'].append(prefix)
             else:
                 # Default case - make a link to a wiki page.
-                page = MoinMoin.Page.Page(self.request, refuri)
-                node['refuri'] = page.url(self.request)
+                pagename = refuri
+                anchor = ''
+                if refuri.find('#') != -1:
+                    pagename, anchor = refuri.split('#', 1)
+                    anchor = '#' + anchor
+                page = MoinMoin.Page.Page(self.request, pagename)
+                node['refuri'] = page.url(self.request) + anchor
                 if not page.exists():
                     node['classes'].append('nonexistent')
         html4css1.HTMLTranslator.visit_reference(self, node)

Discussion

Applied to Moin 1.6.

Matt, it would be nice if your patches could be applied against MoinMoin 1.6 cleanly (this one didn't). See MercurialGuide and ask me if you have any questions. -- AlexanderSchremmer 2006-07-25 21:01:14

Alexander, I can provide a patch against 1.6 also. The above is against 1.5 (I also emailed you a Mercurial patch) since it is a bug fix. From now on I'll provide patches for both. -- MatthewGilbert 2024-04-26 13:53:45

Plan


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/ReStructuredTextEscapingAnchors (last edited 2007-10-29 19:20:44 by localhost)