From 0a938d58f38888d6b72c0e105a337a7d3d4d8647 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Wed, 15 Jul 2020 16:32:14 +0200
Subject: added \SetApparatus{key-val opts}

---
 ekdosis.dtx | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index b5622a2..f7eca62 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -2600,7 +2600,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % \end{macro}
 %
 %\paragraph{Multi-layer apparatuses}
-% \pkg{ekdosis} must know is an entry is to be processed in a single-
+% \pkg{ekdosis} must know if an entry is to be processed in a single-
 % or multiple-layer context:---
 %    \begin{macrocode}
 \newif\ifekd@mapps
@@ -2712,14 +2712,40 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % \end{macro}
 % \paragraph{Single-layer apparatus} The following commands are for
 % general settings. All of them can be used in the preamble or at any
-% point of the document:---
+% point of the document.  The keys to be used follow:---
+%    \begin{macrocode}
+\newif\ifrtl@app
+\edef\ekdsep{] }
+\ekvdefinekeys{default@app}{
+  choice direction = {LR = \rtl@appfalse,
+    RL = \rtl@apptrue},
+  unknown-choice direction = \PackageError{ekdosis}{unknown
+    direction=#1}{`direction' must be either `LR' or `RL'.},
+  code sep = \edef\ekdsep{#1},
+  store ehook = \ekd@end@apparatus,
+  initial ehook = {},
+  store delim = \ekd@unit@delim,
+  initial delim = {},
+  store rule = \ekd@default@rule,
+  initial rule = \rule{0.4\columnwidth}{0.4pt},
+  noval norule = \def\ekd@default@rule{\mbox{}}
+}
+%    \end{macrocode}
+% \begin{macro}{\SetApparatus}
+% All settings can also be defined as|key-value| options within the
+% argument of \cs{SetApparatus}:---
+%    \begin{macrocode}
+\NewDocumentCommand{\SetApparatus}{m}{
+  \ekvset{default@app}{#1}
+}
+%    \end{macrocode}
+% \end{macro}
 % \begin{macro}{\SetLTRapp}
 % \begin{macro}{\SetRTLapp}
 % \cs{SetLTRapp} and \cs{SetRTLapp} are two argument-less commands to
 % set the direction of single-layer apparatus criticus, either LTR or
 % RTL:---
 %    \begin{macrocode}
-\newif\ifrtl@app
 \NewDocumentCommand{\SetRTLapp}{}{\rtl@apptrue}
 \NewDocumentCommand{\SetLTRapp}{}{\rtl@appfalse}
 %    \end{macrocode}
@@ -2730,7 +2756,6 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % between lemma texts and variant readings, which is by default
 % a closing square bracket followed by a space (\verb*+] +):---
 %    \begin{macrocode}
-\edef\ekdsep{] }
 \NewDocumentCommand{\SetSeparator}{m}{\edef\ekdsep{#1}}
 %    \end{macrocode}
 % \end{macro}
@@ -2740,7 +2765,6 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % as it is customary in some editions. By default, nothing is
 % appended:---
 %    \begin{macrocode}
-\edef\ekd@end@apparatus{}
 \NewDocumentCommand{\SetEndApparatus}{m}{\edef\ekd@end@apparatus{#1}}
 %    \end{macrocode}
 % \end{macro}
@@ -2751,7 +2775,6 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % can be used to insert a broad space (with |\hskip| for instance, as
 % in the OCT series) or the divider-sign (‖, as in the Budé series):---
 %    \begin{macrocode}
-\def\ekd@unit@delim{}
 \NewDocumentCommand{\SetUnitDelimiter}{m}{\def\ekd@unit@delim{#1}}
 %    \end{macrocode}
 % \end{macro}
@@ -2765,7 +2788,6 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
 % \cs{footnoteruletrue} leaves it untouched. The latter is set by
 % default.
 %    \begin{macrocode}
-\def\ekd@default@rule{\rule{0.4\columnwidth}{0.4pt}}
 \newif\iffootnoterule
 \footnoteruletrue
 \let\dflt@footnoterule\footnoterule
-- 
cgit v1.2.3

