summaryrefslogtreecommitdiff
path: root/blogit
diff options
context:
space:
mode:
authorFrançois-Xavier Carton <fx.carton91@gmail.com>2020-11-22 15:15:52 +0100
committerFrançois-Xavier Carton <fx.carton91@gmail.com>2020-11-22 15:15:52 +0100
commitfc1425c7016903b620220a21d761d9198bc874d8 (patch)
treee7d91ee258980e990dc0df723ab8ec4be15ead0c /blogit
parent2970a04be8d3611c855d22edc7bee3bcfa6eb823 (diff)
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
Diffstat (limited to 'blogit')
-rwxr-xr-xblogit4
1 files changed, 3 insertions, 1 deletions
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/</\&lt;/g' \
-e 's/>/\&gt;/g' \
+ -e 's/&/\&amp;/g' \
-e '/^```$$/{s,.*,,;x;p;/^<\/code>/d;s,.*,<pre><code>,;bT}' \
- -e 'x;/<\/code>/{x;$$G;p;d};x' \
+ -e 'x;/<\/code>/{x;s,\$$,\&#36;,g;$$G;p;d};x' \
+ -e 's,\\\$$,\&#36;,g' \
-e '/^####/{s,^####,<h4>,;s,$$,</h4>,;H;s,.*,,;x;p;d}' \
-e '/^###/{s,^###,<h3>,;s,$$,</h3>,;H;s,.*,,;x;p;d}' \
-e '/^##/{s,^##,<h2>,;s,$$,</h2>,;H;s,.*,,;x;p;d}' \