changeset 3041:7400c1f2e20a

Creole: fix bug that prevents images inside links
author Radomir Dopieralski <moindev@sheep.art.pl>
date Thu, 14 Feb 2008 17:15:04 +0100
parents 8608b258f8e6
children 353739af70fa
files MoinMoin/parser/text_creole.py
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/text_creole.py	Tue Feb 05 21:22:56 2008 +0100
+++ b/MoinMoin/parser/text_creole.py	Thu Feb 14 17:15:04 2008 +0100
@@ -249,10 +249,6 @@
 
     def link_emit(self, node):
         target = node.content
-        if node.children:
-            inside = self.emit_children(node)
-        else:
-            inside = self.formatter.text(target)
         m = self.addr_re.match(target)
         if m:
             if m.group('page_name'):
@@ -270,7 +266,7 @@
                     word, anchor = parts
                 return ''.join([
                     self.formatter.pagelink(1, word, anchor=anchor),
-                    inside,
+                    self.emit_children(node) or self.formatter.text(target),
                     self.formatter.pagelink(0, word),
                 ])
             elif m.group('extern_addr'):
@@ -279,18 +275,16 @@
                 proto = m.group('extern_proto')
                 return ''.join([
                     self.formatter.url(1, address, css=proto),
-                    inside,
+                    self.emit_children(node) or self.formatter.text(target),
                     self.formatter.url(0),
                 ])
             elif m.group('inter_wiki'):
                 # interwiki link
                 wiki = m.group('inter_wiki')
                 page = m.group('inter_page')
-                if not node.children: # interwiki links don't show the moniker
-                    inside = self.formatter.text(page)
                 return ''.join([
                     self.formatter.interwikilink(1, wiki, page),
-                    inside,
+                    self.emit_children(node) or self.formatter.text(page),
                     self.formatter.interwikilink(0),
                 ])
             elif m.group('attach_scheme'):