From 9fa44076aced0c5fcbcdc06f70424c0dd46620c4 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Sat, 24 Aug 2019 20:18:48 +0200
Subject: \lem: added control on expansion of the optional arguments

---
 ekdosis.dtx | 44 ++++++++++++++++++++++++++++----------------
 1 file changed, 28 insertions(+), 16 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index afacb0c..8af64f2 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -525,35 +525,47 @@ idno={}, msName={}, origDate={}][3]{%
   \ifbool{al@rlmode}{%
     \edef\lem@app{%
       \ifdefined\ekdlr@alt
-        \ifdefined\ekdlr@post\space\ekdlr@post\space\else\fi
-        {\textdir TRT\ekdlr@alt}
-        \ifdefined\ekdlr@pre\space\ekdlr@pre\space\else\fi
+        \ifdefined\ekdlr@post%
+          \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
+        {\textdir TRT\unexpanded\expandafter{\ekdlr@alt}}
+        \ifdefined\ekdlr@pre%
+          \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
       \else
-        \ifdefined\ekdlr@post\space\ekdlr@post\space\else\fi
+        \ifdefined\ekdlr@post%
+          \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
         {\textdir TRT#2}%
-        \ifdefined\ekdlr@pre\space\ekdlr@pre\space\else\fi
+        \ifdefined\ekdlr@pre%
+          \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
       \fi
-      \ifdefined\ekdlr@postwit\space\ekdlr@postwit\else\fi
+      \ifdefined\ekdlr@postwit%
+        \space\unexpanded\expandafter{\ekdlr@postwit}\else\fi
       \ifdefined\ekdlr@wit\space\getsiglum{\ekdlr@wit}\else\fi
-      \ifdefined\ekdlr@prewit\space\ekdlr@prewit\space\else\fi
-      \ifekdl@nosep\else\ekdl@sep\fi
+      \ifdefined\ekdlr@prewit%
+        \space\unexpanded\expandafter{\ekdlr@prewit}\space\else\fi
+      \ifekdl@nosep\else\unexpanded\expandafter{\ekdl@sep}\fi
     }%
   }%
   {%
     \edef\lem@app{%
       \ifdefined\ekdlr@alt
-        \ifdefined\ekdlr@pre\space\ekdlr@pre\space\else\fi
-        \ekdlr@alt
-        \ifdefined\ekdlr@post\space\ekdlr@post\space\else\fi
+        \ifdefined\ekdlr@pre%
+          \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
+        \unexpanded\expandafter{\ekdlr@alt}
+        \ifdefined\ekdlr@post%
+          \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
       \else
-        \ifdefined\ekdlr@pre\space\ekdlr@pre\space\else\fi
+        \ifdefined\ekdlr@pre%
+          \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
         #2%
-        \ifdefined\ekdlr@post\space\ekdlr@post\space\else\fi
+        \ifdefined\ekdlr@post%
+          \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
       \fi
-      \ifdefined\ekdlr@prewit\space\ekdlr@prewit\space\else\fi
+      \ifdefined\ekdlr@prewit%
+        \space\unexpanded\expandafter{\ekdlr@prewit}\space\else\fi
       \ifdefined\ekdlr@wit\space\getsiglum{\ekdlr@wit}\else\fi
-      \ifdefined\ekdlr@postwit\space\ekdlr@postwit\else\fi
-      \ifekdl@nosep\else\ekdl@sep\fi
+      \ifdefined\ekdlr@postwit%
+        \space\unexpanded\expandafter{\ekdlr@postwit}\else\fi
+      \ifekdl@nosep\else\unexpanded\expandafter{\ekdl@sep}\fi
     }%
   }%
   \append@ln@app{\lem@app}%
-- 
cgit v1.2.3

