From f23360399b1da0876dc6dddcf1c70687101c92db Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sat, 3 Oct 2020 20:55:28 +0200 Subject: subvariation: new command \rdgGrp --- ekdosis.dtx | 97 ++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 27 deletions(-) diff --git a/ekdosis.dtx b/ekdosis.dtx index 5d17daa..642ca56 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -6578,6 +6578,14 @@ Sample text with a \textcolor{red}{word} in red. bool nordg = \ifekdr@nordg } % \end{macrocode} +% \begin{macro}{\rdgGrp} +% \changes{v1.1}{2020/10/03}{new command for subvariation} +% \begin{macrocode} +\NewDocumentCommand{\rdgGrp}{O{} > {\TrimSpaces } m}{% + \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}% +} +% \end{macrocode} +% \end{macro} % \begin{macro}{\lem} % \cs{lem}\oarg{options}\marg{lemma text} inserts \meta{lemma text} % both in the edition text and in the apparatus criticus by default, @@ -7883,6 +7891,37 @@ local function app_totei(str) return str end +local function rdgGrp_totei(str) + str = gsub(str, + dblbkslash * + lpeg.Cs("rdgGrp") * + spcenc^-1 * + bsqbrackets * + bcbraces * + spcenc^-1, + function(bkslash, cmd, opt, arg) + opt = string.sub(opt, 2, -2) + arg = string.sub(arg, 2, -2) + teiwit = get_attr_value(opt, "wit") + if teiwit ~= "" then teiwit = " wit=\""..ekdosis.getsiglum(teiwit, "tei").."\"" else end + teisource = get_attr_value(opt, "source") + if teisource ~= "" then teisource = " source=\""..ekdosis.getsiglum(teisource, "tei").."\"" else end + teiresp = get_attr_value(opt, "resp") + if teiresp ~= "" then teiresp = " resp=\""..ekdosis.getsiglum(teiresp, "tei").."\"" else end + teitype = get_attr_value(opt, "type") + if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end + if opt == "" + then + return rdgGrp_totei(string.format("<%s>%s", + cmd, arg, cmd)) + else + return rdgGrp_totei(string.format("<%s%s%s%s%s>%s", + cmd, teiwit, teisource, teiresp, teitype, arg, cmd)) + end + end) + return str +end + local function lem_rdg_totei(str) str = gsub(str, spcenc^-1 * @@ -8486,6 +8525,7 @@ local function textotei(str) str = texpatttotei(str) str = note_totei(str) str = app_totei(str) + str = rdgGrp_totei(str) str = lem_rdg_totei(str) str = relocate_notes(str) str = versetotei(str) @@ -8593,40 +8633,43 @@ function ekdosis.openteistream() f:write("", "\n") end f:write("", "\n") - f:write("", "\n") - for i = 1,#listPerson do - f:write('", "\n") - f:write('', "\n") - f:write('', textotei(listPerson[i].abbr), "", "\n") - if listPerson[i].persName.name ~= nil - then - f:write(textotei(listPerson[i].persName.name)) - else - if listPerson[i].persName.forename ~= "" - then - f:write("", textotei(listPerson[i].persName.forename), "", "\n") - else - f:write("", "\n") - end - if textotei(listPerson[i].persName.surname) ~= "" + if next(listPerson) ~= nil + then + f:write("", "\n") + for i = 1,#listPerson do + f:write('", "\n") + f:write('', "\n") + f:write('', textotei(listPerson[i].abbr), "", "\n") + if listPerson[i].persName.name ~= nil then - f:write("", textotei(listPerson[i].persName.surname), "", "\n") + f:write(textotei(listPerson[i].persName.name)) else - f:write("", "\n") + if listPerson[i].persName.forename ~= "" + then + f:write("", textotei(listPerson[i].persName.forename), "", "\n") + else + f:write("", "\n") + end + if textotei(listPerson[i].persName.surname) ~= "" + then + f:write("", textotei(listPerson[i].persName.surname), "", "\n") + else + f:write("", "\n") + end + if textotei(listPerson[i].persName.addName) ~= "" + then + f:write("", textotei(listPerson[i].persName.addName), "", "\n") + end end - if textotei(listPerson[i].persName.addName) ~= "" + if listPerson[i].note ~= "" then - f:write("", textotei(listPerson[i].persName.addName), "", "\n") + f:write("", textotei(listPerson[i].note), "", "\n") end + f:write('', "\n") + f:write('', "\n") end - if listPerson[i].note ~= "" - then - f:write("", textotei(listPerson[i].note), "", "\n") - end - f:write('', "\n") - f:write('', "\n") + f:write("", "\n") end - f:write("", "\n") f:write("", "\n") f:write("", "\n") f:write("", "\n") -- cgit v1.2.3