diff MoinMoin/formatter/text_html.py @ 163:b19525bf0cf6

fixed MoinMoinBugs/HighlightingBreaksAttachmentLink and some more attachment bugs imported from: moin--main--1.5--patch-165
author Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
date Sun, 30 Oct 2005 17:31:59 +0000
parents 99bf20eeb0bc
children a5a8eaf67936
line wrap: on
line diff
--- a/MoinMoin/formatter/text_html.py	Sun Oct 30 12:11:27 2005 +0000
+++ b/MoinMoin/formatter/text_html.py	Sun Oct 30 17:31:59 2005 +0000
@@ -310,9 +310,9 @@
             linktext = _('Upload new attachment "%(filename)s"')
             return wikiutil.link_tag(
                 self.request,
-                self.text('%s?action=AttachFile&rename=%s' %
-                          (wikiutil.quoteWikinameURL(pagename),
-                           wikiutil.url_quote_plus(fname))),
+                ('%s?action=AttachFile&rename=%s' %
+                 (wikiutil.quoteWikinameURL(pagename),
+                  wikiutil.url_quote_plus(fname))),
                 linktext % {'filename': self.text(fname)})
         target = AttachFile.getAttachUrl(pagename, filename, self.request)
         return (self.url(1, target, title="attachment:%s" % url) +
@@ -328,9 +328,9 @@
             linktext = _('Upload new attachment "%(filename)s"')
             return wikiutil.link_tag(
                 self.request,
-                self.text('%s?action=AttachFile&rename=%s' %
-                          (wikiutil.quoteWikinameURL(pagename),
-                           wikiutil.url_quote_plus(fname))),
+                ('%s?action=AttachFile&rename=%s' %
+                 (wikiutil.quoteWikinameURL(pagename),
+                  wikiutil.url_quote_plus(fname))),
                 linktext % {'filename': self.text(fname)})
         return self.image(
             title="attachment:%s" % url,
@@ -355,15 +355,16 @@
         # check whether attachment exists, possibly point to upload form
         if not os.path.exists(fpath):
             linktext = _('Create new drawing "%(filename)s"')
-            return wikiutil.link_tag(self.request,
-                self.text('%s?action=AttachFile&rename=%s%s' % (
-                    wikiutil.quoteWikinameURL(pagename),
-                    wikiutil.url_quote_plus(fname),
-                    drawing and ('&drawing=%s' % wikiutil.url_quote(drawing)) or '')),
+            return wikiutil.link_tag(
+                self.request,
+                ('%s?action=AttachFile&rename=%s%s' %
+                 (wikiutil.quoteWikinameURL(pagename),
+                  wikiutil.url_quote_plus(fname),
+                  drawing and ('&drawing=%s' % wikiutil.url_quote(drawing)) or '')),
                 linktext % {'filename': self.text(fname)})
 
         mappath = AttachFile.getFilename(self.request, pagename, drawing + '.map')
-        edit_link = self.text('%s?action=AttachFile&rename=%s&drawing=%s' % (
+        edit_link = ('%s?action=AttachFile&rename=%s&drawing=%s' % (
             wikiutil.quoteWikinameURL(pagename),
             wikiutil.url_quote_plus(fname),
             wikiutil.url_quote(drawing)))
@@ -402,25 +403,8 @@
                                      attrs='title="%s"' % (_('Edit drawing %(filename)s') % {'filename': self.text(fname)}))
         
     
-    def attachment_inlined(self, url, text, **kw):
-        _ = self.request.getText
-        pagename, filename = AttachFile.absoluteName(url, self.page.page_name)
-        fname = wikiutil.taintfilename(filename)
-        fpath = AttachFile.getFilename(self.request, pagename, fname)
-        base, ext = os.path.splitext(filename)
-        Parser = wikiutil.getParserForExtension(self.request.cfg, ext)
-        if Parser is not None:
-            try:
-                content = file(fpath, 'r').read()
-                # Try to decode text. It might return junk, but we don't
-                # have enough information with attachments.
-                content = wikiutil.decodeUnknownInput(content)
-                colorizer = Parser(content, self.request)
-                colorizer.format(self)
-            except IOError:
-                pass
-
-        return self.attachment_link(url, text)
+    # def attachment_inlined(self, url, text, **kw):
+    # moved to MoinMoin/formatter/base.py
 
 
     # Text ##############################################################