changeset 2872:a66f643580fb

Creole parser: {{#foo}} for inserting anchors.
author Radomir Dopieralski <moindev@sheep.art.pl>
date Wed, 26 Sep 2007 01:20:33 +0200
parents 09445c90c743
children 71d89ce8b878
files MoinMoin/parser/text_creole.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/text_creole.py	Wed Sep 26 01:08:34 2007 +0200
+++ b/MoinMoin/parser/text_creole.py	Wed Sep 26 01:20:33 2007 +0200
@@ -137,7 +137,6 @@
             $
         )'''
 
-
     # For splitting table cells:
     cell = r'''
             \| \s*
@@ -165,7 +164,6 @@
     that can be converted into output using Emitter.
     """
 
-
     # For pre escaping, in creole 1.0 done with ~:
     pre_escape_re = re.compile(Rules.pre_escape, re.M | re.X)
     link_re = re.compile('|'.join([Rules.image, Rules.linebreak, Rules.char]), re.X | re.U) # for link descriptions
@@ -685,8 +683,11 @@
         m = self.addr_re.match(target)
         if m:
             if m.group('page_name'):
+                # inserted anchors
+                url = wikiutil.url_unquote(target, want_unicode=True)
+                if target.startswith('#'):
+                    return self.formatter.rawHtml(u'<a name="%s"></a>' % url)
                 # default to images
-                url = wikiutil.url_unquote(target, want_unicode=True)
                 return self.formatter.attachment_image(
                     url, alt=text, html_class='image')
             elif m.group('extern_addr'):