diff options
-rw-r--r-- | markdown/inlinepatterns.py | 2 | ||||
-rw-r--r-- | tests/misc/brackets-in-img-title.html | 9 | ||||
-rw-r--r-- | tests/misc/brackets-in-img-title.txt | 12 |
3 files changed, 22 insertions, 1 deletions
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py index de957ef..bd3d17b 100644 --- a/markdown/inlinepatterns.py +++ b/markdown/inlinepatterns.py @@ -107,7 +107,7 @@ LINK_RE = NOIMG + BRK + \ r'''\(\s*(<.*?>|((?:(?:\(.*?\))|[^\(\)]))*?)\s*((['"])(.*?)\12\s*)?\)''' # [text](url) or [text](<url>) or [text](url "title") -IMAGE_LINK_RE = r'\!' + BRK + r'\s*\((<.*?>|([^\)]*))\)' +IMAGE_LINK_RE = r'\!' + BRK + r'\s*\((<.*?>|([^")]+"[^"]*"|[^\)]*))\)' # ![alttxt](http://x.com/) or ![alttxt](<http://x.com/>) REFERENCE_RE = NOIMG + BRK+ r'\s?\[([^\]]*)\]' # [Google][3] SHORT_REF_RE = NOIMG + r'\[([^\]]+)\]' # [Google] diff --git a/tests/misc/brackets-in-img-title.html b/tests/misc/brackets-in-img-title.html new file mode 100644 index 0000000..3677139 --- /dev/null +++ b/tests/misc/brackets-in-img-title.html @@ -0,0 +1,9 @@ +<p><img alt="alt" src="local-img.jpg" /> +<img alt="alt" src="local-img.jpg" title="" /> +<img alt="alt" src="local-img.jpg" title="normal title" /></p> +<p><img alt="alt" src="local-img.jpg" title="(just title in brackets)" /> +<img alt="alt" src="local-img.jpg" title="title with brackets (I think)" /></p> +<p><img alt="alt" src="local-img.jpg" title="(" /> +<img alt="alt" src="local-img.jpg" title="(open only" /> +<img alt="alt" src="local-img.jpg" title=")" /> +<img alt="alt" src="local-img.jpg" title="close only)" /></p>
\ No newline at end of file diff --git a/tests/misc/brackets-in-img-title.txt b/tests/misc/brackets-in-img-title.txt new file mode 100644 index 0000000..01fcd4e --- /dev/null +++ b/tests/misc/brackets-in-img-title.txt @@ -0,0 +1,12 @@ +![alt](local-img.jpg) +![alt](local-img.jpg "") +![alt](local-img.jpg "normal title") + +![alt](local-img.jpg "(just title in brackets)") +![alt](local-img.jpg "title with brackets (I think)") + +![alt](local-img.jpg "(") +![alt](local-img.jpg "(open only") +![alt](local-img.jpg ")") +![alt](local-img.jpg "close only)") + |