diff options
author | Jens Diemer <github.com@jensdiemer.de> | 2009-06-10 14:39:43 +0000 |
---|---|---|
committer | Jens Diemer <github.com@jensdiemer.de> | 2009-06-10 14:39:43 +0000 |
commit | 92d62ff287d0186f86f41a7fe73743fd8d081214 (patch) | |
tree | 9122663edc79598d33bf8d14881bb284684bf868 | |
parent | eb3b72ef931b039884f84438697ef9ec8a71c8a0 (diff) | |
download | creole-92d62ff287d0186f86f41a7fe73743fd8d081214.tar.gz |
v0.2.4
creole2html: ignore file extensions in image tag
see also: http://code.google.com/p/python-creole/issues/detail?id=7
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | creole/__init__.py | 4 | ||||
-rw-r--r-- | creole/creole_parser.py | 9 | ||||
-rw-r--r-- | tests/test_creole2html.py | 4 | ||||
-rw-r--r-- | tests/test_cross_compare.py | 6 |
5 files changed, 17 insertions, 12 deletions
@@ -32,6 +32,12 @@ See also: http://code.google.com/p/python-creole/source/browse/trunk/demo.py history ========= +- v0.2.4 + + - creole2html: ignore file extensions in image tag + + - see also: http://code.google.com/p/python-creole/issues/detail?id=7 + - v0.2.3 - html2creole bugfix/enhanced: convert image tag without alt attribute: diff --git a/creole/__init__.py b/creole/__init__.py index e52aad9..956a138 100644 --- a/creole/__init__.py +++ b/creole/__init__.py @@ -10,8 +10,8 @@ from html2creole import Html2CreoleParser, Html2CreoleEmitter # - Only use . as a separator # - No spaces: "0.8.0 RC2" -> "0.8.0RC2" # http://peak.telecommunity.com/DevCenter/setuptools#specifying-your-project-s-version -__version__ = (0, 2, 3, "") -VERSION_STRING = "0.2.3" +__version__ = (0, 2, 4, "") +VERSION_STRING = "0.2.4" def creole2html(markup_string, debug=False, **kwargs): diff --git a/creole/creole_parser.py b/creole/creole_parser.py index a3a1601..63c94e9 100644 --- a/creole/creole_parser.py +++ b/creole/creole_parser.py @@ -67,15 +67,10 @@ class InlineRules: # \[\[(?P<internal_link>.+)\]\] # ''' % proto - #-------------------------------------------------------------------------- - # The image rule should not match on django template tags! So we make it - # more restricted. - # It matches only if... - # ...image target ends with a picture extention - # ...separator >|< and the image text exist + # image tag image = r'''(?P<image> {{ - (?P<image_target>.+?(\.jpg|\.jpeg|\.gif|\.png)) \s* + (?P<image_target>.+?) \s* (\| \s* (?P<image_text>.+?) \s*)? }} )(?i)''' diff --git a/tests/test_creole2html.py b/tests/test_creole2html.py index b80db36..0aba66e 100644 --- a/tests/test_creole2html.py +++ b/tests/test_creole2html.py @@ -354,11 +354,11 @@ class TestCreole2htmlMarkup(BaseCreoleTest): """ test image tag with different picture text """ self.assertCreole(r""" {{foobar1.jpg}} - {{/foobar2.jpg|foobar2.jpg}} + {{/path1/path2/foobar2.jpg}} {{/path1/path2/foobar3.jpg|foobar3.jpg}} """, """ <p><img src="foobar1.jpg" alt="foobar1.jpg" /><br /> - <img src="/foobar2.jpg" alt="foobar2.jpg" /><br /> + <img src="/path1/path2/foobar2.jpg" alt="/path1/path2/foobar2.jpg" /><br /> <img src="/path1/path2/foobar3.jpg" alt="foobar3.jpg" /></p> """) diff --git a/tests/test_cross_compare.py b/tests/test_cross_compare.py index 9b342c4..757be4b 100644 --- a/tests/test_cross_compare.py +++ b/tests/test_cross_compare.py @@ -104,11 +104,15 @@ class CrossCompareTests(BaseCreoleTest): a {{/image.jpeg|JPEG pictures}} and a {{/image.gif|GIF pictures}} and a {{/image.png|PNG pictures}} ! + {{/path1/path2/image|Image without files ext?}} + [[http://example.com/|{{myimage.jpg|example site}}]] """, """ <p>a <img src="/image.jpg" alt="JPG pictures" /> and<br /> a <img src="/image.jpeg" alt="JPEG pictures" /> and<br /> a <img src="/image.gif" alt="GIF pictures" /> and<br /> - a <img src="/image.png" alt="PNG pictures" /> !</p> + a <img src="/image.png" alt="PNG pictures" /> !<br /> + <img src="/path1/path2/image" alt="Image without files ext?" /><br /> + <a href="http://example.com/"><img src="myimage.jpg" alt="example site" /></a></p> """) def test_nowiki1(self): |