aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2022-08-29 17:56:41 +0200
committerRobert Alessi <alessi@robertalessi.net>2022-08-29 17:56:41 +0200
commit0888a3817b7726d3d572de7c040d6ebf8f10dda8 (patch)
tree76e3ae1e27c9b12b965009b32a5650ba45d2ca70
parent121940357680091667596eba4099c96c2f5d0fc3 (diff)
downloadekdosis-0888a38.tar.gz
reverted [1219403], adapted patterns for \App and made texpatttotei() recursive
-rw-r--r--ekdosis.dtx50
1 files 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)
11033local aftercmd = lpeg.Cs(lpeg.S("*[{,.?;:'`\"") + dblbkslash) 11033local aftercmd = lpeg.Cs(lpeg.S("*[{,.?;:'`\"") + dblbkslash)
11034local cmdargs = lpeg.Cs(spce^-1 * bsqbracketsii * bcbracesii * bsqbrackets^-1) 11034local cmdargs = lpeg.Cs(spce^-1 * bsqbracketsii * bcbracesii * bsqbrackets^-1)
11035local app = lpeg.Cs("app") 11035local app = lpeg.Cs("app")
11036local App = lpeg.Cs("App")
11037local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg")) 11036local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg"))
11038local note = lpeg.Cs("note") 11037local note = lpeg.Cs("note")
11039local inlem = lpeg.Cs{ "<lem" * ((1 - (lpeg.P"<lem" + lpeg.P"</lem>")) + lpeg.V(1))^0 * "</lem>" } 11038local inlem = lpeg.Cs{ "<lem" * ((1 - (lpeg.P"<lem" + lpeg.P"</lem>")) + lpeg.V(1))^0 * "</lem>" }
@@ -11456,6 +11455,8 @@ local texpatttotags = {
11456 {a="\\ekdpb%s+%*?{(.-)}", b=""}, 11455 {a="\\ekdpb%s+%*?{(.-)}", b=""},
11457 {a="\\ekdpb%s+%*\\?", b=""}, 11456 {a="\\ekdpb%s+%*\\?", b=""},
11458 {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"}, 11457 {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"},
11458 {a="\\App%s+(%b[])(%b{})(%b{})", b="\\app[ekd@os%1ekd@cs]{ekd@ob%2ekd@cbekd@ob%3ekd@cb}"},
11459 {a="\\App%s+(%b{})(%b{})", b="\\app{ekd@ob%1ekd@cbekd@ob%2ekd@cb}"},
11459 {a="\\LR%s+(%b{})", b="ekd@ob%1ekd@cb"}, 11460 {a="\\LR%s+(%b{})", b="ekd@ob%1ekd@cb"},
11460 {a="\\RL%s+(%b{})", b="ekd@ob%1ekd@cb"}, 11461 {a="\\RL%s+(%b{})", b="ekd@ob%1ekd@cb"},
11461 {a="\\%=%=%=%s?", b="—"}, 11462 {a="\\%=%=%=%s?", b="—"},
@@ -11623,39 +11624,6 @@ local function remove_extra_anchors(str)
11623 return str 11624 return str
11624end 11625end
11625 11626
11626local function App_totei(str)
11627 str = gsub(str,
11628 dblbkslash *
11629 App *
11630 spcenc^-1 *
11631 bsqbrackets *
11632 bcbraces *
11633 bcbraces *
11634 spcenc^-1,
11635 function(bkslash, cmd, opt, argi, argii)
11636 argi = string.sub(argi, 2, -2)
11637 argii = string.sub(argii, 2, -2)
11638 opt = get_attr_value(opt, "type")
11639 if opt ~= "" then opt = " type=\""..opt.."\"" else end
11640 return App_totei(string.format("<app%s>%s%s</app>",
11641 opt, argi, argii))
11642 end)
11643 str = gsub(str,
11644 dblbkslash *
11645 App *
11646 spcenc^-1 *
11647 bcbraces *
11648 bcbraces *
11649 spcenc^-1,
11650 function(bkslash, cmd, argi, argii)
11651 argi = string.sub(argi, 2, -2)
11652 argii = string.sub(argii, 2, -2)
11653 return App_totei(string.format("<app>%s%s</app>",
11654 argi, argii))
11655 end)
11656 return str
11657end
11658
11659local function app_totei(str) 11627local function app_totei(str)
11660 str = gsub(str, 11628 str = gsub(str,
11661 dblbkslash * 11629 dblbkslash *
@@ -11872,11 +11840,14 @@ end
11872 11840
11873local function texpatttotei(str) 11841local function texpatttotei(str)
11874 for i = 1,#texpatttotags do 11842 for i = 1,#texpatttotags do
11875 str = string.gsub(str, texpatttotags[i].a, texpatttotags[i].b) 11843 while string.find(str, texpatttotags[i].a)
11876 str = string.gsub(str, "ekd@ob%{", "") 11844 do
11877 str = string.gsub(str, "%}ekd@cb", "") 11845 str = string.gsub(str, texpatttotags[i].a, texpatttotags[i].b)
11878 str = string.gsub(str, "ekd@os%[", "") 11846 str = string.gsub(str, "ekd@ob%{", "")
11879 str = string.gsub(str, "%]ekd@cs", "") 11847 str = string.gsub(str, "%}ekd@cb", "")
11848 str = string.gsub(str, "ekd@os%[", "")
11849 str = string.gsub(str, "%]ekd@cs", "")
11850 end
11880 end 11851 end
11881 return str 11852 return str
11882end 11853end
@@ -12496,7 +12467,6 @@ local function textotei(str)
12496 str = texpatttotei(str) 12467 str = texpatttotei(str)
12497 str = note_totei(str) 12468 str = note_totei(str)
12498 str = remove_extra_anchors(str) 12469 str = remove_extra_anchors(str)
12499 str = App_totei(str)
12500 str = app_totei(str) 12470 str = app_totei(str)
12501 str = rdgGrp_totei(str) 12471 str = rdgGrp_totei(str)
12502 str = lem_rdg_totei(str) 12472 str = lem_rdg_totei(str)