aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/extensions/attr_list.py4
-rw-r--r--tests/extensions/attr_list.html8
-rw-r--r--tests/extensions/attr_list.txt12
3 files changed, 21 insertions, 3 deletions
diff --git a/markdown/extensions/attr_list.py b/markdown/extensions/attr_list.py
index 395259a..683bdf8 100644
--- a/markdown/extensions/attr_list.py
+++ b/markdown/extensions/attr_list.py
@@ -55,8 +55,8 @@ def _handle_word(s, t):
_scanner = Scanner([
(r'[^ ]+=".*?"', _handle_double_quote),
(r"[^ ]+='.*?'", _handle_single_quote),
- (r'[^ ]+=[^ ]*', _handle_key_value),
- (r'[^ ]+', _handle_word),
+ (r'[^ ]+=[^ =]+', _handle_key_value),
+ (r'[^ =]+', _handle_word),
(r' ', None)
])
diff --git a/tests/extensions/attr_list.html b/tests/extensions/attr_list.html
index b76f73b..2a36dbc 100644
--- a/tests/extensions/attr_list.html
+++ b/tests/extensions/attr_list.html
@@ -57,4 +57,10 @@ And a <strong class="nest">nested <a class="linky2" href="http://example.com" ti
<dd><em class="inline">dd</em></dd>
<dt><em class="inline">DT3</em></dt>
<dd>Some dd</dd>
-</dl> \ No newline at end of file
+</dl>
+<h1>Bad attributes</h1>
+<p>Key without <em foo="foo">value</em></p>
+<p>Value without <em>key</em></p>
+<p>No <em>key or value</em></p>
+<p><em>Weirdness</em></p>
+<p><em>More weirdness</em></p> \ No newline at end of file
diff --git a/tests/extensions/attr_list.txt b/tests/extensions/attr_list.txt
index da108e6..c2adbf4 100644
--- a/tests/extensions/attr_list.txt
+++ b/tests/extensions/attr_list.txt
@@ -76,3 +76,15 @@ DT2 {.term}
*DT3*{.inline}
: Some dd
+# Bad attributes
+
+Key without *value*{ foo= }
+
+Value without *key*{ =bar }
+
+No *key or value*{ = }
+
+*Weirdness*{ == }
+
+*More weirdness*{ === }
+