From a38513f75709b63dcff4c5e6da36a0eba7eaa691 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Mon, 17 Feb 2020 19:00:45 +0100
Subject: replacing 'keycommand' with 'options'

---
 ekdosis.dtx | 41 +++++++++++++++++++++++++++--------------
 1 file changed, 27 insertions(+), 14 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 8aea111..fcb66bd 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -353,6 +353,7 @@ Running "make install" installs the files in the local TeX tree.
 \RequirePackage{luacode}
 \RequirePackage{paracol}
 \RequirePackage{keycommand}
+\RequirePackage{options}
 \RequirePackage{xparse}
 \RequirePackage{etoolbox}
 \RequirePackage{lineno}
@@ -375,22 +376,34 @@ Running "make install" installs the files in the local TeX tree.
 %    \end{macrocode}
 % Build and process the list of witnesses and hands.
 %    \begin{macrocode}
-\newkeycommand+[\|]{\declare@new@witness}[settlement={}, repository={},
-idno={}, msName={}, origDate={}][3]{%
-  |\luadirect|{%
-    ekdosis.newwitness(
-    |\luastringN|{#1},
-    |\luastringN|{#2},
-    |\luastringN|{#3},
-    |\luastringN|{\commandkey{settlement}},
-    |\luastringN|{\commandkey{repository}},
-    |\luastringN|{\commandkey{idno}},
-    |\luastringN|{\commandkey{msName}},
-    |\luastringN|{\commandkey{origDate}})}
+\options{
+  /witness/.new family,
+  /witness/settlement/.new value = {},
+  /witness/repository/.new value = {},
+  /witness/idno/.new value = {},
+  /witness/msName/.new value = {},
+  /witness/origDate/.new value = {}
 }
 \NewDocumentCommand{\DeclareNewWitness}{m m m o}{%
-  \IfNoValueTF{#4}{\declare@new@witness{#1}{#2}{#3}}
-  {\declare@new@witness[#4]{#1}{#2}{#3}}
+  \IfNoValueTF{#4}
+  {\luadirect{ekdosis.newwitness(
+      \luastringN{#1},
+      \luastringN{#2},
+      \luastringN{#3}
+      )}}
+  {\bgroup
+    \options{/witness,#4}
+    \luadirect{ekdosis.newwitness(
+      \luastringN{#1},
+      \luastringN{#2},
+      \luastringN{#3},
+      \luastring{\option{/witness/settlement}},
+      \luastring{\option{/witness/repository}},
+      \luastring{\option{/witness/idno}},
+      \luastring{\option{/witness/msName}},
+      \luastring{\option{/witness/origDate}}
+      )}
+    \egroup}
 }
 \@onlypreamble\DeclareNewWitness
 \NewDocumentCommand{\DeclareNewHand}{m m m +O{}}{
-- 
cgit v1.2.3

