changeset 2619:ab96fb95248d

creole parser: fix wrong italic caused by unrecognized urls
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 09 Aug 2007 13:13:16 +0200
parents 82cfcd5c4777
children 286a011251ff
files MoinMoin/parser/text_creole.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/text_creole.py	Thu Aug 09 12:58:37 2007 +0200
+++ b/MoinMoin/parser/text_creole.py	Thu Aug 09 13:13:16 2007 +0200
@@ -11,6 +11,9 @@
       Creole 1.0 does not require us to support this.
     * No (non-bracketed) generic url recognition: this is "mission impossible"
       except if you want to risk lots of false positives.
+    * We do not allow : before // italic markup to avoid urls with unrecognized
+      schemes (like wtf://server/path) triggering italic rendering for the rest
+      of the paragraph.
 
     @copyright: 2007 MoinMoin:RadomirDopieralski (creole 0.5 implementation),
                 2007 MoinMoin:ThomasWaldmann (updates)
@@ -71,7 +74,8 @@
         'image': r'{{(?P<image_target>.+?)\s*(\|\s*(?P<image_text>.+?)\s*)?}}',
         'macro': r'<<(?P<macro_target>.+?)\s*(\|\s*(?P<macro_text>.+?)\s*)?>>',
         'code': r'{{{(?P<code_text>.*?)}}}',
-        'emph': r'//',
+        'emph': r'(?<!:)//', # there must be no : in front of the // - avoids
+                             # italic rendering in urls with unknown protocols
         'strong': r'\*\*',
         'break': r'\\\\',
         'escape': r'~(?P<escaped_char>[^\s])', # tilde is the escape char