From 285529a917236e78464c7f96a2229916c0d881c6 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Thu, 4 Feb 2021 11:15:12 +0100 Subject: allow defined TeXtoTEIPats to be redefined --- ekdosis.dtx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ekdosis.dtx b/ekdosis.dtx index 1cd7d1b..77654f6 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -8235,8 +8235,16 @@ function ekdosis.newpatttotag(pat, repl) pat = string.gsub(pat, "([%[%]])", "%%%1") pat = string.gsub(pat, "%#[1-9]", "(.-)") repl = string.gsub(repl, "%#([1-9])", "%%%1") - table.insert(texpatttotags, { a = pat, b = repl }) - table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end) + if isintable(texpatttotags, pat) + then + local index = get_a_index(pat, texpatttotags) + table.remove(texpatttotags, index) + table.insert(texpatttotags, { a = pat, b = repl }) + table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end) + else + table.insert(texpatttotags, { a = pat, b = repl }) + table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end) + end return true end -- cgit v1.2.3