From 4074397c131445596974c5dd4320577241e11fe8 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sat, 26 Jun 2021 17:39:13 +0200 Subject: new functions for headers and footers. applied [fde1eee] to ndivs --- ekdosis.dtx | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file 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 %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{ekdosis} %<*package> - [2021/06/25 v1.3-dev Typesetting TEI xml-compliant critical editions] + [2021/06/26 v1.3-dev Typesetting TEI xml-compliant critical editions] % %<*driver> \begin{filecontents}[noheader,overwrite]{bibdata.xml} @@ -7353,7 +7353,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \paragraph{Setup} % \begin{macro}{\ekdsetup} -% \changes{v1.3}{2021/06/25}{new command for global options} +% \changes{v1.3}{2021/06/26}{new command for global options} % \cs{ekdsetup} is used to specify options that affect the general % behavior of \pkg{ekdosis}. It is a preamble-only command. % \begin{macrocode} @@ -7584,7 +7584,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \end{macro} % \begin{macro}{\teidirect} -% \changes{v1.3}{2021/06/25}{direct insertion of elements in the +% \changes{v1.3}{2021/06/26}{direct insertion of elements in the % \texttt{TEI xml} file} % \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code} % 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. % \end{macrocode} % \end{macro} % \begin{macro}{\SetApparatusNoteLanguage} -% \changes{v1.3}{2021/06/25}{defines an alternate language to be +% \changes{v1.3}{2021/06/26}{defines an alternate language to be % applied in note apparatus entries} % \cs{SetApparatusNoteLang}\marg{languagename} can be used when % 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. \luastring{\getpagerefnumber{ekd:\theekd@lab}}, \luastringN{#1})}% } -\NewDocumentCommand{\ekdmark}{}{% - \luadirect{tex.sprint(ekdosis.gethfmark(\luastring{\thepage}))}% -} \NewDocumentCommand{\endmark}{}{% \stepcounter{ekd@lab}% \label{ekd:\theekd@lab}% @@ -9199,6 +9196,36 @@ Sample text with a \textcolor{red}{word} in red. "", "endmk")}% \ifdefined\xspace\xspace\fi } +\NewDocumentCommand{\ekdmark}{}{% + \luadirect{tex.sprint(ekdosis.gethfmark(\luastring{\thepage}))}% +} +\ekvdefinekeys{ekd@marks}{ + choice mark = {hel = \def\ekd@mk{hel}, + hec = \def\ekd@mk{hec}, + her = \def\ekd@mk{her}, + hol = \def\ekd@mk{hol}, + hoc = \def\ekd@mk{hoc}, + hor = \def\ekd@mk{hor}, + fol = \def\ekd@mk{fol}, + foc = \def\ekd@mk{foc}, + fol = \def\ekd@mk{fol}, + fel = \def\ekd@mk{fel}, + fec = \def\ekd@mk{fec}, + fel = \def\ekd@mk{fel}} +} +\NewDocumentCommand{\ekdprintmark}{m m}{% + \bgroup + \ekvset{ekd@marks}{mark = #1}% + \luadirect{tex.sprint(ekdosis.printmark(\luastringN{#2}, + \luastringO{\ekd@mk}))}% + \egroup +} +\NewDocumentCommand{\ekdnohfmark}{}{% + \luadirect{ekdosis.nohfmark()}% +} +\NewDocumentCommand{\ekdresethfmarks}{}{% + \luadirect{ekdosis.resethfmark()}% +} % \end{macrocode} % \paragraph{Divisions of the Body} % \pkg{ekdosis} can convert \cs{book}, \cs{part}, \cs{chapter}, @@ -9859,7 +9886,9 @@ local texpatttotags = { {a="\\resetvlinenumber%s+", b=""}, {a="\\resetlinenumber%s+%[(.-)%]", b=""}, {a="\\resetlinenumber%s+", b=""}, + {a="\\ekdresethfmarks%s+", b=""}, {a="\\indentpattern%s+{(.-)}", b=""}, + {a="\\ekdnohfmark%s+", b=""}, {a="\\settowidth%s+{(.-)}{(.-)}", b=""}, {a="\\poemlines%s+{(.-)}", b=""}, {a="\\pagebreak%s+%[[1-4]%]", b=""}, @@ -10473,6 +10502,61 @@ function ekdosis.storehfmark(page, mk, opt) return true end +local printhfmarks = { + hel = true, + hec = true, + her = true, + hol = true, + hoc = true, + hor = true, + fol = true, + foc = true, + fol = true, + fel = true, + fec = true, + fel = true, +} + +function ekdosis.nohfmark() + printhfmarks.hel = false + printhfmarks.hec = false + printhfmarks.her = false + printhfmarks.hol = false + printhfmarks.hoc = false + printhfmarks.hor = false + printhfmarks.fol = false + printhfmarks.foc = false + printhfmarks.fol = false + printhfmarks.fel = false + printhfmarks.fec = false + printhfmarks.fel = false +end + +function ekdosis.resethfmark() + printhfmarks.hel = true + printhfmarks.hec = true + printhfmarks.her = true + printhfmarks.hol = true + printhfmarks.hoc = true + printhfmarks.hor = true + printhfmarks.fol = true + printhfmarks.foc = true + printhfmarks.fol = true + printhfmarks.fel = true + printhfmarks.fec = true + printhfmarks.fel = true +end + +function ekdosis.printmark(str, mk) + if printhfmarks[mk] + then + return str + else + printhfmarks[mk] = true + return "" + end +end + function ekdosis.gethfmark(page) local indexpage = get_a_index(page, hfmarks) if hfmarks[indexpage] ~= nil @@ -10752,9 +10836,9 @@ local function close_ndivs_in_between(str) do closedivs = closedivs.."" firstdivindex = firstdivindex - 1 + bdivii = string.gsub(bdivii, "div", "Div") end end - bdivii = string.gsub(bdivii, "div", "Div") return string.format("%s%s%s%s%s%s%s%s", bdivi, ndivi, edivi, between, closedivs, bdivii, ndivii, edivii) -- cgit v1.2.3