diff options
-rw-r--r-- | markdown/extensions/attr_list.py | 6 | ||||
-rw-r--r-- | markdown/extensions/tables.py | 1 | ||||
-rw-r--r-- | markdown/inlinepatterns.py | 2 | ||||
-rw-r--r-- | tests/extensions/attr_list.html | 3 | ||||
-rw-r--r-- | tests/extensions/attr_list.txt | 2 | ||||
-rw-r--r-- | tests/extensions/extra/tables.html | 8 | ||||
-rw-r--r-- | tests/misc/image.html | 4 | ||||
-rw-r--r-- | tests/misc/image.txt | 6 |
8 files changed, 21 insertions, 11 deletions
diff --git a/markdown/extensions/attr_list.py b/markdown/extensions/attr_list.py index 8735538..c897a9c 100644 --- a/markdown/extensions/attr_list.py +++ b/markdown/extensions/attr_list.py @@ -32,17 +32,17 @@ except AttributeError: # pragma: no cover def _handle_double_quote(s, t): - k, v = t.split('=') + k, v = t.split('=', 1) return k, v.strip('"') def _handle_single_quote(s, t): - k, v = t.split('=') + k, v = t.split('=', 1) return k, v.strip("'") def _handle_key_value(s, t): - return t.split('=') + return t.split('=', 1) def _handle_word(s, t): diff --git a/markdown/extensions/tables.py b/markdown/extensions/tables.py index a19018e..8c11739 100644 --- a/markdown/extensions/tables.py +++ b/markdown/extensions/tables.py @@ -45,6 +45,7 @@ class TableProcessor(BlockProcessor): # Get alignment of columns align = [] for c in self._split_row(seperator, border): + c = c.strip() if c.startswith(':') and c.endswith(':'): align.append('center') elif c.startswith(':'): diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py index dcf4ad4..6d4c969 100644 --- a/markdown/inlinepatterns.py +++ b/markdown/inlinepatterns.py @@ -130,7 +130,7 @@ LINK_RE = NOIMG + BRK + \ r'''\(\s*(<.*?>|((?:(?:\(.*?\))|[^\(\)]))*?)\s*((['"])(.*?)\12\s*)?\)''' # ![alttxt](http://x.com/) or ![alttxt](<http://x.com/>) -IMAGE_LINK_RE = r'\!' + BRK + r'\s*\((<.*?>|([^")]+"[^"]*"|[^\)]*))\)' +IMAGE_LINK_RE = r'\!' + BRK + r'\s*\(\s*(<.*?>|([^"\)\s]+\s*"[^"]*"|[^\)\s]*))\s*\)' # [Google][3] REFERENCE_RE = NOIMG + BRK + r'\s?\[([^\]]*)\]' diff --git a/tests/extensions/attr_list.html b/tests/extensions/attr_list.html index 6eafd3e..8900de0 100644 --- a/tests/extensions/attr_list.html +++ b/tests/extensions/attr_list.html @@ -64,6 +64,7 @@ And a <strong class="nest">nested <a class="linky2" href="http://example.com" ti <p>No <em>key or value</em></p> <p><em>Weirdness</em></p> <p><em>More weirdness</em></p> +<p>This should not cause a <em foo="a=b">crash</em></p> <p>Attr_lists do not contain <em>newlines</em>{ foo=bar key=value }</p> -<p>Extra <em foo="bar">equals signs</em></p>
\ No newline at end of file +<p>Extra <em foo="bar">equals signs</em></p> diff --git a/tests/extensions/attr_list.txt b/tests/extensions/attr_list.txt index 54ebcb6..c3d06df 100644 --- a/tests/extensions/attr_list.txt +++ b/tests/extensions/attr_list.txt @@ -88,6 +88,8 @@ No *key or value*{ = } *More weirdness*{ === } +This should not cause a *crash*{ foo=a=b } + Attr_lists do not contain *newlines*{ foo=bar key=value } diff --git a/tests/extensions/extra/tables.html b/tests/extensions/extra/tables.html index 783c205..b5c08be 100644 --- a/tests/extensions/extra/tables.html +++ b/tests/extensions/extra/tables.html @@ -38,21 +38,21 @@ <table> <thead> <tr> -<th>Item</th> +<th align="left">Item</th> <th align="right">Value</th> </tr> </thead> <tbody> <tr> -<td>Computer</td> +<td align="left">Computer</td> <td align="right">$1600</td> </tr> <tr> -<td>Phone</td> +<td align="left">Phone</td> <td align="right">$12</td> </tr> <tr> -<td>Pipe</td> +<td align="left">Pipe</td> <td align="right">$1</td> </tr> </tbody> diff --git a/tests/misc/image.html b/tests/misc/image.html index aa24cef..1171e4e 100644 --- a/tests/misc/image.html +++ b/tests/misc/image.html @@ -1,3 +1,5 @@ <p><img alt="Poster" src="http://humane_man.jpg" title="The most humane man." /></p> <p><img alt="Poster" src="http://humane_man.jpg" title="The most humane man." /></p> -<p><img alt="Blank" src="" /></p>
\ No newline at end of file +<p><img alt="Blank" src="" /></p> +<p>![Fail](http://humane man.jpg "The most humane man.")</p> +<p>![Fail](http://humane man.jpg)</p>
\ No newline at end of file diff --git a/tests/misc/image.txt b/tests/misc/image.txt index 41a8cf7..3fae16a 100644 --- a/tests/misc/image.txt +++ b/tests/misc/image.txt @@ -5,4 +5,8 @@ [Poster]:http://humane_man.jpg "The most humane man." -![Blank]()
\ No newline at end of file +![Blank]() + +![Fail](http://humane man.jpg "The most humane man.") + +![Fail](http://humane man.jpg) |