aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe lemons <citrons@mondecitronne.com>2022-02-09 02:25:44 -0600
committerthe lemons <citrons@mondecitronne.com>2022-02-09 02:25:44 -0600
commit8023abd2b9e16363fdfc60c1e03e6ab4531e3df1 (patch)
tree159cbeb8d2b00785211fd4056105c9c9846f943e
parentf9eb0b5207117ed74f395210c375dc751c66888d (diff)
make brackets escapable with backslash
-rwxr-xr-xzzcxz.cgi3
1 files changed, 3 insertions, 0 deletions
diff --git a/zzcxz.cgi b/zzcxz.cgi
index 7fc0724..797f2ea 100755
--- a/zzcxz.cgi
+++ b/zzcxz.cgi
@@ -199,6 +199,9 @@ local function convert_markup(m)
table.insert(result, '<pre><code>')
code_block = true
else
+ line = line:gsub("\\\\([%[%]])", "&#92;%1")
+ line = line:gsub("\\([%[%]])",
+ { ['['] = "&#91;", [']'] = "&#93;" })
line = line:gsub("%[(.-)%]",
function(s)
return ('<span class="important">%s</span>'):format(s)