changeset 569:6c572f52899f

fixed missing </a> formatter bug imported from: moin--main--1.5--patch-573
author Thomas Waldmann <tw@waldmann-edv.de>
date Sat, 15 Apr 2006 18:35:41 +0000
parents 4fb533df2b39
children 02b5b090c23a
files ChangeLog MoinMoin/formatter/base.py MoinMoin/formatter/text_html.py MoinMoin/logfile/editlog.py MoinMoin/parser/wiki.py MoinMoin/theme/__init__.py docs/CHANGES
diffstat 7 files changed, 50 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Apr 15 15:46:23 2006 +0000
+++ b/ChangeLog	Sat Apr 15 18:35:41 2006 +0000
@@ -2,6 +2,23 @@
 # arch-tag: automatic-ChangeLog--arch@arch.thinkmo.de--2003-archives/moin--main--1.5
 #
 
+2006-04-15 19:35:41 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-573
+
+    Summary:
+      fixed missing </a> formatter bug
+    Revision:
+      moin--main--1.5--patch-573
+
+    fixed missing </a> formatter bug
+    
+
+    modified files:
+     ChangeLog MoinMoin/formatter/base.py
+     MoinMoin/formatter/text_html.py MoinMoin/logfile/editlog.py
+     MoinMoin/parser/wiki.py MoinMoin/theme/__init__.py
+     docs/CHANGES
+
+
 2006-04-15 16:46:23 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-572
 
     Summary:
--- a/MoinMoin/formatter/base.py	Sat Apr 15 15:46:23 2006 +0000
+++ b/MoinMoin/formatter/base.py	Sat Apr 15 18:35:41 2006 +0000
@@ -84,8 +84,11 @@
             self.pagelinks.append(pagename)
 
     def interwikilink(self, on, interwiki='', pagename='', **kw):
-        # call pagelink() for internal interwikilinks
-        # to make shure they get counted for self.pagelinks
+        """ calls pagelink() for internal interwikilinks
+            to make sure they get counted for self.pagelinks.
+            IMPORTANT: on and off must be called with same parameters, see
+                       also the text_html formatter.
+        """
         wikitag, wikiurl, wikitail, wikitag_bad = wikiutil.resolve_wiki(self.request, '%s:%s' % (interwiki, pagename))
         if wikitag == 'Self' or wikitag == self.request.cfg.interwikiname:
             if wikitail.find('#') > -1:
--- a/MoinMoin/formatter/text_html.py	Sat Apr 15 15:46:23 2006 +0000
+++ b/MoinMoin/formatter/text_html.py	Sat Apr 15 18:35:41 2006 +0000
@@ -502,26 +502,30 @@
         """
         @keyword title: override using the interwiki wikiname as title
         """
-        if not on:
-            return self.url(0)
         wikitag, wikiurl, wikitail, wikitag_bad = wikiutil.resolve_wiki(self.request, '%s:%s' % (interwiki, pagename))
         wikiurl = wikiutil.mapURL(self.request, wikiurl)
         if wikitag == 'Self': # for own wiki, do simple links
-            if wikitail.find('#') > -1:
-                wikitail, kw['anchor'] = wikitail.split('#', 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!
-                return apply(self.pagelink, (on, wikiutil.AbsPageName(self.request, self.page.page_name, wikitail)), kw)
-            except:
-                return apply(self.pagelink, (on, wikitail), kw)
+            if on:
+                if wikitail.find('#') > -1:
+                    wikitail, kw['anchor'] = wikitail.split('#', 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!
+                    return apply(self.pagelink, (on, wikiutil.AbsPageName(self.request, self.page.page_name, wikitail)), kw)
+                except:
+                    return apply(self.pagelink, (on, wikitail), kw)
+            else:
+                return self.pagelink(0)
         else: # return InterWiki hyperlink
-            href = wikiutil.join_wiki(wikiurl, wikitail)
-            if wikitag_bad:
-                html_class = 'badinterwiki'
+            if on:
+                href = wikiutil.join_wiki(wikiurl, wikitail)
+                if wikitag_bad:
+                    html_class = 'badinterwiki'
+                else:
+                    html_class = 'interwiki'
+                title = kw.get('title', wikitag)
+                return self.url(1, href, title=title, do_escape=1, css=html_class) # interwiki links with umlauts
             else:
-                html_class = 'interwiki'
-            title = kw.get('title', wikitag)
-            return self.url(1, href, title=title, do_escape=1, css=html_class) # interwiki links with umlauts
+                return self.url(0)
 
     def url(self, on, url=None, css=None, do_escape=0, **kw):
         """
--- a/MoinMoin/logfile/editlog.py	Sat Apr 15 15:46:23 2006 +0000
+++ b/MoinMoin/logfile/editlog.py	Sat Apr 15 18:35:41 2006 +0000
@@ -99,7 +99,7 @@
             title = wikiutil.escape(aliasname + title)
             text = (request.formatter.interwikilink(1, title=title, *info) +
                     request.formatter.text(name) +
-                    request.formatter.interwikilink(0))
+                    request.formatter.interwikilink(0, title=title, *info))
         elif kind == 'email':
             name = self._usercache[self.userid].name
             aliasname = self._usercache[self.userid].aliasname
--- a/MoinMoin/parser/wiki.py	Sat Apr 15 15:46:23 2006 +0000
+++ b/MoinMoin/parser/wiki.py	Sat Apr 15 18:35:41 2006 +0000
@@ -197,7 +197,7 @@
               
         return (self.formatter.interwikilink(1, tag, tail) + 
                 self.formatter.text(text) +
-                self.formatter.interwikilink(0))
+                self.formatter.interwikilink(0, tag, tail))
 
     def attachment(self, url_and_text, **kw):
         """ This gets called on attachment URLs.
@@ -350,7 +350,7 @@
         anchor = ""
         if len(parts)==2:
             word, anchor = parts
-            
+
         return (self.formatter.pagelink(1, word, anchor=anchor) +
                 self.formatter.text(text) +
                 self.formatter.pagelink(0, word))
--- a/MoinMoin/theme/__init__.py	Sat Apr 15 15:46:23 2006 +0000
+++ b/MoinMoin/theme/__init__.py	Sat Apr 15 18:35:41 2006 +0000
@@ -216,7 +216,7 @@
             # link to (interwiki) user homepage
             homelink = (request.formatter.interwikilink(1, title=title, id="userhome", *interwiki) +
                         request.formatter.text(name) +
-                        request.formatter.interwikilink(0))
+                        request.formatter.interwikilink(0, title=title, id="userhome", *interwiki))
             userlinks.append(homelink)        
             # link to userprefs action
             userlinks.append(d['page'].link_to(request, text=_('Preferences'),
@@ -297,7 +297,7 @@
                 return (pagename,
                         self.request.formatter.interwikilink(True, interwiki, page) +
                         page +
-                        self.request.formatter.interwikilink(False)
+                        self.request.formatter.interwikilink(False, interwiki, page)
                         )
         
         except ValueError:
@@ -516,10 +516,9 @@
                         # links, using _ for spaces.
                         page = page.replace('_', ' ')
                         if request.cfg.interwikiname != interwiki:
-                            link = (self.request.formatter.interwikilink(
-                                True, interwiki, page) +
+                            link = (self.request.formatter.interwikilink(True, interwiki, page) +
                                     self.shortenPagename(page) +
-                                    self.request.formatter.interwikilink(False))
+                                    self.request.formatter.interwikilink(False, interwiki, page))
                             items.append('<li>%s</li>' % link)
                             continue
                         else:
--- a/docs/CHANGES	Sat Apr 15 15:46:23 2006 +0000
+++ b/docs/CHANGES	Sat Apr 15 18:35:41 2006 +0000
@@ -49,6 +49,8 @@
     * Fix eating of newline before tables.
     * Fixed incorrect login hint for not logged-in users trying a disallowed
       action.
+    * Fixed nasty missing or double </a> formatter bug (mostly happening when
+      user has enabled questionmarks for nonexisting pages).
 
   Other Changes:
     * We catch and ignore html to wiki conversion errors in case of hitting