Skip to content

Commit f54cd86

Browse files
committed
No = in key or value of attr lists.
Fixes #389. Thanks for the report @lazka.
1 parent 81a6cea commit f54cd86

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

markdown/extensions/attr_list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ def _handle_word(s, t):
5555
_scanner = Scanner([
5656
(r'[^ ]+=".*?"', _handle_double_quote),
5757
(r"[^ ]+='.*?'", _handle_single_quote),
58-
(r'[^ ]+=[^ ]*', _handle_key_value),
59-
(r'[^ ]+', _handle_word),
58+
(r'[^ ]+=[^ =]+', _handle_key_value),
59+
(r'[^ =]+', _handle_word),
6060
(r' ', None)
6161
])
6262

tests/extensions/attr_list.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,10 @@ <h1 class="block">Definition <em>lists</em></h1>
5757
<dd><em class="inline">dd</em></dd>
5858
<dt><em class="inline">DT3</em></dt>
5959
<dd>Some dd</dd>
60-
</dl>
60+
</dl>
61+
<h1>Bad attributes</h1>
62+
<p>Key without <em foo="foo">value</em></p>
63+
<p>Value without <em>key</em></p>
64+
<p>No <em>key or value</em></p>
65+
<p><em>Weirdness</em></p>
66+
<p><em>More weirdness</em></p>

tests/extensions/attr_list.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,15 @@ DT2 {.term}
7676
*DT3*{.inline}
7777
: Some dd
7878

79+
# Bad attributes
80+
81+
Key without *value*{ foo= }
82+
83+
Value without *key*{ =bar }
84+
85+
No *key or value*{ = }
86+
87+
*Weirdness*{ == }
88+
89+
*More weirdness*{ === }
90+

0 commit comments

Comments
 (0)