changeset 2757:e3b0355215a2

wiki parser: fix interwiki regex wrong matches, commented that regex part
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 25 Aug 2007 13:45:24 +0200
parents bdb12fb39b00
children b85e4879fdea
files MoinMoin/parser/text_moin_wiki.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/text_moin_wiki.py	Thu Aug 23 21:41:37 2007 +0200
+++ b/MoinMoin/parser/text_moin_wiki.py	Sat Aug 25 13:45:24 2007 +0200
@@ -220,16 +220,17 @@
     (?P<interwiki_wiki>[A-Z][a-zA-Z]+)  # interwiki wiki name
     \:
     (?P<interwiki_page>
+     (?=[^ ]*[%(u)s%(l)s0..9][^ ]*\ )  # make sure there is something non-blank with at least one alphanum letter following
      [^\s'\"\:\<\|]
      (
-      [^\s%(punct)s]
+      [^\s%(punct)s]  # we take all until we hit some blank or punctuation char ...
      |
       (
-       [%(punct)s]
-       [^\s%(punct)s]
+       [%(punct)s]     # ... but if some punctuation char is followed by something
+       [^\s%(punct)s]  # non-blank (or more punctuation stuff), we also take it!
       )
      )+
-    )  # interwiki page name
+    )
 )|(?P<word>  # must come AFTER interwiki rule!
     %(word_rule)s  # CamelCase wiki words
 )|(?P<link>
@@ -305,6 +306,8 @@
         'dl_rule': dl_rule,
         'word_rule': word_rule,
         'transclude_rule': transclude_rule,
+        'u': config.chars_upper,
+        'l': config.chars_lower,
         'smiley': u'|'.join([re.escape(s) for s in config.smileys])}
 
     # Don't start p before these