From 53ac6f6cc7ed2374dd032acdfeb5f322ff64510c Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Thu, 15 Nov 2018 21:08:30 +0100
Subject: added 'wit' and 'alt' as keyval arguments of \lem

---
 ekdosis.dtx | 40 +++++++++++++++++++++++++++++++++-------
 1 file changed, 33 insertions(+), 7 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 709d042..c285a35 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -323,6 +323,7 @@ Running "make install" installs the files in the local TeX tree.
 \ExecuteOptionsX{}
 \ProcessOptionsX\relax
 \RequirePackage{luacode}
+\RequirePackage{keycommand}
 \RequirePackage{xparse}
 \RequirePackage{etoolbox}
 \RequirePackage[addpageno]{lineno}
@@ -388,15 +389,35 @@ Running "make install" installs the files in the local TeX tree.
     "pg_ii")}%
   \ifbool{ekdstate}{\add@apparatus}{}%
   \bgroup\inapptrue#1\egroup}
-\NewDocumentCommand{\lem}{o +m}{\nonotetrue#2%  
-  \nonotefalse\bgroup\inappfalse%
-  \ifbool{al@rlmode}%
-  {\IfNoValueTF{#1}%
-    {\obappend{\bgroup\setRL#2\egroup:}}%
-    {\obappend{\bgroup\setRL#2\egroup{} #1:}}}%
-  {\IfNoValueTF{#1}{\obappend{#2:}}{\obappend{#2 #1:}}}%
+\NewDocumentCommand{\noteonly}{+m}{
+  \luadirect{tex.sprint(ekdosis.ntonly(\luastringN{#1}))}
+}
+\newkeycommand+[\|]{\lem}[wit,alt][1]{%
+  |\nonotetrue|#1%
+  |\nonotefalse|%
+  \bgroup%
+  |\inappfalse|%
+  |\ifbool{al@rlmode}|%
+  {|\obappend|{%
+      \bgroup%
+      |\setRL|\ifcommandkey{alt}{\commandkey{alt}%
+        \noteonly{#1}}{#1}%
+      \egroup%
+      \ifcommandkey{wit}{\commandkey{wit}}{}:}}%
+  {|\obappend|{\ifcommandkey{alt}{\commandkey{alt}%
+        \noteonly{#1}}{#1}%
+      \ifcommandkey{wit}{\commandkey{wit}}{}:}}%
   \egroup%
 }
+  % \NewDocumentCommand{\lem}{o +m}{\nonotetrue#2%  
+  %   \nonotefalse\bgroup\inappfalse%
+  %   \ifbool{al@rlmode}%
+  %   {\IfNoValueTF{#1}%
+  %     {\obappend{\bgroup\setRL#2\egroup:}}%
+  %     {\obappend{\bgroup\setRL#2\egroup{} #1:}}}%
+  %   {\IfNoValueTF{#1}{\obappend{#2:}}{\obappend{#2 #1:}}}%
+  %   \egroup%
+  % }
 \NewDocumentCommand{\rdg}{o +m}{%
   \bgroup\inappfalse%
   \ifbool{al@rlmode}%
@@ -496,6 +517,11 @@ function isintable(table, value)
    return false
 end
 
+ekdosis.ntonly = function(str)
+   str = string.match(str, "\\note%s?%*?%b{}")
+   return str or ""
+end
+
 function appin(str, nl)
    local f = io.open(tex.jobname.."_tmp.ekd", "a+")
    if nl == "yes" then
-- 
cgit v1.2.3

