diff --git a/markdown/extensions/smarty.py b/markdown/extensions/smarty.py
index 46e54c1ec..223f2adc4 100644
--- a/markdown/extensions/smarty.py
+++ b/markdown/extensions/smarty.py
@@ -211,10 +211,10 @@ def educateAngledQuotes(self, md):
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 @@ def extendMarkdown(self, md, md_globals):
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, '
“Ellipsis within quotes…”
Кавычки-«ёлочки»
+«hello»
Anführungszeichen-»Chevrons«
Escaped -- ndash
diff --git a/tests/extensions/smarty.txt b/tests/extensions/smarty.txt
index 48430bb18..d7cba6a61 100644
--- a/tests/extensions/smarty.txt
+++ b/tests/extensions/smarty.txt
@@ -19,6 +19,7 @@ em-dashes (---) and ellipes (...)
"Ellipsis within quotes..."
Кавычки-<<ёлочки>>
+<