Skip to content

Commit

Permalink
Override regex for html inline pattern when smart_angled_quotes is true
Browse files Browse the repository at this point in the history
Add a restriction that the closing angled quote should not be duplicate,
so that we can use our own pattern for handling duplicate quotes.
  • Loading branch information
mitya57 committed Jun 20, 2015
1 parent c906d6d commit 93d7941
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion markdown/extensions/smarty.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

from __future__ import unicode_literals
from . import Extension
from ..inlinepatterns import HtmlPattern
from ..inlinepatterns import HtmlPattern, HTML_RE
from ..odict import OrderedDict
from ..treeprocessors import InlineProcessor

Expand Down Expand Up @@ -147,6 +147,8 @@
remainingSingleQuotesRegex = "'"
remainingDoubleQuotesRegex = '"'

HTML_STRICT_RE = HTML_RE + r'(?!\>)'


class SubstituteTextPattern(HtmlPattern):
def __init__(self, pattern, replace, markdown_instance):
Expand Down Expand Up @@ -251,6 +253,9 @@ def extendMarkdown(self, md, md_globals):
self.educateQuotes(md)
if configs['smart_angled_quotes']:
self.educateAngledQuotes(md)
# Override HTML_RE from inlinepatterns.py so that it does not
# process tags with duplicate closing quotes.
md.inlinePatterns["html"] = HtmlPattern(HTML_STRICT_RE, md)
if configs['smart_dashes']:
self.educateDashes(md)
inlineProcessor = InlineProcessor(md)
Expand Down

0 comments on commit 93d7941

Please sign in to comment.