From b426dbd31ff927ad167fe4e6fcf0ba5c28ce39fc Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Mon, 4 Nov 2019 11:19:55 +0100
Subject: escaped square brackets in ekdosis.newpatttotag()

---
 ekdosis.dtx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 71d68d2..d92dcd5 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -1049,7 +1049,7 @@ idno={}, msName={}, origDate={}][3]{%
 %<*lua>
 % \fi
 % \begin{ekdlua}
-
+-- `'
 -- This table will hold the functions:
 ekdosis = {}
 
@@ -1321,8 +1321,9 @@ function ekdosis.newcmdtotag(cmd, tag, attr)
 end
 
 function ekdosis.newpatttotag(pat, repl)
+   pat = string.gsub(pat, "([%[%]])", "%%%1")
    pat = string.gsub(pat, "%#[1-9]", "(.-)")
-   repl = string.gsub(repl, "%#", "%%")
+   repl = string.gsub(repl, "%#([1-9])", "%%%1")
    table.insert(texpatttotags, { a = pat, b = repl })
    return true
 end
-- 
cgit v1.2.3

