From 863ad49de9f09ea0a567ac800725c2e56244967e Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Sun, 16 Jan 2022 17:19:25 +0100
Subject: Allow xml:ids to start with chars above #127 (eg. Greek letters). 
 Fixed unwanted space after empty \rdg.

---
 ekdosis.dtx | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index c8f3850..a5d40be 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -61,7 +61,7 @@ along with this program.  If not, see
 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<package>\ProvidesPackage{ekdosis}
 %<*package>
-    [2022/01/15 v1.5-dev Typesetting TEI xml-compliant critical editions]
+    [2022/01/16 v1.5-dev Typesetting TEI xml-compliant critical editions]
 %</package>
 %<*driver>
 \begin{filecontents}[noheader,overwrite]{bibdata.xml}
@@ -7943,11 +7943,11 @@ Sample text with a \textcolor{red}{word} in red.
 % 
 % \section{Implementation}
 % \label{sec:implementation}
-% 
+%
 % \iffalse
 %<*package>
 % \fi
-% 
+%
 % \pkg{ekdosis} relies on Lua functions and tables. Read the
 % |.lua| files that accompany \pkg{ekdosis} for more
 % information.
@@ -8063,7 +8063,7 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \paragraph{\textsf{ekdosis} Symbol}
 % \begin{macro}{\eKd}
-% \changes{v1.5}{2022/01/15}{Prints \textsf{ekdosis} indentifying
+% \changes{v1.5}{2022/01/16}{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.
@@ -8324,7 +8324,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}{2022/01/15}{direct insertion of empty elements in the
+% \changes{v1.5}{2022/01/16}{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
@@ -8339,7 +8339,7 @@ Sample text with a \textcolor{red}{word} in red.
 % \end{macro}
 % \end{macro}
 % \begin{macro}{\getTEIxmlid}
-% \changes{v1.5}{2022/01/15}{returns \texttt{TEI xml:ids} from a
+% \changes{v1.5}{2022/01/16}{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
@@ -9523,13 +9523,13 @@ Sample text with a \textcolor{red}{word} in red.
   % \ifekdr@nordg\append@app{}\else% do we need \append@app{} here? If
   %                               % so, keep in mind \ifekd@mapps,
   %                               like so:
-  \ifekdr@nordg%
-    \ifekd@mapps%
-      \append@app[\ekdan@type]{}%
-    \else%
-    \append@app{}%
-    \fi%
-  \else%
+  \ifekdr@nordg
+    \ifekd@mapps
+      \append@app[\ekdan@type]{\ekdunspace}%
+    \else
+    \append@app{\ekdunspace}%
+    \fi
+  \else
   \ifbool{al@rlmode}{%
     \edef\rdg@app{%
       \ifekd@subsq@rdg
@@ -9915,7 +9915,7 @@ Sample text with a \textcolor{red}{word} in red.
 % \end{macro}
 % \paragraph{Lacunae}
 % \begin{macro}{\ilabel}
-% \changes{v1.5}{2022/01/15}{recalls and sets the ending label of
+% \changes{v1.5}{2022/01/16}{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
@@ -10878,6 +10878,7 @@ function ekdosis.getsiglum(str, opt)
    str = str..","
    str = string.gsub(str, "%s-(%,)", "%1")
    ctrl = str
+   str = ","..str
    if opt == "tei" then
       for i = 1,#shorthands do
 	 local tempa = string.gsub(shorthands[i].a, "([%-%.%_])", "%%%1")
@@ -10885,10 +10886,11 @@ function ekdosis.getsiglum(str, opt)
       end
       for i = 1,#idsRend do
 	 local tempb = string.gsub(idsRend[i].xmlid, "([%-%.%_])", "%%%1")
-	 str  = string.gsub(str, "(%f[%w%-%.%_])"..tempb.."(%,)",
+	 str  = string.gsub(str, "(%,%s?)"..tempb.."(%,)",
 			    "%1#"..idsRend[i].xmlid.."%2")
 	 ctrl = string.gsub(ctrl, tempb.."%,", "")
       end
+      str = string.gsub(str, "^%,", "")
       str = string.gsub(str, "%,(%s-)([%#])", " %2")
       str = string.gsub(str, "%,$", "")
    else
@@ -10897,6 +10899,7 @@ function ekdosis.getsiglum(str, opt)
 	 str  = string.gsub(str, tempc.."%,", idsRend[i].abbr)
 	 ctrl = string.gsub(ctrl, tempc.."%,", "")
       end
+      str = string.gsub(str, "^%,", "")
       if familysep ~= nil
       then
 	 str = string.gsub(str, "%s+", familysep)
-- 
cgit v1.2.3

