From 4fc04c6477914e26d8164b65238435c891f00108 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Mon, 13 Jun 2016 18:19:31 +0300 Subject: =?UTF-8?q?Fix=20another=20issue=20with=20attribute=20lists=20(wit?= =?UTF-8?q?h=20multiple=20=E2=80=98=3D=E2=80=99=20signs)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- markdown/extensions/attr_list.py | 6 +++--- tests/extensions/attr_list.html | 1 + tests/extensions/attr_list.txt | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/markdown/extensions/attr_list.py b/markdown/extensions/attr_list.py index de39944..ccc5b2f 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/tests/extensions/attr_list.html b/tests/extensions/attr_list.html index 93a862f..29e400d 100644 --- a/tests/extensions/attr_list.html +++ b/tests/extensions/attr_list.html @@ -64,5 +64,6 @@ And a nested No key or value

Weirdness

More weirdness

+

This should not cause a crash

Attr_lists do not contain newlines{ foo=bar key=value }

\ No newline at end of file diff --git a/tests/extensions/attr_list.txt b/tests/extensions/attr_list.txt index 603b611..98f1cc7 100644 --- a/tests/extensions/attr_list.txt +++ b/tests/extensions/attr_list.txt @@ -88,5 +88,7 @@ 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 } -- cgit v1.2.1 From 65170bf24268620598ef0d5a19aa945af5cb22f4 Mon Sep 17 00:00:00 2001 From: facelessuser Date: Tue, 26 Jul 2016 20:28:18 -0600 Subject: Fix image titles not following spec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t allow spaces in image links. This was also causing an issue where any text following a space was treated as a title. Ref #484. --- markdown/inlinepatterns.py | 2 +- tests/misc/image.html | 4 +++- tests/misc/image.txt | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) 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]() -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/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 @@

Poster

Poster

-

Blank

\ No newline at end of file +

Blank

+

![Fail](http://humane man.jpg "The most humane man.")

+

![Fail](http://humane man.jpg)

\ 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) -- cgit v1.2.1 From 5f358c0d580bd409279cef1404e6460e7fe2156e Mon Sep 17 00:00:00 2001 From: eph Date: Mon, 15 Aug 2016 22:33:55 +0800 Subject: Fix table alignment when seperator contains spaces (#489) * Fix table alignment when seperator contains spaces eg. seperator like "------ | :----- | :----: | -----: | ------" * Update tests for table * Delete the newline at the end of tables.html --- markdown/extensions/tables.py | 1 + tests/extensions/extra/tables.html | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) 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/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 @@ - + - + - + - + -- cgit v1.2.1
ItemItem Value
ComputerComputer $1600
PhonePhone $12
PipePipe $1