From 0888a3817b7726d3d572de7c040d6ebf8f10dda8 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Mon, 29 Aug 2022 17:56:41 +0200 Subject: reverted [1219403], adapted patterns for \App and made texpatttotei() recursive --- ekdosis.dtx | 50 ++++++++++---------------------------------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/ekdosis.dtx b/ekdosis.dtx index 1838f4e..d2bb237 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -11033,7 +11033,6 @@ local rawcmd = lpeg.Cs(dblbkslash * ascii^1) local aftercmd = lpeg.Cs(lpeg.S("*[{,.?;:'`\"") + dblbkslash) local cmdargs = lpeg.Cs(spce^-1 * bsqbracketsii * bcbracesii * bsqbrackets^-1) local app = lpeg.Cs("app") -local App = lpeg.Cs("App") local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg")) local note = lpeg.Cs("note") local inlem = lpeg.Cs{ "")) + lpeg.V(1))^0 * "" } @@ -11456,6 +11455,8 @@ local texpatttotags = { {a="\\ekdpb%s+%*?{(.-)}", b=""}, {a="\\ekdpb%s+%*\\?", b=""}, {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"}, + {a="\\App%s+(%b[])(%b{})(%b{})", b="\\app[ekd@os%1ekd@cs]{ekd@ob%2ekd@cbekd@ob%3ekd@cb}"}, + {a="\\App%s+(%b{})(%b{})", b="\\app{ekd@ob%1ekd@cbekd@ob%2ekd@cb}"}, {a="\\LR%s+(%b{})", b="ekd@ob%1ekd@cb"}, {a="\\RL%s+(%b{})", b="ekd@ob%1ekd@cb"}, {a="\\%=%=%=%s?", b="—"}, @@ -11623,39 +11624,6 @@ local function remove_extra_anchors(str) return str end -local function App_totei(str) - str = gsub(str, - dblbkslash * - App * - spcenc^-1 * - bsqbrackets * - bcbraces * - bcbraces * - spcenc^-1, - function(bkslash, cmd, opt, argi, argii) - argi = string.sub(argi, 2, -2) - argii = string.sub(argii, 2, -2) - opt = get_attr_value(opt, "type") - if opt ~= "" then opt = " type=\""..opt.."\"" else end - return App_totei(string.format("%s%s", - opt, argi, argii)) - end) - str = gsub(str, - dblbkslash * - App * - spcenc^-1 * - bcbraces * - bcbraces * - spcenc^-1, - function(bkslash, cmd, argi, argii) - argi = string.sub(argi, 2, -2) - argii = string.sub(argii, 2, -2) - return App_totei(string.format("%s%s", - argi, argii)) - end) - return str -end - local function app_totei(str) str = gsub(str, dblbkslash * @@ -11872,11 +11840,14 @@ end local function texpatttotei(str) for i = 1,#texpatttotags do - str = string.gsub(str, texpatttotags[i].a, texpatttotags[i].b) - str = string.gsub(str, "ekd@ob%{", "") - str = string.gsub(str, "%}ekd@cb", "") - str = string.gsub(str, "ekd@os%[", "") - str = string.gsub(str, "%]ekd@cs", "") + while string.find(str, texpatttotags[i].a) + do + str = string.gsub(str, texpatttotags[i].a, texpatttotags[i].b) + str = string.gsub(str, "ekd@ob%{", "") + str = string.gsub(str, "%}ekd@cb", "") + str = string.gsub(str, "ekd@os%[", "") + str = string.gsub(str, "%]ekd@cs", "") + end end return str end @@ -12496,7 +12467,6 @@ local function textotei(str) str = texpatttotei(str) str = note_totei(str) str = remove_extra_anchors(str) - str = App_totei(str) str = app_totei(str) str = rdgGrp_totei(str) str = lem_rdg_totei(str) -- cgit v1.2.3