escape HTML tag chars in inline quotes (#100)
diff --git a/migration/src/markup/text_effects.py b/migration/src/markup/text_effects.py
index a59636e..840158e 100644
--- a/migration/src/markup/text_effects.py
+++ b/migration/src/markup/text_effects.py
@@ -38,11 +38,18 @@
class TweakedQuote(AbstractMarkup):
is_inline_element = False
+ def action(self, tokens: ParseResults) -> str:
+ # escape HTML tag
+ token = tokens[0].replace("<", "<")
+ token = token.replace(">", ">")
+ return token
+
@property
def expr(self) -> ParserElement:
return ("\n" | StringStart()) + Combine(
Literal("bq. ").setParseAction(replaceWith("> "))
- + SkipTo(LineEnd()) + LineEnd().setParseAction(replaceWith("\n\n")) # needs additional line feed at the end of quotation to preserve indentation
+ + SkipTo(LineEnd()).setParseAction(self.action)
+ + LineEnd().setParseAction(replaceWith("\n\n")) # needs additional line feed at the end of quotation to preserve indentation
)