From 068cb6d35bee7b1a2aac6987a52d282f4950ad32 Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Thu, 22 Sep 2022 10:21:47 -0700 Subject: [PATCH] Fix escapes If you want to include a literal ${macro call}, you can preface it with a backslash like \${macro call}. Signed-off-by: Alek Ratzloff --- markup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/markup.py b/markup.py index 6fe22c2..f6dbbbb 100755 --- a/markup.py +++ b/markup.py @@ -96,10 +96,14 @@ class MarkupParser: def parse(self): while self.c: - if self.c in r"\$": + if self.is_match("${"): mac = self.parse_macro() self.parts += [mac] else: + # skip past the escape + if self.is_match(r"\${"): + self.adv(3) + self.parts += [MarkupRaw("${")] raw = self.parse_raw() self.parts += [raw]