From 92c64e92d66b0271709d27f8ea3befeb4275ea54 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Tue, 27 Aug 2019 07:49:22 +0200
Subject: added \Set(RTL)(LTR)app. additional protection in \note was needed

---
 ekdosis.dtx | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 8a7c4e0..1bdc51e 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -469,10 +469,13 @@ idno={}, msName={}, origDate={}][3]{%
     "yes")}%
 }
 \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext}
+\newif\ifrtl@app
+\NewDocumentCommand{\SetRTLapp}{}{\rtl@apptrue}
+\NewDocumentCommand{\SetLTRapp}{}{\rtl@appfalse}
 \def\add@@apparatus{%
   % \blfootnote{\apparatus}%
   \if@pkg@parnotes\parnotes\else\fi%
-  \keyparbox[b!]{}{%
+  \keyparbox[b!]{}{\ifrtl@app\setRL\else\fi%
     \if@pkg@parnotes%
     \if@parnotesroman%
     \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi%
@@ -724,25 +727,32 @@ choice nordg={false,,true}][1]{%
     }}%
   |\fi|}
 \newkeycommand+[\|]{\ekd@note}[pre, post][1]{%
-  \append@app{\ifcommandkey{pre}{\commandkey{pre}}{}%
+  |\append@app|{\ifcommandkey{pre}{\commandkey{pre}}{}%
     #1%
     \ifcommandkey{post}{\commandkey{post}}{}}%
 }
 \newkeycommand+[\|]{\ekd@note@star}[pre, post][1]{%
   |\if@pkg@parnotes|%
-  \append@app{%
+  |\append@app|{%
     \ifcommandkey{pre}{\commandkey{pre}}{}%
     |\unskip\parnote|{#1}%
     \ifcommandkey{post}{\commandkey{post}}{}%
   }%
   |\else|%
-  \append@app{%
+  |\append@app|{%
     |\unskip\footnote|{#1}}
   |\fi|%
 }
 \NewDocumentCommand{\note}{s O{} +m}{%
-  \IfBooleanTF{#1}{\ekd@note@star[#2]{#3}}
-  {\ekd@note[#2]{#3}}%
+  \ifbool{al@rlmode}{%
+    \IfBooleanTF{#1}{\ekd@note@star[#2]{\unexpanded{%
+          {\textdir TRT#3}}}}
+    {\ekd@note[#2]{\unexpanded{{\textdir TRT#3}}}}%
+  }{%
+    \IfBooleanTF{#1}{\ekd@note@star[#2]{\unexpanded{%
+          {\texdir TRT#3}}}}
+    {\ekd@note[#2]{\unexpanded{{\textdir TRT#3}}}}%
+  }%
 }
 \NewDocumentCommand{\apparatus}{}{%
   \luadirect{tex.sprint(ekdosis.appout())}}
@@ -1472,7 +1482,7 @@ function ekdosis.mdvappend(str)
    end
    return "\\linelabel{"..i.."}"
    ..
-   "\\csname append@app\\endcsname{\\textbf{\\getrefnumber{"..i.."}} "..str.."}"
+   "\\csname append@app\\endcsname{\\textbf{\\getrefnumber{"..i.."}}~"..str.."}"
 end
 
 % \end{ekdlua}
-- 
cgit v1.2.3

