changeset 3089:7345503952dd

RST parser: fix attachment: and drawing: processing (ported from 1.6)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 23 Feb 2008 00:39:18 +0100
parents 9f6fe753d567
children 93ae352854be
files MoinMoin/parser/text_rst.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/text_rst.py	Sat Feb 23 00:37:37 2008 +0100
+++ b/MoinMoin/parser/text_rst.py	Sat Feb 23 00:39:18 2008 +0100
@@ -338,18 +338,22 @@
                 prefix, link = refuri.lstrip().split(':', 1)
 
             # First see if MoinMoin should handle completely. Exits through add_wiki_markup.
-            if ((refuri.startswith('<<') and refuri.endswith('>>')) or
-                    (prefix == 'drawing')):
+            if refuri.startswith('<<') and refuri.endswith('>>'): # moin macro
                 self.process_wiki_text(refuri)
                 self.wiki_text = self.fixup_wiki_formatting(self.wiki_text)
                 self.add_wiki_markup()
 
+            if prefix == 'drawing': # twikidraw drawing
+                self.process_wiki_text("[[%s]]" % refuri)
+                self.wiki_text = self.fixup_wiki_formatting(self.wiki_text)
+                self.add_wiki_markup()
+
             # From here down, all links are handled by docutils (except
             # missing attachments), just fixup node['refuri'].
             if prefix == 'attachment':
                 if not AttachFile.exists(self.request, self.request.page.page_name, link):
                     # Attachment doesn't exist, give to MoinMoin to insert upload text.
-                    self.process_wiki_text(refuri)
+                    self.process_wiki_text("[[%s]]" % refuri)
                     self.wiki_text = self.fixup_wiki_formatting(self.wiki_text)
                     self.add_wiki_markup()
                 # Attachment exists, just get a link to it.
@@ -408,7 +412,7 @@
                 # Attachment doesn't exist, MoinMoin should process it
                 if prefix == '':
                     prefix = 'attachment:'
-                self.process_wiki_text(prefix + attach_name)
+                self.process_wiki_text("{{%s%s}}" % (prefix, attach_name))
                 self.wiki_text = self.fixup_wiki_formatting(self.wiki_text)
                 self.add_wiki_markup()
             # Attachment exists, get a link to it.