changeset 2945:8962d2095a5a

Creole parser: fixed bug in anchors + test for it
author Radomir Dopieralski <moindev@sheep.art.pl>
date Thu, 08 Nov 2007 22:26:18 +0100
parents 862edffe5d7c
children 1ed67dfb686c
files MoinMoin/parser/_tests/test_text_creole.py MoinMoin/parser/text_creole.py
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/_tests/test_text_creole.py	Thu Nov 08 21:47:58 2007 +0100
+++ b/MoinMoin/parser/_tests/test_text_creole.py	Thu Nov 08 22:26:18 2007 +0100
@@ -425,5 +425,11 @@
         assert 'action=AttachFile' in html
         assert 'some+file.png' in html
 
+    def testAnchor(self):
+        html = self.parse("{{#anchor}}")
+        assert '<a ' in html # must create a link
+        assert 'name="anchor"' in html
+        assert '></a>' in html
+
 coverage_modules = ['MoinMoin.parser.text_creole']
 
--- a/MoinMoin/parser/text_creole.py	Thu Nov 08 21:47:58 2007 +0100
+++ b/MoinMoin/parser/text_creole.py	Thu Nov 08 22:26:18 2007 +0100
@@ -322,7 +322,7 @@
                 # inserted anchors
                 url = wikiutil.url_unquote(target, want_unicode=True)
                 if target.startswith('#'):
-                    return self.formatter.rawHtml(u'<a name="%s"></a>' % url)
+                    return self.formatter.rawHTML(u'<a name="%s"></a>' % url[1:])
                 # default to images
                 return self.formatter.attachment_image(
                     url, alt=text, html_class='image')