diff options
Diffstat (limited to 'ekdosis.dtx')
-rw-r--r-- | ekdosis.dtx | 12 |
1 files 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) | |||
8235 | pat = string.gsub(pat, "([%[%]])", "%%%1") | 8235 | pat = string.gsub(pat, "([%[%]])", "%%%1") |
8236 | pat = string.gsub(pat, "%#[1-9]", "(.-)") | 8236 | pat = string.gsub(pat, "%#[1-9]", "(.-)") |
8237 | repl = string.gsub(repl, "%#([1-9])", "%%%1") | 8237 | repl = string.gsub(repl, "%#([1-9])", "%%%1") |
8238 | table.insert(texpatttotags, { a = pat, b = repl }) | 8238 | if isintable(texpatttotags, pat) |
8239 | table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end) | 8239 | then |
8240 | local index = get_a_index(pat, texpatttotags) | ||
8241 | table.remove(texpatttotags, index) | ||
8242 | table.insert(texpatttotags, { a = pat, b = repl }) | ||
8243 | table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end) | ||
8244 | else | ||
8245 | table.insert(texpatttotags, { a = pat, b = repl }) | ||
8246 | table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end) | ||
8247 | end | ||
8240 | return true | 8248 | return true |
8241 | end | 8249 | end |
8242 | 8250 | ||