From 697864ff74de757671c3edc67b0d05987c9ff29e Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sat, 3 Apr 2021 13:32:43 +0200 Subject: test for either babel or polyglossia --- ekdosis.dtx | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/ekdosis.dtx b/ekdosis.dtx index 229d7c1..1062f36 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -780,7 +780,7 @@ along with this program. If not, see % % \fi % -% \CheckSum{2188} +% \CheckSum{0} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -7390,8 +7390,20 @@ Sample text with a \textcolor{red}{word} in red. \@onlypreamble\AddxmlBibResource % \end{macrocode} % \end{macro} -% -%\paragraph{Multiple-layer apparatuses} +% \begin{macro}{\ekd@test@lang} +% \cs{ekd@test@lang} is used internally by \pkg{ekdosis}. This command +% returns \cs{ekd@lang@pkgtrue} if either \pkg{babel} or +% \pkg{polyglossia} be used so that \cs{languagename} can be inserted +% when and where needed in the apparatus criticus. +% \begin{macrocode} +\newif\ifekd@lang@pkg +\NewDocumentCommand{\ekd@test@lang}{}{% + \ltx@ifpackageloaded{babel}{\ekd@lang@pkgtrue}{}% + \ltx@ifpackageloaded{polyglossia}{\ekd@lang@pkgtrue}{}% +} +% \end{macrocode} +% \end{macro} +% \paragraph{Multiple-layer apparatuses} % \pkg{ekdosis} must know if an entry is to be processed in a single- % or multiple-layer context:--- % \begin{macrocode} @@ -7581,7 +7593,8 @@ Sample text with a \textcolor{red}{word} in red. initial rule = \rule{0.4\columnwidth}{0.4pt}, noval norule = \def\ekd@default@rule{\mbox{}}, store lang = \ekd@singleapp@lang, - initial lang = \ltx@ifpackageloaded{babel}{\languagename}{} + initial lang = \ltx@ifpackageloaded{babel}{\languagename}{}% + \ltx@ifpackageloaded{polyglossia}{\languagename}{} } % \end{macrocode} % \begin{macro}{\SetApparatus} @@ -8138,6 +8151,7 @@ Sample text with a \textcolor{red}{word} in red. \null \bgroup% \ekvset{lem}{#1}% + \ekd@test@lang \ifekd@mapps% \ifnum% \luadirect{tex.sprint(ekdosis.get_bagunits(\luastringO{\ekdan@type}))} @@ -8207,7 +8221,7 @@ Sample text with a \textcolor{red}{word} in red. \ifdefined\ekdlr@alt% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@lemmastyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded\expandafter{\ekdlr@alt}}}% @@ -8218,7 +8232,7 @@ Sample text with a \textcolor{red}{word} in red. \else \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@lemmastyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded{#2}}}{% @@ -8257,6 +8271,7 @@ Sample text with a \textcolor{red}{word} in red. \NewDocumentCommand{\rdg}{O{} m}{% \bgroup% \ekvset{rdg}{#1}% + \ekd@test@lang % \ifekdr@nordg\append@app{}\else% do we need \append@app{} here? If % % so, keep in mind \ifekd@mapps, % like so: @@ -8298,7 +8313,7 @@ Sample text with a \textcolor{red}{word} in red. \ifdefined\ekdlr@alt% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@readingstyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded\expandafter{\ekdlr@alt}}}% @@ -8309,7 +8324,7 @@ Sample text with a \textcolor{red}{word} in red. \else \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@readingstyle}% \noexpand\selectlanguage{\app@lang}\unexpanded{#2}}}{% {\unexpanded\expandafter{\ekd@readingstyle}\unexpanded{#2}}}% @@ -8361,6 +8376,7 @@ Sample text with a \textcolor{red}{word} in red. \leavevmode \bgroup% \ekvset{note}{#1}% + \ekd@test@lang \stepcounter{ekd@lab}% \zlabel{ekd:\theekd@lab}% \luadirect{ekdosis.storeabspg( @@ -8409,7 +8425,7 @@ Sample text with a \textcolor{red}{word} in red. \fi% \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em \ifdefined\ekdn@lem - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@lemmastyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded\expandafter{\ekdn@lem}}}% @@ -8418,7 +8434,7 @@ Sample text with a \textcolor{red}{word} in red. \unless\ifekdn@nosep \unexpanded\expandafter{\ekdn@sep}\fi \else\fi% - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\noexpand\selectlanguage{\app@lang}\unexpanded{#2}}}{% {\unexpanded{#2}}}}}% \ifekd@mapps% -- cgit v1.2.3