diff MoinMoin/formatter/text_html.py @ 4493:af211e2f132c

moved anchor parsing from formatter to parsers, fixed anchor parsing for interwiki links, reduce code duplication by new wikiutil.split_anchor()
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 18 Jan 2009 12:54:18 +0100
parents f8e4e84525e8
children 910474dded06 050428d1c044
line wrap: on
line diff
--- a/MoinMoin/formatter/text_html.py	Fri Jan 16 12:55:57 2009 +0100
+++ b/MoinMoin/formatter/text_html.py	Sun Jan 18 12:54:18 2009 +0100
@@ -14,7 +14,7 @@
 from MoinMoin import wikiutil, i18n
 from MoinMoin.Page import Page
 from MoinMoin.action import AttachFile
-from MoinMoin.support.python_compatibility import set, rsplit
+from MoinMoin.support.python_compatibility import set
 
 # insert IDs into output wherever they occur
 # warning: breaks toggle line numbers javascript
@@ -488,8 +488,6 @@
         wikitag, wikiurl, wikitail, wikitag_bad = wikiutil.resolve_interwiki(self.request, interwiki, pagename)
         wikiurl = wikiutil.mapURL(self.request, wikiurl)
         if wikitag == 'Self': # for own wiki, do simple links
-            if '#' in wikitail:
-                wikitail, kw['anchor'] = rsplit(wikitail, '#', 1)
             wikitail = wikiutil.url_unquote(wikitail)
             try: # XXX this is the only place where we access self.page - do we need it? Crashes silently on actions!
                 pagename = wikiutil.AbsPageName(self.page.page_name, wikitail)
@@ -502,6 +500,9 @@
                 if querystr:
                     separator = ('?', '&')['?' in href]
                     href = '%s%s%s' % (href, separator, wikiutil.makeQueryString(querystr))
+                anchor = kw.get('anchor')
+                if anchor:
+                    href = '%s#%s' % (href, anchor)
                 if wikitag_bad:
                     html_class = 'badinterwiki'
                 else: