Skip to content

Commit

Permalink
No = in key or value of attr lists.
Browse files Browse the repository at this point in the history
Fixes #389. Thanks for the report @lazka.
  • Loading branch information
waylan committed Feb 25, 2015
1 parent 81a6cea commit f54cd86
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions markdown/extensions/attr_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
])

Expand Down
8 changes: 7 additions & 1 deletion tests/extensions/attr_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,10 @@ <h1 class="block">Definition <em>lists</em></h1>
<dd><em class="inline">dd</em></dd>
<dt><em class="inline">DT3</em></dt>
<dd>Some dd</dd>
</dl>
</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>
12 changes: 12 additions & 0 deletions tests/extensions/attr_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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*{ === }

0 comments on commit f54cd86

Please sign in to comment.