aboutsummaryrefslogtreecommitdiffstats
path: root/markdown
diff options
context:
space:
mode:
authorDmitry Shachnev <mitya57@gmail.com>2015-06-15 17:50:27 +0300
committerDmitry Shachnev <mitya57@gmail.com>2015-06-15 17:50:27 +0300
commit5029d829c1532f31adc9acbf54d88bb469a69a4f (patch)
treeb46824c81e28d9636d38c098099a560fddebb68c /markdown
parentbb9bb318c28fced49de7ef43cd9cd8c364a8b090 (diff)
downloadmarkdown-5029d829c1532f31adc9acbf54d88bb469a69a4f.tar.gz
markdown-5029d829c1532f31adc9acbf54d88bb469a69a4f.tar.bz2
markdown-5029d829c1532f31adc9acbf54d88bb469a69a4f.zip
smarty: Use a separate processor for angled quotes
Run that processor before inline processor to fix the test failure.
Diffstat (limited to 'markdown')
-rw-r--r--markdown/extensions/smarty.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/markdown/extensions/smarty.py b/markdown/extensions/smarty.py
index 46e54c1..223f2ad 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,14 +249,18 @@ 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):