From fc1425c7016903b620220a21d761d9198bc874d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20Carton?= Date: Sun, 22 Nov 2020 15:15:52 +0100 Subject: Allow escaping $ and fix & - $ can now be escaped with \$ to prevent variable substitution - this is not needed in code blocks (``` ... ```), variables are never expanded there - & is properly escaped so that a & in markdown will result in a & in html, as one would expect --- blogit | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/blogit b/blogit index 24e79d4..be99cff 100755 --- a/blogit +++ b/blogit @@ -142,8 +142,10 @@ blog/%.html: articles/% $(addprefix templates/,$(addsuffix .html,header article_ -e '/^;/d' \ -e 's//\>/g' \ + -e 's/&/\&/g' \ -e '/^```$$/{s,.*,,;x;p;/^<\/code>/d;s,.*,
,;bT}' \
-		-e 'x;/<\/code>/{x;$$G;p;d};x' \
+		-e 'x;/<\/code>/{x;s,\$$,\$,g;$$G;p;d};x' \
+		-e 's,\\\$$,\$,g' \
 		-e '/^####/{s,^####,

,;s,$$,

,;H;s,.*,,;x;p;d}' \ -e '/^###/{s,^###,

,;s,$$,

,;H;s,.*,,;x;p;d}' \ -e '/^##/{s,^##,

,;s,$$,

,;H;s,.*,,;x;p;d}' \ -- cgit v1.2.3