diff options
author | Robert Alessi <alessi@robertalessi.net> | 2020-10-03 20:55:28 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2020-10-03 20:55:28 +0200 |
commit | f23360399b1da0876dc6dddcf1c70687101c92db (patch) | |
tree | 3fe1364fb5d038cf326bf3f1b4b5953a355ae5be | |
parent | 267ed955f45fbc381169a0cf67a8160e2d92c156 (diff) | |
download | ekdosis-f23360399b1da0876dc6dddcf1c70687101c92db.tar.gz |
subvariation: new command \rdgGrp
-rw-r--r-- | ekdosis.dtx | 97 |
1 files 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. | |||
6578 | bool nordg = \ifekdr@nordg | 6578 | bool nordg = \ifekdr@nordg |
6579 | } | 6579 | } |
6580 | % \end{macrocode} | 6580 | % \end{macrocode} |
6581 | % \begin{macro}{\rdgGrp} | ||
6582 | % \changes{v1.1}{2020/10/03}{new command for subvariation} | ||
6583 | % \begin{macrocode} | ||
6584 | \NewDocumentCommand{\rdgGrp}{O{} > {\TrimSpaces } m}{% | ||
6585 | \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}% | ||
6586 | } | ||
6587 | % \end{macrocode} | ||
6588 | % \end{macro} | ||
6581 | % \begin{macro}{\lem} | 6589 | % \begin{macro}{\lem} |
6582 | % \cs{lem}\oarg{options}\marg{lemma text} inserts \meta{lemma text} | 6590 | % \cs{lem}\oarg{options}\marg{lemma text} inserts \meta{lemma text} |
6583 | % both in the edition text and in the apparatus criticus by default, | 6591 | % both in the edition text and in the apparatus criticus by default, |
@@ -7883,6 +7891,37 @@ local function app_totei(str) | |||
7883 | return str | 7891 | return str |
7884 | end | 7892 | end |
7885 | 7893 | ||
7894 | local function rdgGrp_totei(str) | ||
7895 | str = gsub(str, | ||
7896 | dblbkslash * | ||
7897 | lpeg.Cs("rdgGrp") * | ||
7898 | spcenc^-1 * | ||
7899 | bsqbrackets * | ||
7900 | bcbraces * | ||
7901 | spcenc^-1, | ||
7902 | function(bkslash, cmd, opt, arg) | ||
7903 | opt = string.sub(opt, 2, -2) | ||
7904 | arg = string.sub(arg, 2, -2) | ||
7905 | teiwit = get_attr_value(opt, "wit") | ||
7906 | if teiwit ~= "" then teiwit = " wit=\""..ekdosis.getsiglum(teiwit, "tei").."\"" else end | ||
7907 | teisource = get_attr_value(opt, "source") | ||
7908 | if teisource ~= "" then teisource = " source=\""..ekdosis.getsiglum(teisource, "tei").."\"" else end | ||
7909 | teiresp = get_attr_value(opt, "resp") | ||
7910 | if teiresp ~= "" then teiresp = " resp=\""..ekdosis.getsiglum(teiresp, "tei").."\"" else end | ||
7911 | teitype = get_attr_value(opt, "type") | ||
7912 | if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end | ||
7913 | if opt == "" | ||
7914 | then | ||
7915 | return rdgGrp_totei(string.format("<%s>%s</%s>", | ||
7916 | cmd, arg, cmd)) | ||
7917 | else | ||
7918 | return rdgGrp_totei(string.format("<%s%s%s%s%s>%s</%s>", | ||
7919 | cmd, teiwit, teisource, teiresp, teitype, arg, cmd)) | ||
7920 | end | ||
7921 | end) | ||
7922 | return str | ||
7923 | end | ||
7924 | |||
7886 | local function lem_rdg_totei(str) | 7925 | local function lem_rdg_totei(str) |
7887 | str = gsub(str, | 7926 | str = gsub(str, |
7888 | spcenc^-1 * | 7927 | spcenc^-1 * |
@@ -8486,6 +8525,7 @@ local function textotei(str) | |||
8486 | str = texpatttotei(str) | 8525 | str = texpatttotei(str) |
8487 | str = note_totei(str) | 8526 | str = note_totei(str) |
8488 | str = app_totei(str) | 8527 | str = app_totei(str) |
8528 | str = rdgGrp_totei(str) | ||
8489 | str = lem_rdg_totei(str) | 8529 | str = lem_rdg_totei(str) |
8490 | str = relocate_notes(str) | 8530 | str = relocate_notes(str) |
8491 | str = versetotei(str) | 8531 | str = versetotei(str) |
@@ -8593,40 +8633,43 @@ function ekdosis.openteistream() | |||
8593 | f:write("</witness>", "\n") | 8633 | f:write("</witness>", "\n") |
8594 | end | 8634 | end |
8595 | f:write("</listWit>", "\n") | 8635 | f:write("</listWit>", "\n") |
8596 | f:write("<listPerson xml:id=\"scholars\">", "\n") | 8636 | if next(listPerson) ~= nil |
8597 | for i = 1,#listPerson do | 8637 | then |
8598 | f:write('<person xml:id=\"', listPerson[i].xmlid, "\">", "\n") | 8638 | f:write("<listPerson xml:id=\"scholars\">", "\n") |
8599 | f:write('<persName>', "\n") | 8639 | for i = 1,#listPerson do |
8600 | f:write('<abbr type="siglum">', textotei(listPerson[i].abbr), "</abbr>", "\n") | 8640 | f:write('<person xml:id=\"', listPerson[i].xmlid, "\">", "\n") |
8601 | if listPerson[i].persName.name ~= nil | 8641 | f:write('<persName>', "\n") |
8602 | then | 8642 | f:write('<abbr type="siglum">', textotei(listPerson[i].abbr), "</abbr>", "\n") |
8603 | f:write(textotei(listPerson[i].persName.name)) | 8643 | if listPerson[i].persName.name ~= nil |
8604 | else | ||
8605 | if listPerson[i].persName.forename ~= "" | ||
8606 | then | ||
8607 | f:write("<forename>", textotei(listPerson[i].persName.forename), "</forename>", "\n") | ||
8608 | else | ||
8609 | f:write("<forename><!-- forename --></forename>", "\n") | ||
8610 | end | ||
8611 | if textotei(listPerson[i].persName.surname) ~= "" | ||
8612 | then | 8644 | then |
8613 | f:write("<surname>", textotei(listPerson[i].persName.surname), "</surname>", "\n") | 8645 | f:write(textotei(listPerson[i].persName.name)) |
8614 | else | 8646 | else |
8615 | f:write("<surname><!-- surname --></surname>", "\n") | 8647 | if listPerson[i].persName.forename ~= "" |
8648 | then | ||
8649 | f:write("<forename>", textotei(listPerson[i].persName.forename), "</forename>", "\n") | ||
8650 | else | ||
8651 | f:write("<forename><!-- forename --></forename>", "\n") | ||
8652 | end | ||
8653 | if textotei(listPerson[i].persName.surname) ~= "" | ||
8654 | then | ||
8655 | f:write("<surname>", textotei(listPerson[i].persName.surname), "</surname>", "\n") | ||
8656 | else | ||
8657 | f:write("<surname><!-- surname --></surname>", "\n") | ||
8658 | end | ||
8659 | if textotei(listPerson[i].persName.addName) ~= "" | ||
8660 | then | ||
8661 | f:write("<addName>", textotei(listPerson[i].persName.addName), "</addName>", "\n") | ||
8662 | end | ||
8616 | end | 8663 | end |
8617 | if textotei(listPerson[i].persName.addName) ~= "" | 8664 | if listPerson[i].note ~= "" |
8618 | then | 8665 | then |
8619 | f:write("<addName>", textotei(listPerson[i].persName.addName), "</addName>", "\n") | 8666 | f:write("<note>", textotei(listPerson[i].note), "</note>", "\n") |
8620 | end | 8667 | end |
8668 | f:write('</persName>', "\n") | ||
8669 | f:write('</person>', "\n") | ||
8621 | end | 8670 | end |
8622 | if listPerson[i].note ~= "" | 8671 | f:write("</listPerson>", "\n") |
8623 | then | ||
8624 | f:write("<note>", textotei(listPerson[i].note), "</note>", "\n") | ||
8625 | end | ||
8626 | f:write('</persName>', "\n") | ||
8627 | f:write('</person>', "\n") | ||
8628 | end | 8672 | end |
8629 | f:write("</listPerson>", "\n") | ||
8630 | f:write("</sourceDesc>", "\n") | 8673 | f:write("</sourceDesc>", "\n") |
8631 | f:write("</fileDesc>", "\n") | 8674 | f:write("</fileDesc>", "\n") |
8632 | f:write("<encodingDesc>", "\n") | 8675 | f:write("<encodingDesc>", "\n") |