python-textile
python-textile copied to clipboard
images with classes and alt-tags don't work
looks like the classid regex's forward-looking condition doesn't like the alt tag in parentheses on images.
Example: !(myclass)/assets/photo.png(cool stuff)!
Here's a simple patch that creates an image-classid regex that removes the forward-looking condition:
--- textile.py.orig 2009-12-03 13:25:19.000000000 -0500
+++ textile.py 2009-12-03 13:26:32.000000000 -0500
@@ -285,6 +285,15 @@
) #
(?![^\s]*(?:\([\w#]+\))) # must happen once
''',
+
+ # Class and/or id (for images)
+ 'iclassid': r'''( #
+ (?:\(\#[\w]+\)) # (#id)
+ | #
+ (?:\((?:[\w]+(?:\s[\w]+)*) #
+ (?:\#[\w]+)?\)) # (class1 class2 ... classn#id) or (class1 class2 ... classn)
+ ) #
+ ''',
# Language.
'lang': r'''(?:\[[\w-]+\]) # [lang]
@@ -412,7 +421,7 @@
| #
(?: [\-\^~]+ # vertical alignment tags
(?![^\s]*(?:[\-\^~]))) # (must happen once)
- | %(classid)s # class and/or id
+ | %(iclassid)s # class and/or id
| %(padding)s # padding tags
| %(style)s # {style}
)+ #