diff options
author | Robert Alessi <alessi@robertalessi.net> | 2021-06-26 17:39:13 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2021-06-26 17:39:13 +0200 |
commit | 4074397c131445596974c5dd4320577241e11fe8 (patch) | |
tree | 196cc626a41474a5bb1499937db8b5a98d02f87e | |
parent | 775c1135807bc72687276a81c2a1901e4a1a8eb3 (diff) | |
download | ekdosis-4074397c131445596974c5dd4320577241e11fe8.tar.gz |
new functions for headers and footers. applied [fde1eee] to ndivs
-rw-r--r-- | ekdosis.dtx | 100 |
1 files changed, 92 insertions, 8 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index 502f032..bb042f3 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -61,7 +61,7 @@ along with this program. If not, see | |||
61 | %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] | 61 | %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
62 | %<package>\ProvidesPackage{ekdosis} | 62 | %<package>\ProvidesPackage{ekdosis} |
63 | %<*package> | 63 | %<*package> |
64 | [2021/06/25 v1.3-dev Typesetting TEI xml-compliant critical editions] | 64 | [2021/06/26 v1.3-dev Typesetting TEI xml-compliant critical editions] |
65 | %</package> | 65 | %</package> |
66 | %<*driver> | 66 | %<*driver> |
67 | \begin{filecontents}[noheader,overwrite]{bibdata.xml} | 67 | \begin{filecontents}[noheader,overwrite]{bibdata.xml} |
@@ -7353,7 +7353,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
7353 | % \end{macrocode} | 7353 | % \end{macrocode} |
7354 | % \paragraph{Setup} | 7354 | % \paragraph{Setup} |
7355 | % \begin{macro}{\ekdsetup} | 7355 | % \begin{macro}{\ekdsetup} |
7356 | % \changes{v1.3}{2021/06/25}{new command for global options} | 7356 | % \changes{v1.3}{2021/06/26}{new command for global options} |
7357 | % \cs{ekdsetup} is used to specify options that affect the general | 7357 | % \cs{ekdsetup} is used to specify options that affect the general |
7358 | % behavior of \pkg{ekdosis}. It is a preamble-only command. | 7358 | % behavior of \pkg{ekdosis}. It is a preamble-only command. |
7359 | % \begin{macrocode} | 7359 | % \begin{macrocode} |
@@ -7584,7 +7584,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
7584 | % \end{macrocode} | 7584 | % \end{macrocode} |
7585 | % \end{macro} | 7585 | % \end{macro} |
7586 | % \begin{macro}{\teidirect} | 7586 | % \begin{macro}{\teidirect} |
7587 | % \changes{v1.3}{2021/06/25}{direct insertion of elements in the | 7587 | % \changes{v1.3}{2021/06/26}{direct insertion of elements in the |
7588 | % \texttt{TEI xml} file} | 7588 | % \texttt{TEI xml} file} |
7589 | % \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code} | 7589 | % \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code} |
7590 | % does nothing in \LaTeX. Its only use is to insert elements in the | 7590 | % does nothing in \LaTeX. Its only use is to insert elements in the |
@@ -7951,7 +7951,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
7951 | % \end{macrocode} | 7951 | % \end{macrocode} |
7952 | % \end{macro} | 7952 | % \end{macro} |
7953 | % \begin{macro}{\SetApparatusNoteLanguage} | 7953 | % \begin{macro}{\SetApparatusNoteLanguage} |
7954 | % \changes{v1.3}{2021/06/25}{defines an alternate language to be | 7954 | % \changes{v1.3}{2021/06/26}{defines an alternate language to be |
7955 | % applied in note apparatus entries} | 7955 | % applied in note apparatus entries} |
7956 | % \cs{SetApparatusNoteLang}\marg{languagename} can be used when | 7956 | % \cs{SetApparatusNoteLang}\marg{languagename} can be used when |
7957 | % it is needed to apply in entries introduced by the \cs{note} command | 7957 | % it is needed to apply in entries introduced by the \cs{note} command |
@@ -9188,9 +9188,6 @@ Sample text with a \textcolor{red}{word} in red. | |||
9188 | \luastring{\getpagerefnumber{ekd:\theekd@lab}}, | 9188 | \luastring{\getpagerefnumber{ekd:\theekd@lab}}, |
9189 | \luastringN{#1})}% | 9189 | \luastringN{#1})}% |
9190 | } | 9190 | } |
9191 | \NewDocumentCommand{\ekdmark}{}{% | ||
9192 | \luadirect{tex.sprint(ekdosis.gethfmark(\luastring{\thepage}))}% | ||
9193 | } | ||
9194 | \NewDocumentCommand{\endmark}{}{% | 9191 | \NewDocumentCommand{\endmark}{}{% |
9195 | \stepcounter{ekd@lab}% | 9192 | \stepcounter{ekd@lab}% |
9196 | \label{ekd:\theekd@lab}% | 9193 | \label{ekd:\theekd@lab}% |
@@ -9199,6 +9196,36 @@ Sample text with a \textcolor{red}{word} in red. | |||
9199 | "", "endmk")}% | 9196 | "", "endmk")}% |
9200 | \ifdefined\xspace\xspace\fi | 9197 | \ifdefined\xspace\xspace\fi |
9201 | } | 9198 | } |
9199 | \NewDocumentCommand{\ekdmark}{}{% | ||
9200 | \luadirect{tex.sprint(ekdosis.gethfmark(\luastring{\thepage}))}% | ||
9201 | } | ||
9202 | \ekvdefinekeys{ekd@marks}{ | ||
9203 | choice mark = {hel = \def\ekd@mk{hel}, | ||
9204 | hec = \def\ekd@mk{hec}, | ||
9205 | her = \def\ekd@mk{her}, | ||
9206 | hol = \def\ekd@mk{hol}, | ||
9207 | hoc = \def\ekd@mk{hoc}, | ||
9208 | hor = \def\ekd@mk{hor}, | ||
9209 | fol = \def\ekd@mk{fol}, | ||
9210 | foc = \def\ekd@mk{foc}, | ||
9211 | fol = \def\ekd@mk{fol}, | ||
9212 | fel = \def\ekd@mk{fel}, | ||
9213 | fec = \def\ekd@mk{fec}, | ||
9214 | fel = \def\ekd@mk{fel}} | ||
9215 | } | ||
9216 | \NewDocumentCommand{\ekdprintmark}{m m}{% | ||
9217 | \bgroup | ||
9218 | \ekvset{ekd@marks}{mark = #1}% | ||
9219 | \luadirect{tex.sprint(ekdosis.printmark(\luastringN{#2}, | ||
9220 | \luastringO{\ekd@mk}))}% | ||
9221 | \egroup | ||
9222 | } | ||
9223 | \NewDocumentCommand{\ekdnohfmark}{}{% | ||
9224 | \luadirect{ekdosis.nohfmark()}% | ||
9225 | } | ||
9226 | \NewDocumentCommand{\ekdresethfmarks}{}{% | ||
9227 | \luadirect{ekdosis.resethfmark()}% | ||
9228 | } | ||
9202 | % \end{macrocode} | 9229 | % \end{macrocode} |
9203 | % \paragraph{Divisions of the Body} | 9230 | % \paragraph{Divisions of the Body} |
9204 | % \pkg{ekdosis} can convert \cs{book}, \cs{part}, \cs{chapter}, | 9231 | % \pkg{ekdosis} can convert \cs{book}, \cs{part}, \cs{chapter}, |
@@ -9859,7 +9886,9 @@ local texpatttotags = { | |||
9859 | {a="\\resetvlinenumber%s+", b=""}, | 9886 | {a="\\resetvlinenumber%s+", b=""}, |
9860 | {a="\\resetlinenumber%s+%[(.-)%]", b=""}, | 9887 | {a="\\resetlinenumber%s+%[(.-)%]", b=""}, |
9861 | {a="\\resetlinenumber%s+", b=""}, | 9888 | {a="\\resetlinenumber%s+", b=""}, |
9889 | {a="\\ekdresethfmarks%s+", b=""}, | ||
9862 | {a="\\indentpattern%s+{(.-)}", b=""}, | 9890 | {a="\\indentpattern%s+{(.-)}", b=""}, |
9891 | {a="\\ekdnohfmark%s+", b=""}, | ||
9863 | {a="\\settowidth%s+{(.-)}{(.-)}", b=""}, | 9892 | {a="\\settowidth%s+{(.-)}{(.-)}", b=""}, |
9864 | {a="\\poemlines%s+{(.-)}", b=""}, | 9893 | {a="\\poemlines%s+{(.-)}", b=""}, |
9865 | {a="\\pagebreak%s+%[[1-4]%]", b=""}, | 9894 | {a="\\pagebreak%s+%[[1-4]%]", b=""}, |
@@ -10473,6 +10502,61 @@ function ekdosis.storehfmark(page, mk, opt) | |||
10473 | return true | 10502 | return true |
10474 | end | 10503 | end |
10475 | 10504 | ||
10505 | local printhfmarks = { | ||
10506 | hel = true, | ||
10507 | hec = true, | ||
10508 | her = true, | ||
10509 | hol = true, | ||
10510 | hoc = true, | ||
10511 | hor = true, | ||
10512 | fol = true, | ||
10513 | foc = true, | ||
10514 | fol = true, | ||
10515 | fel = true, | ||
10516 | fec = true, | ||
10517 | fel = true, | ||
10518 | } | ||
10519 | |||
10520 | function ekdosis.nohfmark() | ||
10521 | printhfmarks.hel = false | ||
10522 | printhfmarks.hec = false | ||
10523 | printhfmarks.her = false | ||
10524 | printhfmarks.hol = false | ||
10525 | printhfmarks.hoc = false | ||
10526 | printhfmarks.hor = false | ||
10527 | printhfmarks.fol = false | ||
10528 | printhfmarks.foc = false | ||
10529 | printhfmarks.fol = false | ||
10530 | printhfmarks.fel = false | ||
10531 | printhfmarks.fec = false | ||
10532 | printhfmarks.fel = false | ||
10533 | end | ||
10534 | |||
10535 | function ekdosis.resethfmark() | ||
10536 | printhfmarks.hel = true | ||
10537 | printhfmarks.hec = true | ||
10538 | printhfmarks.her = true | ||
10539 | printhfmarks.hol = true | ||
10540 | printhfmarks.hoc = true | ||
10541 | printhfmarks.hor = true | ||
10542 | printhfmarks.fol = true | ||
10543 | printhfmarks.foc = true | ||
10544 | printhfmarks.fol = true | ||
10545 | printhfmarks.fel = true | ||
10546 | printhfmarks.fec = true | ||
10547 | printhfmarks.fel = true | ||
10548 | end | ||
10549 | |||
10550 | function ekdosis.printmark(str, mk) | ||
10551 | if printhfmarks[mk] | ||
10552 | then | ||
10553 | return str | ||
10554 | else | ||
10555 | printhfmarks[mk] = true | ||
10556 | return "" | ||
10557 | end | ||
10558 | end | ||
10559 | |||
10476 | function ekdosis.gethfmark(page) | 10560 | function ekdosis.gethfmark(page) |
10477 | local indexpage = get_a_index(page, hfmarks) | 10561 | local indexpage = get_a_index(page, hfmarks) |
10478 | if hfmarks[indexpage] ~= nil | 10562 | if hfmarks[indexpage] ~= nil |
@@ -10752,9 +10836,9 @@ local function close_ndivs_in_between(str) | |||
10752 | do | 10836 | do |
10753 | closedivs = closedivs.."</div"..used_ndivs[firstdivindex].a..">" | 10837 | closedivs = closedivs.."</div"..used_ndivs[firstdivindex].a..">" |
10754 | firstdivindex = firstdivindex - 1 | 10838 | firstdivindex = firstdivindex - 1 |
10839 | bdivii = string.gsub(bdivii, "div", "Div") | ||
10755 | end | 10840 | end |
10756 | end | 10841 | end |
10757 | bdivii = string.gsub(bdivii, "div", "Div") | ||
10758 | return string.format("%s%s%s%s%s%s%s%s", | 10842 | return string.format("%s%s%s%s%s%s%s%s", |
10759 | bdivi, ndivi, edivi, between, | 10843 | bdivi, ndivi, edivi, between, |
10760 | closedivs, bdivii, ndivii, edivii) | 10844 | closedivs, bdivii, ndivii, edivii) |