diff options
author | Dmitry Shachnev <mitya57@gmail.com> | 2015-06-15 17:50:27 +0300 |
---|---|---|
committer | Waylan Limberg <waylan.limberg@icloud.com> | 2015-12-29 17:48:46 -0500 |
commit | 7b090e75e4843ff625d454e5dcaf854c2b178530 (patch) | |
tree | 1ecbf8da9a604eda88771ca8a69247ed5a8dd12f | |
parent | 668d78e158248e2201958fd4a88bec412859a5cb (diff) | |
download | python-markdown-7b090e75e4843ff625d454e5dcaf854c2b178530.tar.gz |
smarty: Use a separate processor for angled quotes
Run that processor before inline processor to fix the test failure.
Conflicts:
markdown/extensions/smarty.py
-rw-r--r-- | markdown/extensions/smarty.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/markdown/extensions/smarty.py b/markdown/extensions/smarty.py index 5ac6dc9..2a4ef90 100644 --- a/markdown/extensions/smarty.py +++ b/markdown/extensions/smarty.py @@ -211,10 +211,10 @@ class SmartyExtension(Extension): rightAngledQuotePattern = SubstituteTextPattern( r'\>\>', (self.substitutions['right-angle-quote'],), md ) - self.inlinePatterns.add( + self.angledQuotesPatterns.add( 'smarty-left-angle-quotes', leftAngledQuotePattern, '_begin' ) - self.inlinePatterns.add( + self.angledQuotesPatterns.add( 'smarty-right-angle-quotes', rightAngledQuotePattern, '>smarty-left-angle-quotes' @@ -249,11 +249,19 @@ class SmartyExtension(Extension): self.educateEllipses(md) if configs['smart_quotes']: self.educateQuotes(md) - if configs['smart_angled_quotes']: - self.educateAngledQuotes(md) if configs['smart_dashes']: self.educateDashes(md) inlineProcessor = InlineProcessor(md) inlineProcessor.inlinePatterns = self.inlinePatterns md.treeprocessors.add('smarty', inlineProcessor, '_end') md.ESCAPED_CHARS.extend(['"', "'"]) + if configs['smart_angled_quotes']: + self.angledQuotesPatterns = OrderedDict() + self.educateAngledQuotes(md) + angledQuotesProcessor = InlineProcessor(md) + angledQuotesProcessor.inlinePatterns = self.angledQuotesPatterns + md.treeprocessors.add('smarty-angledquotes', angledQuotesProcessor, '<inline') + + +def makeExtension(*args, **kwargs): + return SmartyExtension(*args, **kwargs) |