1. Martin von Löwis
  2. creoleparser-3k

Commits

step...@a60eed84-fc3d-0410-a09c-0d1a7a6707c9  committed b959254

links and images don't need closing

  • Participants
  • Parent commits 379e0d7
  • Branches default

Comments (0)

Files changed (2)

File CHANGES.txt

View file
  • Ignore whitespace
+Version 0.?.? (Nov ?? 2007)
+---------------------------
+
+ * links don't have to close! (makes them more robust)
+
+
 Version 0.2.1 (Nov 6 2007)
 --------------------------
 

File creoleparser/elements.py

View file
  • Ignore whitespace
             return esc_neg_look + re.escape(self.token) + content + end
         else:
             content = '(.+?)'
-            return esc_neg_look + re.escape(self.token[0]) + content + esc_neg_look + re.escape(self.token[1])
+            return esc_neg_look + re.escape(self.token[0]) +\
+                   content + '(' + esc_neg_look + re.escape(self.token[1]) +\
+                   r'|$)'
              
 
 class Link(InlineElement):
     def pre_escape_pattern(self):
         return '(' + re.escape(self.token[0]) + '.*?)' + \
                '(' + re.escape(self.delimiter) + '.*?' + \
-               re.escape(self.token[1]) + ')'
+               '(' + re.escape(self.token[1]) + '|$))'
         
     def _build(self,mo):
         body = mo.group(1).split(escape_char + self.delimiter, 1)
     def pre_escape_pattern(self):
         return '(' + re.escape(self.token[0]) + '.*?)' + \
                '(' + re.escape(self.delimiter) + '.*?' + \
-               re.escape(self.token[1]) + ')'
+               '(' + re.escape(self.token[1]) + '|$))'
 
     def _build(self,mo):
         body = mo.group(1).split(escape_char+self.delimiter,1)