From e7b1f3ab171d91f6c871d1484aac7d86016c435b Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Sat, 1 Apr 2023 12:16:40 +0200
Subject: much improved familysep to \SetHooks option

---
 ekdosis.dtx | 47 +++++++++++++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 20 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index f56aafb..8325bc1 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -59,7 +59,7 @@ Alessi <alessi@robertalessi.net>
 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<package>\ProvidesPackage{ekdosis}
 %<*package>
-    [2023/03/30 v1.5-dev Typesetting TEI xml-compliant critical editions]
+    [2023/04/01 v1.5-dev Typesetting TEI xml-compliant critical editions]
 %</package>
 %<*driver>
 \begin{filecontents}[noheader,overwrite]{bibdata.xml}
@@ -4793,7 +4793,8 @@ argument of the
   refnumstyle=\normalfont,
   postrefnum=.~,
   lemmastyle=\bfseries,
-  readingstyle=\itshape
+  readingstyle=\itshape,
+  familysep={, }
 }
 % The lines are to be centered horizontally:
 \settowidth{\versewidth}{Feed'st thy lights flame with selfe
@@ -4916,7 +4917,8 @@ substantiall fewell,}
 %   refnumstyle=\normalfont,
 %   postrefnum=.~,
 %   lemmastyle=\bfseries,
-%   readingstyle=\itshape
+%   readingstyle=\itshape,
+%   familysep={, }
 % }
 % \renewcommand\thelinenumber{}
 % \settowidth{\versewidth}{Feed'st thy lights flame with selfe
@@ -4999,6 +5001,7 @@ substantiall fewell,}
 %    \end{ekdverse}
 %   \end{shakespeare}
 % \end{alignment}
+% \SetHooks{familysep=reset}
 % \endgroup
 %
 % \texttt{TEI xml} output:---
@@ -8024,7 +8027,7 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \paragraph{\textsf{ekdosis} Symbol}
 % \begin{macro}{\eKd}
-% \changes{v1.5}{2023/03/30}{Prints \textsf{ekdosis} indentifying
+% \changes{v1.5}{2023/04/01}{Prints \textsf{ekdosis} indentifying
 % symbol} As of v1.5, \pkg{ekdosis} has its own identifying
 % symbol. It is produced by \cs{eKd} and best printed with the Old
 % Standard Greek font.
@@ -8287,7 +8290,7 @@ Sample text with a \textcolor{red}{word} in red.
 % \begin{macro}{\teidirectE}
 % \changes{v1.3}{2021/08/18}{direct insertion of elements in the
 % \texttt{TEI xml} file}
-% \changes{v1.5}{2023/03/30}{direct insertion of empty elements in the
+% \changes{v1.5}{2023/04/01}{direct insertion of empty elements in the
 % \texttt{TEI xml} file}
 % \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code}
 % does nothing in \LaTeX. It is only used to insert elements in the
@@ -8302,7 +8305,7 @@ Sample text with a \textcolor{red}{word} in red.
 % \end{macro}
 % \end{macro}
 % \begin{macro}{\getTEIxmlid}
-% \changes{v1.5}{2023/03/30}{returns \texttt{TEI xml:ids} from a
+% \changes{v1.5}{2023/04/01}{returns \texttt{TEI xml:ids} from a
 % csv-list of ids} This command returns from a csv-list of unique
 % identifiers declared in commands such as \cs{DeclareWitness} and the
 % like a space-separated list of their corresponding |xml:id|s, each
@@ -8778,7 +8781,7 @@ Sample text with a \textcolor{red}{word} in red.
 \newlength{\ekd@app@localheight}
 %    \end{macrocode}
 % \begin{macro}{\localappheight}
-% \changes{v1.5}{2023/03/30}{changes the height of the apparatus
+% \changes{v1.5}{2023/04/01}{changes the height of the apparatus
 % criticus}
 % \cs{localappheight}\marg{dimen} can be used to change locally the
 % length of \cs{ekd@app@height} set by the |appheight| option of
@@ -8797,7 +8800,7 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{\addtoappheight}
-% \changes{v1.5}{2023/03/30}{increases or decreases the height of the
+% \changes{v1.5}{2023/04/01}{increases or decreases the height of the
 % apparatus criticus}
 % As the name suggests, in contrast to \cs{localappheight},
 % \cs{addtoappheight}\marg{dimen} is used to increase or decrease
@@ -9083,7 +9086,7 @@ Sample text with a \textcolor{red}{word} in red.
 % The following commands are provided to set and control the maximum
 % number of lines printed on each page.
 % \begin{macro}{\setmaxlines}
-% \changes{v1.5}{2023/03/30}{limits the number of lines per page}
+% \changes{v1.5}{2023/04/01}{limits the number of lines per page}
 % \cs{setmaxlines}\marg{n}, where \meta{n} is a positive integer
 % $\geq 1$, can be used either in the preamble or at any point of the
 % document to set the maximum number of lines to be printed on each
@@ -9094,7 +9097,7 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{\localmaxlines}
-% \changes{v1.5}{2023/03/30}{changes the maximum number of lines
+% \changes{v1.5}{2023/04/01}{changes the maximum number of lines
 % locally}
 % Once a maximum number of lines per page has been set,
 % \cs{localmaxlines}\marg{n} can be used to adjust this number on a
@@ -9107,7 +9110,7 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{\addtomaxlines}
-% \changes{v1.5}{2023/03/30}{adds or subtracts lines from a given page}
+% \changes{v1.5}{2023/04/01}{adds or subtracts lines from a given page}
 % Unlike \cs{localmaxlines}, \cs{addtomaxlines}\meta{n} takes as
 % argument the number of lines one wishes to add or substract from the
 % number that has been set by \cs{setmaxlines}. As a result, \meta{n}
@@ -9120,7 +9123,7 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{\nomaxlines}
-% \changes{v1.5}{2023/03/30}{unsets \cs{setmaxlines}}
+% \changes{v1.5}{2023/04/01}{unsets \cs{setmaxlines}}
 % \cs{nomaxlines} unsets any limit previously set by \cs{setmaxlines}.
 %    \begin{macrocode}
 \def\nomaxlines{\luadirect{tex.sprint(ekdosis.resetlocalmaxlines())}}
@@ -9184,7 +9187,7 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{\App}
-% \changes{v1.5}{2023/03/30}{To be used conjointly with
+% \changes{v1.5}{2023/04/01}{To be used conjointly with
 % \texttt{ekdosis.el}}
 % In contrast to \cs{app}, \cs{App} takes two mandatory arguments and
 % accepts one optional argument like so:
@@ -10068,7 +10071,7 @@ Sample text with a \textcolor{red}{word} in red.
 % \end{macro}
 % \paragraph{Lacunae}
 % \begin{macro}{\ilabel}
-% \changes{v1.5}{2023/03/30}{recalls and sets the ending label of
+% \changes{v1.5}{2023/04/01}{recalls and sets the ending label of
 % lemmas used to mark lacunae in witnesses} When \cs{lem} has been
 % used with the optional argument |ilabel=<label>|,
 % \cs{ilabel}\marg{label} must be used to mark the point where the
@@ -10384,7 +10387,7 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{\ekdEOprint}
-% \changes{v1.5}{2023/03/30}{Sets headers and footers on
+% \changes{v1.5}{2023/04/01}{Sets headers and footers on
 % \enquote{paired} facing pages}
 % To set headers and footers on \enquote{paired} facing pages,
 % \cs{ekdEOprint} accepts two mandatory, self-evident arguments, like
@@ -10424,7 +10427,7 @@ Sample text with a \textcolor{red}{word} in red.
 % counter to set the value of the page numbers. This counter should be
 % incremented every two pages.
 % \begin{counter}{pairedpage}
-% \changes{v1.5}{2023/03/30}{A counter incremented every two pages}
+% \changes{v1.5}{2023/04/01}{A counter incremented every two pages}
 % |pairedpage| is first set as a global counter:---
 %    \begin{macrocode}
 \newcounter{pairedpage}
@@ -10432,19 +10435,19 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \end{counter}
 % \begin{macro}{\setpairedpagenum}
-%   \changes{v1.5}{2023/03/30}{sets the same page number on paired
+%   \changes{v1.5}{2023/04/01}{sets the same page number on paired
 %   pages} \cs{setpairedpagenum}\marg{number} is used just ahead of
 %   the alignment environment to set the number of the first left-hand
 %   paired page.
 % \begin{macro}{\setpairedpage}
-%   \changes{v1.5}{2023/03/30}{sets the page number of the first paired
+%   \changes{v1.5}{2023/04/01}{sets the page number of the first paired
 %   page} \cs{setpairedpage} is an argument-less command meant to be
 %   issued in commands used to set headers or footers before
 %   \cs{thepage}. This command has the counter |pairedpage|
 %   incremented on right-hand pages only, and sets |page| $\leftarrow$
 %   |pairedpage| on every page.
 % \begin{macro}{\resetpagenumber}
-%   \changes{v1.5}{2023/03/30}{resets normal running page numbers}
+%   \changes{v1.5}{2023/04/01}{resets normal running page numbers}
 %   \cs{resetpagenumber} must be used right out of \enquote{mirrored}
 %   paired pages alignment environments. This argument-less command
 %   corrects any numbering error on the page following the edition
@@ -11160,7 +11163,9 @@ function ekdosis.getsiglum(str, opt)
    else
       for i = 1,#idsRend do
 	 local tempc = string.gsub(idsRend[i].xmlid, "([%-%.%_])", "%%%1")
-	 str  = string.gsub(str, tempc.."%,", idsRend[i].abbr)
+	 local tempd = string.gsub(idsRend[i].abbr, "%,", "ekd@comma")
+	 tempd = string.gsub(tempd, "%s+", "ekd@space")
+	 str  = string.gsub(str, tempc.."%,", tempd)
 	 ctrl = string.gsub(ctrl, tempc.."%,", "")
       end
       str = string.gsub(str, "^%,", "")
@@ -11168,6 +11173,8 @@ function ekdosis.getsiglum(str, opt)
       then
 	 str = string.gsub(str, "%s+", familysep)
       end
+      str = string.gsub(str, "ekd@comma", ",")
+      str = string.gsub(str, "ekd@space", " ")
    end
    -- if string.find(ctrl, "[A-Za-z0-9]")
    if string.find(ctrl, "%S")
-- 
cgit v1.2.3

