aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2022-08-29 16:42:07 +0200
committerRobert Alessi <alessi@robertalessi.net>2022-08-29 16:42:07 +0200
commit121940357680091667596eba4099c96c2f5d0fc3 (patch)
tree4632f9f52b7a7bc3dffbcea524ed49ee3000b88f
parent78211b6125b3253a6949d5ec37d6968ccef212a1 (diff)
downloadekdosis-121940357680091667596eba4099c96c2f5d0fc3.tar.gz
\App needed a function, not a simple pattern
-rw-r--r--ekdosis.dtx37
1 files changed, 35 insertions, 2 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index c8e5080..1838f4e 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -11033,6 +11033,7 @@ 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")
11036local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg")) 11037local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg"))
11037local note = lpeg.Cs("note") 11038local note = lpeg.Cs("note")
11038local inlem = lpeg.Cs{ "<lem" * ((1 - (lpeg.P"<lem" + lpeg.P"</lem>")) + lpeg.V(1))^0 * "</lem>" } 11039local inlem = lpeg.Cs{ "<lem" * ((1 - (lpeg.P"<lem" + lpeg.P"</lem>")) + lpeg.V(1))^0 * "</lem>" }
@@ -11455,8 +11456,6 @@ local texpatttotags = {
11455 {a="\\ekdpb%s+%*?{(.-)}", b=""}, 11456 {a="\\ekdpb%s+%*?{(.-)}", b=""},
11456 {a="\\ekdpb%s+%*\\?", b=""}, 11457 {a="\\ekdpb%s+%*\\?", b=""},
11457 {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"}, 11458 {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"},
11458 {a="\\App%s+(%b[])(%b{})(%b{})", b="\\app[%1]{%2%3}"},
11459 {a="\\App%s+(%b{})(%b{})", b="\\app{%1%2}"},
11460 {a="\\LR%s+(%b{})", b="ekd@ob%1ekd@cb"}, 11459 {a="\\LR%s+(%b{})", b="ekd@ob%1ekd@cb"},
11461 {a="\\RL%s+(%b{})", b="ekd@ob%1ekd@cb"}, 11460 {a="\\RL%s+(%b{})", b="ekd@ob%1ekd@cb"},
11462 {a="\\%=%=%=%s?", b="—"}, 11461 {a="\\%=%=%=%s?", b="—"},
@@ -11624,6 +11623,39 @@ local function remove_extra_anchors(str)
11624 return str 11623 return str
11625end 11624end
11626 11625
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
11627local function app_totei(str) 11659local function app_totei(str)
11628 str = gsub(str, 11660 str = gsub(str,
11629 dblbkslash * 11661 dblbkslash *
@@ -12464,6 +12496,7 @@ local function textotei(str)
12464 str = texpatttotei(str) 12496 str = texpatttotei(str)
12465 str = note_totei(str) 12497 str = note_totei(str)
12466 str = remove_extra_anchors(str) 12498 str = remove_extra_anchors(str)
12499 str = App_totei(str)
12467 str = app_totei(str) 12500 str = app_totei(str)
12468 str = rdgGrp_totei(str) 12501 str = rdgGrp_totei(str)
12469 str = lem_rdg_totei(str) 12502 str = lem_rdg_totei(str)