From 9f1bf2e34429d600645ec281936c0dce6d9d4640 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Sat, 17 Nov 2018 21:48:39 +0100
Subject: added 'pre' as option of \lem

---
 ekdosis.dtx | 36 ++++++++++++------------------------
 1 file changed, 12 insertions(+), 24 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index febab2c..df443ab 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -347,8 +347,6 @@ Running "make install" installs the files in the local TeX tree.
 \newbool{ekdstarted}
 \newbool{doapp}
 \newbool{ekdstate}
-\newif\ifinapp
-\newif\ifnonote
 \providebool{al@rlmode}
 \newcounter{ekd@lab}
 \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext}
@@ -388,26 +386,25 @@ Running "make install" installs the files in the local TeX tree.
     ekdosis.storeabspg(\luastring{\zref@extract{ekd:\theekd@lab}{abspage}},
     "pg_ii")}%
   \ifbool{ekdstate}{\add@apparatus}{}%
-  \bgroup\inapptrue#1\egroup}
-\NewDocumentCommand{\noteonly}{+m}{
-  \luadirect{tex.sprint(ekdosis.ntonly(\luastringN{#1}))}
-}
-\newkeycommand+[\|]{\lem}[wit,alt][1]{%
-  |\nonotetrue|#1%
-  |\nonotefalse|%
-  \bgroup%
-  |\inappfalse|%
+  #1}
+\newkeycommand+[\|]{\lem}[wit,alt,post,pre][1]{%
+  #1%
   |\ifbool{al@rlmode}|%
   {|\obappend|{%
       \bgroup%
       |\setRL|\ifcommandkey{alt}{\commandkey{alt}%
-        \noteonly{#1}}{#1}%
+        \ifcommandkey{pre}{ \commandkey{pre} }{}%
+      }{#1%
+        \ifcommandkey{pre}{ \commandkey{pre} }{}%
+      }%
       \egroup{}%
       \ifcommandkey{wit}{ \commandkey{wit}}{}:}}%
   {|\obappend|{\ifcommandkey{alt}{\commandkey{alt}%
-        \noteonly{#1}}{#1}%
+        \ifcommandkey{post}{ \commandkey{post} }{}%
+      }{#1%
+        \ifcommandkey{post}{ \commandkey{post} }{}%
+      }%
       \ifcommandkey{wit}{ \commandkey{wit}}{}:}}%
-  \egroup{}%
 }
   % \NewDocumentCommand{\lem}{o +m}{\nonotetrue#2%  
   %   \nonotefalse\bgroup\inappfalse%
@@ -419,7 +416,7 @@ Running "make install" installs the files in the local TeX tree.
   %   \egroup%
   % }
 \NewDocumentCommand{\rdg}{o +m}{%
-  \bgroup\inappfalse%
+  \bgroup%
   \ifbool{al@rlmode}%
   {\IfNoValueTF{#1}
     {\append{\bgroup\setRL#2\egroup}}
@@ -428,16 +425,12 @@ Running "make install" installs the files in the local TeX tree.
   \egroup%
 }
 \NewDocumentCommand{\note}{s +m}{%
-  \ifnonote\else%
-  \ifinapp%
   \IfBooleanTF{#1}{%
     \if@pkg@parnotes\append{\parnote{#2}}%
     \else\append{\footnote{#2}}\fi}{\append{#2}}%
-  \else%
   \IfBooleanTF{#1}{%
     \if@pkg@parnotes\parnote{#2}%
     \else\footnote{#2}\fi}{ #2\xspace}%
-  \fi\fi%
 }
 \NewDocumentCommand{\apparatus}{}{\luadirect{tex.sprint(appout())}}
 \NewDocumentCommand{\testapparatus}{}{%
@@ -517,11 +510,6 @@ 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

