diff MoinMoin/formatter/text_html.py @ 410:1a2bd0457cf3

fix some wrong attributes, todo: fix quoting, see comment in text_html.url imported from: moin--main--1.5--patch-414
author Thomas Waldmann <tw@waldmann-edv.de>
date Fri, 03 Feb 2006 19:15:18 +0000
parents bea43f99cc27
children 6a0bfc86b441
line wrap: on
line diff
--- a/MoinMoin/formatter/text_html.py	Fri Feb 03 18:42:04 2006 +0000
+++ b/MoinMoin/formatter/text_html.py	Fri Feb 03 19:15:18 2006 +0000
@@ -519,15 +519,16 @@
             else:
                 html_class = 'interwiki'
             title = kw.get('title', wikitag)
-            return self.url(1, href, title=title, unescaped=0, css=html_class)
-            # unescaped=1 was changed to 0 to make interwiki links with pages with umlauts (or other non-ascii) work
+            return self.url(1, href, title=title, do_escape=1, css=html_class) # interwiki links with umlauts
 
-    def url(self, on, url=None, css=None, **kw):
+    def url(self, on, url=None, css=None, do_escape=0, **kw):
         """ Inserts an <a> element.
 
             Call once with on=1 to start the link, and again with on=0
             to end it (no other arguments are needed when on==0).
 
+            do_escape: XXX doesn't work yet
+
             Keyword params:
                 url - the URL to link to; will go through Wiki URL mapping.
                 css - a space-separated list of CSS classes
@@ -549,6 +550,11 @@
             del kw['href']
         if url is not None:
             url = wikiutil.mapURL(self.request, url)
+            
+            # TODO just calling url_quote does not work, as it will also quote "http:" to "http%xx" X)
+            if 0: # do_escape: # protocol and server part must not get quoted, path should get quoted
+                url = wikiutil.url_quote(url)
+            
             attrs['href'] = url
 
         if css:
@@ -719,12 +725,12 @@
                     src=AttachFile.getAttachUrl(
                     pagename, filename, self.request,
                     addts=1),
-                    usemap='#'+mapid, html_class="drawing"))
+                    usemap='#'+mapid, css="drawing"))
         else:
             return wikiutil.link_tag(self.request,
                                      edit_link,
                                      self.image(alt=url,
-                                                src=AttachFile.getAttachUrl(pagename, filename, self.request, addts=1), html_class="drawing"),
+                                                src=AttachFile.getAttachUrl(pagename, filename, self.request, addts=1), css="drawing"),
                                      attrs='title="%s"' % (_('Edit drawing %(filename)s') % {'filename': self.text(fname)}))
         
     
@@ -1215,10 +1221,10 @@
             result = ("%s%s%s%s%s%s%s%s" %
                       (result,
                        kw.get('icons', ''),
-                       self.url(1, "#bottom", unescaped=1),
+                       self.url(1, "#bottom", do_escape=0),
                        self.icon('bottom'),
                        self.url(0),
-                       self.url(1, "#top", unescaped=1),
+                       self.url(1, "#top", do_escape=0),
                        self.icon('top'),
                        self.url(0)))
         return "%s%s%s" % (result, kw.get('icons', ''), number)