aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2021-04-10 11:24:03 +0200
committerRobert Alessi <alessi@robertalessi.net>2021-04-10 11:24:03 +0200
commitae45238c025af639754aaac12791df232f96ce87 (patch)
tree116a2fc63f0524087d10bfe62a5c4be8749450f2
parent7e59309233835a6ed0c556b0dd3fdd6aa9bcfd9a (diff)
downloadekdosis-ae45238c025af639754aaac12791df232f96ce87.tar.gz
added notelang option and updated the documentation
-rw-r--r--ekdosis.dtx78
1 files changed, 70 insertions, 8 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index f7827de..53277e9 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -3190,6 +3190,15 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
3190% needed to apply in the apparatus criticus a language different from 3190% needed to apply in the apparatus criticus a language different from
3191% the one that is selected in the edition text. 3191% the one that is selected in the edition text.
3192% 3192%
3193% \DescribeMacro{\SetApparatusNoteLanguage}
3194% \phts\label{ref:app-note-lang}\newfeature[v1.3]
3195% \cs{SetApparatusNoteLanguage}\marg{languagename} can be used when it
3196% is needed to apply in text entries introduced by the mandatory
3197% argument of the \cs{note} command as described in
3198% \vref{ref:type-note}\===namely
3199% \cs{note}\oarg{options}\marg{text}\===a language different from the
3200% one that is selected in the edition text.
3201%
3193% \paragraph{General Command} 3202% \paragraph{General Command}
3194% \DescribeMacro{\SetApparatus} \cs{SetApparatus}\marg{csv list of 3203% \DescribeMacro{\SetApparatus} \cs{SetApparatus}\marg{csv list of
3195% apparatus settings}\phts\label{ref:apparatus-settings-b}\\ 3204% apparatus settings}\phts\label{ref:apparatus-settings-b}\\
@@ -3226,12 +3235,21 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
3226% \DescribeOption{lang} |lang|$=$\meta{languagename} 3235% \DescribeOption{lang} |lang|$=$\meta{languagename}
3227% \newfeature[v1.2]\phts\label{ref:app-lang-opt} 3236% \newfeature[v1.2]\phts\label{ref:app-lang-opt}
3228% \hfill\tcboxverb{Default: not set}\\ 3237% \hfill\tcboxverb{Default: not set}\\
3229% \needspace{3\baselineskip}\noindent
3230% |lang=<languagename>| is used as described 3238% |lang=<languagename>| is used as described
3231% \vpageref[above]{ref:app-lang} when it is needed to apply in the 3239% \vpageref[above]{ref:app-lang} when it is needed to apply in the
3232% apparatus criticus a language different from the one that is 3240% apparatus criticus a language different from the one that is
3233% selected in the edition text. |languagename| can be any value 3241% selected in the edition text. |languagename| can be any value
3234% accepted by \pkg{babel} or \pkg{polyglossia}. 3242% accepted by \pkg{babel} or \pkg{polyglossia}.
3243% \DescribeOption{notelang} |notelang|$=$\meta{languagename}
3244% \newfeature[v1.3]\phts\label{ref:app-note-lang-opt}
3245% \hfill\tcboxverb{Default: not set}\\
3246% |notelang=<languagename>| is used as described
3247% \vpageref[above]{ref:app-note-lang} when is needed to apply in text
3248% entries introduced by the mandatory argument of the \cs{note}
3249% command as described in \vref{ref:type-note}\===namely
3250% \cs{note}\oarg{options}\marg{text}\===a language different from the
3251% one that is selected in the edition text. |languagename| can be any
3252% value accepted by \pkg{babel} or \pkg{polyglossia}.
3235% 3253%
3236% As an example, an apparatus criticus with references to line numbers 3254% As an example, an apparatus criticus with references to line numbers
3237% printed in normal font, a colon as a separator between lemma texts 3255% printed in normal font, a colon as a separator between lemma texts
@@ -3327,6 +3345,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
3327% \DescribeOption{rule} 3345% \DescribeOption{rule}
3328% \DescribeOption{norule} 3346% \DescribeOption{norule}
3329% \DescribeOption{lang}\phts\label{ref:apps-lang-opt} 3347% \DescribeOption{lang}\phts\label{ref:apps-lang-opt}
3348% \DescribeOption{notelang}
3330% With regard to layout, any declared layer inherits the default values 3349% With regard to layout, any declared layer inherits the default values
3331% described above in \vref{sec:single-layer-app}. That said, as the 3350% described above in \vref{sec:single-layer-app}. That said, as the
3332% optional argument of \cs{DeclareApparatus} accepts the exact same 3351% optional argument of \cs{DeclareApparatus} accepts the exact same
@@ -3524,7 +3543,12 @@ Some \app[type=rec2]{
3524% \pkg{ekdosis} to print the line numbers in the apparatus criticus 3543% \pkg{ekdosis} to print the line numbers in the apparatus criticus
3525% and to set the |left()| XPointer should \texttt{TEI} output be 3544% and to set the |left()| XPointer should \texttt{TEI} output be
3526% required. Therefore, it must be specified. Otherwise, \pkg{ekdosis} 3545% required. Therefore, it must be specified. Otherwise, \pkg{ekdosis}
3527% will issue an error message.\\ 3546% will issue an error message. However, two strictly consecutive
3547% \cs{note} commands are allowed to share the same |labelb| value for
3548% it may happen that consecutive notes need to refer to spans of text
3549% that begin at the exact same location. In this case, \pkg{ekdosis}
3550% generates only one \cs{linelabel} and one corresponding
3551% |<anchor>| element in the \texttt{TEI xml} file.\\
3528% \DescribeOption{labele} |labele|$=$\meta{label}\\ 3552% \DescribeOption{labele} |labele|$=$\meta{label}\\
3529% |labele| is the unique label to serve as a reference for the point 3553% |labele| is the unique label to serve as a reference for the point
3530% immediately following the lemma text. Contrary to |labelb|, |labele| 3554% immediately following the lemma text. Contrary to |labelb|, |labele|
@@ -7424,6 +7448,7 @@ Sample text with a \textcolor{red}{word} in red.
7424 store ehook = \ehook@val, 7448 store ehook = \ehook@val,
7425 store maxentries = \limit@val, 7449 store maxentries = \limit@val,
7426 store lang = \lang@val, 7450 store lang = \lang@val,
7451 store notelang = \notelang@val,
7427 initial direction = LR, 7452 initial direction = LR,
7428 initial delim = {}, 7453 initial delim = {},
7429 initial ehook = {\csname ekd@end@apparatus\endcsname} 7454 initial ehook = {\csname ekd@end@apparatus\endcsname}
@@ -7456,7 +7481,8 @@ Sample text with a \textcolor{red}{word} in red.
7456 \luastringO{\bhook@val}, 7481 \luastringO{\bhook@val},
7457 \luastringO{\ehook@val}, 7482 \luastringO{\ehook@val},
7458 \luastringO{\limit@val}, 7483 \luastringO{\limit@val},
7459 \luastringO{\lang@val} 7484 \luastringO{\lang@val},
7485 \luastringO{\notelang@val}
7460 )} 7486 )}
7461 \egroup 7487 \egroup
7462} 7488}
@@ -7594,6 +7620,9 @@ Sample text with a \textcolor{red}{word} in red.
7594 noval norule = \def\ekd@default@rule{\mbox{}}, 7620 noval norule = \def\ekd@default@rule{\mbox{}},
7595 store lang = \ekd@singleapp@lang, 7621 store lang = \ekd@singleapp@lang,
7596 initial lang = \ltx@ifpackageloaded{babel}{\languagename}{}% 7622 initial lang = \ltx@ifpackageloaded{babel}{\languagename}{}%
7623 \ltx@ifpackageloaded{polyglossia}{\languagename}{},
7624 store notelang = \ekd@singleapp@note@lang,
7625 initial notelang = \ltx@ifpackageloaded{babel}{\languagename}{}%
7597 \ltx@ifpackageloaded{polyglossia}{\languagename}{} 7626 \ltx@ifpackageloaded{polyglossia}{\languagename}{}
7598} 7627}
7599% \end{macrocode} 7628% \end{macrocode}
@@ -7663,6 +7692,18 @@ Sample text with a \textcolor{red}{word} in red.
7663 \def\ekd@singleapp@lang{#1}} 7692 \def\ekd@singleapp@lang{#1}}
7664% \end{macrocode} 7693% \end{macrocode}
7665% \end{macro} 7694% \end{macro}
7695% \begin{macro}{\SetApparatusNoteLanguage}
7696% \changes{v1.3}{2021/04/02}{defines an alternate language to be
7697% applied in note apparatus entries}
7698% \cs{SetApparatusNoteLang}\marg{languagename} can be used when
7699% it is needed to apply in entries introduced by the \cs{note} command
7700% a language different from the one that is selected in the edition
7701% text.
7702% \begin{macrocode}
7703\NewDocumentCommand{\SetApparatusNoteLanguage}{m}{%
7704 \def\ekd@singleapp@note@lang{#1}}
7705% \end{macrocode}
7706% \end{macro}
7666% \begin{macro}{\footnoteruletrue} 7707% \begin{macro}{\footnoteruletrue}
7667% \begin{macro}{\footnoterulefalse} 7708% \begin{macro}{\footnoterulefalse}
7668% As \pkg{ekdosis} takes care of drawing a rule separating the main 7709% As \pkg{ekdosis} takes care of drawing a rule separating the main
@@ -8126,8 +8167,9 @@ Sample text with a \textcolor{red}{word} in red.
8126% \end{macrocode} 8167% \end{macrocode}
8127% \end{macro} 8168% \end{macro}
8128% \begin{macro}{\app@lang} 8169% \begin{macro}{\app@lang}
8129% This macro is used internally by \cs{lem}, \cs{rdg} and \cs{note} to 8170% \begin{macro}{\app@note@lang}
8130% set the language for apparatus entries. 8171% \cs{app@lang} is used internally by \cs{lem} and \cs{rdg} to set the
8172% language for apparatus entries. \cs{note} uses \cs{\app@note@lang}.
8131% \begin{macrocode} 8173% \begin{macrocode}
8132\def\app@lang{% 8174\def\app@lang{%
8133 \ifekd@mapps 8175 \ifekd@mapps
@@ -8136,8 +8178,16 @@ Sample text with a \textcolor{red}{word} in red.
8136 \ekd@singleapp@lang 8178 \ekd@singleapp@lang
8137 \fi 8179 \fi
8138} 8180}
8181\def\app@note@lang{%
8182 \ifekd@mapps
8183 \luadirect{tex.sprint(ekdosis.getappnotelang(\luastring{\ekdan@type}))}%
8184 \else
8185 \ekd@singleapp@note@lang
8186 \fi
8187}
8139% \end{macrocode} 8188% \end{macrocode}
8140% \end{macro} 8189% \end{macro}
8190% \end{macro}
8141% \begin{macro}{\lem} 8191% \begin{macro}{\lem}
8142% \cs{lem}\oarg{options}\marg{lemma text} inserts \meta{lemma text} 8192% \cs{lem}\oarg{options}\marg{lemma text} inserts \meta{lemma text}
8143% both in the edition text and in the apparatus criticus by default, 8193% both in the edition text and in the apparatus criticus by default,
@@ -8435,7 +8485,7 @@ Sample text with a \textcolor{red}{word} in red.
8435 \unexpanded\expandafter{\ekdn@sep}\fi 8485 \unexpanded\expandafter{\ekdn@sep}\fi
8436 \else\fi% 8486 \else\fi%
8437 \ifbool{ekd@lang@pkg}% 8487 \ifbool{ekd@lang@pkg}%
8438 {{\noexpand\selectlanguage{\app@lang}\unexpanded{#2}}}{% 8488 {{\noexpand\selectlanguage{\app@note@lang}\unexpanded{#2}}}{%
8439 {\unexpanded{#2}}}}}% 8489 {\unexpanded{#2}}}}}%
8440 \ifekd@mapps% 8490 \ifekd@mapps%
8441 \unconditional@appin[\ekdan@type]{\note@contents}% 8491 \unconditional@appin[\ekdan@type]{\note@contents}%
@@ -10847,7 +10897,8 @@ function ekdosis.newapparatus(teitype,
10847 appbhook, 10897 appbhook,
10848 appehook, 10898 appehook,
10849 applimit, 10899 applimit,
10850 applang) 10900 applang,
10901 appnotelang)
10851 if isintable(apparatuses, teitype) 10902 if isintable(apparatuses, teitype)
10852 then 10903 then
10853 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" 10904 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
@@ -10862,7 +10913,8 @@ function ekdosis.newapparatus(teitype,
10862 bhook = appbhook, 10913 bhook = appbhook,
10863 ehook = appehook, 10914 ehook = appehook,
10864 limit = applimit, 10915 limit = applimit,
10865 lang = applang}) 10916 lang = applang,
10917 notelang = appnotelang})
10866 end 10918 end
10867 bagunits[teitype] = 1 10919 bagunits[teitype] = 1
10868 return true 10920 return true
@@ -10878,6 +10930,16 @@ function ekdosis.getapplang(teitype)
10878 end 10930 end
10879end 10931end
10880 10932
10933function ekdosis.getappnotelang(teitype)
10934 i = get_a_index(teitype, apparatuses)
10935 if apparatuses[i].notelang ~= ""
10936 then
10937 return apparatuses[i].notelang
10938 else
10939 return "\\languagename"
10940 end
10941end
10942
10881function ekdosis.getappdelim(str) 10943function ekdosis.getappdelim(str)
10882 for i = 1,#apparatuses 10944 for i = 1,#apparatuses
10883 do 10945 do