aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2023-07-28 15:47:53 +0200
committerRobert Alessi <alessi@robertalessi.net>2023-07-28 15:47:53 +0200
commitabe62902304bebf9b483592f51ac734d15077013 (patch)
tree5e1fbac5b7da0a269e63f0435936cb62bc83f2f4
parent0e0f11b2401a63d5fb9fb4648f64ce39b0fe4261 (diff)
downloadekdosis-abe62902304bebf9b483592f51ac734d15077013.tar.gz
a bit of tidy up in the code
-rw-r--r--ekdosis.dtx361
1 files changed, 201 insertions, 160 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index 0d7d805..4e01f26 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -538,7 +538,7 @@ Alessi <alessi@robertalessi.net>
538\end{filecontents} 538\end{filecontents}
539\begin{filecontents}[overwrite]{\jobname-ekd.cfg} 539\begin{filecontents}[overwrite]{\jobname-ekd.cfg}
540%% ekdosis:--- 540%% ekdosis:---
541\footnotelayout{m} 541\SetFootnotes{arrangement=merge}
542\SetCritSymbols{suppbegin = ⟨,suppend = ⟩} 542\SetCritSymbols{suppbegin = ⟨,suppend = ⟩}
543\EnvtoTEI{ancientgreek}{p}[xml:lang="grc"] 543\EnvtoTEI{ancientgreek}{p}[xml:lang="grc"]
544\DeclareApparatus{fontium}[ 544\DeclareApparatus{fontium}[
@@ -4616,7 +4616,7 @@ argument of the
4616% them.} 4616% them.}
4617% \end{specimen} 4617% \end{specimen}
4618% \end{alignment} 4618% \end{alignment}
4619% \SetFootnotes{reset} 4619% \SetFootnotes{arangement=merge}
4620% 4620%
4621% \texttt{TEI xml} output:--- 4621% \texttt{TEI xml} output:---
4622% 4622%
@@ -9715,192 +9715,233 @@ Sample text with a \textcolor{red}{word} in red.
9715% line label\---which are manually inserted---and returns the formatted 9715% line label\---which are manually inserted---and returns the formatted
9716% reference to be inserted in the apparatus criticus. 9716% reference to be inserted in the apparatus criticus.
9717% \begin{macrocode} 9717% \begin{macrocode}
9718\def\current@ref@arg#1#2{{%\textdir TLT% 9718\def\current@ref@arg#1#2{
9719 \unexpanded\expandafter{\ekd@refnumstyle}% 9719 \bgroup %\textdir TLT%
9720 \ifnum% 9720 \unexpanded\expandafter{\ekd@refnumstyle}%
9721 \ifnum
9721 \pdf@strcmp{\getpagerefnumber{#1}}{\getpagerefnumber{#2}} 9722 \pdf@strcmp{\getpagerefnumber{#1}}{\getpagerefnumber{#2}}
9722 = 9723 =
9723 0 9724 0
9724 \ifnum% 9725 \ifnum
9725 \pdf@strcmp{\getrefnumber{#1}}{\getrefnumber{#2}} 9726 \pdf@strcmp{\getrefnumber{#1}}{\getrefnumber{#2}}
9726 =
9727 0
9728 %
9729 \ifekd@mapps%
9730 \ifbool{subsq@unit@\ekdan@type}{%
9731 \ifnum%
9732 \pdf@strcmp{\getrefnumber{#1}}{%
9733 \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevnotelab())}}}
9734 = 9727 =
9735 0 9728 0
9729 %
9730 \ifekd@mapps
9731 \ifbool{subsq@unit@\ekdan@type}{%
9732 \ifnum
9733 \pdf@strcmp{\getrefnumber{#1}}{%
9734 \getrefnumber{\luadirect{tex.sprint(
9735 ekdosis.getprevnotelab())}}}
9736 =
9737 0
9738 \else
9739 \LRnum{\getrefnumber{#1}}%
9740 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
9741 \fi
9742 }%
9743 {\LRnum{\getrefnumber{#1}}%
9744 \unexpanded\expandafter{\ekd@postrefnum}}% issue the no
9736 \else 9745 \else
9737 \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% issue the no 9746 \ifsubsq@unit
9738 \fi% 9747 %
9739 }% 9748 \ifnum
9740 {\LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}}% issue the no 9749 \pdf@strcmp{\getrefnumber{#1}}{%
9741 \else 9750 \getrefnumber{\luadirect{tex.sprint(
9742 \ifsubsq@unit% 9751 ekdosis.getprevnotelab())}}}
9743 % 9752 =
9744 \ifnum% 9753 0
9745 \pdf@strcmp{\getrefnumber{#1}}{% 9754 \else
9746 \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevnotelab())}}} 9755 \LRnum{\getrefnumber{#1}}%
9747 = 9756 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
9748 0 9757 \fi
9749 \else 9758 %
9750 \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% issue the no 9759 \else
9751 \fi 9760 \LRnum{\getrefnumber{#1}}%
9752 % 9761 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
9753 \else 9762 \fi
9754 \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% issue the no 9763 \fi
9755 \fi 9764 %
9756 \fi
9757 %
9758 \else 9765 \else
9759 \ifekd@elidednumbers 9766 \ifekd@elidednumbers
9760 \luadirect{tex.sprint(ekdosis.numrange(\luastring{\getrefnumber{#1}}, 9767 \luadirect{tex.sprint(
9761 \luastring{\getrefnumber{#2}}))}% 9768 ekdosis.numrange(\luastring{\getrefnumber{#1}},
9769 \luastring{\getrefnumber{#2}}))}%
9762 \unexpanded\expandafter{\ekd@postrefnum}% issue the nos 9770 \unexpanded\expandafter{\ekd@postrefnum}% issue the nos
9763 \else 9771 \else
9764 \LRnum{\getrefnumber{#1}}--% 9772 \LRnum{\getrefnumber{#1}}--\LRnum{\getrefnumber{#2}}%
9765 \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}% issue the nos 9773 \unexpanded\expandafter{\ekd@postrefnum}% issue the nos
9774 \fi
9766 \fi 9775 \fi
9767 \fi% 9776 \else
9768 \else
9769 \ifboolexpr{bool {ekd@pagelineation} or bool {ekd@pagevlineation}} 9777 \ifboolexpr{bool {ekd@pagelineation} or bool {ekd@pagevlineation}}
9770 {\LRnum{\getrefnumber{#1}}--% 9778 {\LRnum{\getrefnumber{#1}}--%
9771 \LRnum{\getpagerefnumber{#2}}.% 9779 \LRnum{\getpagerefnumber{#2}}.%
9772 \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}}% issue pg and ln nos 9780 \LRnum{\getrefnumber{#2}}%
9773 {\LRnum{\getrefnumber{#1}}--% 9781 \unexpanded\expandafter{\ekd@postrefnum}}% issue pg and ln nos
9774 \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}}% issue the nos 9782 {\LRnum{\getrefnumber{#1}}--\LRnum{\getrefnumber{#2}}%
9775 \fi% 9783 \unexpanded\expandafter{\ekd@postrefnum}}% issue the nos
9776 \ifekdn@forcenum 9784 \fi
9777 \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% force the no 9785 \ifekdn@forcenum
9778 \fi 9786 \LRnum{\getrefnumber{#1}}%
9779 }% 9787 \unexpanded\expandafter{\ekd@postrefnum}% force the no
9788 \fi
9789 \egroup
9780} 9790}
9781% \end{macrocode} 9791% \end{macrocode}
9782% \cs{current@ref} is pretty much the same as \cs{current@reg@arg}, 9792% \cs{current@ref} is pretty much the same as \cs{current@reg@arg},
9783% but takes no argument. It is used by commands such as \cs{lem} when 9793% but takes no argument. It is used by commands such as \cs{lem} when
9784% references to page and line numbers can be returned by \textsf{Lua}. 9794% references to page and line numbers can be returned by \textsf{Lua}.
9785% \begin{macrocode} 9795% \begin{macrocode}
9786\def\current@ref{{%\textdir TLT% 9796\def\current@ref{%
9787 \unexpanded\expandafter{\ekd@refnumstyle}% 9797 \bgroup %\textdir TLT%
9788 \ifnum% 9798 \unexpanded\expandafter{\ekd@refnumstyle}%
9799 \ifnum % if the whole lemma falls on the same page...
9789 \pdf@strcmp{% 9800 \pdf@strcmp{%
9790 \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9801 \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
9791 {\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}} 9802 {\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}
9792 = 9803 =
9793 0 9804 0
9794 \ifnum% 9805 \ifnum % ... and on the same line
9795 \pdf@strcmp{% 9806 \pdf@strcmp{%
9796 \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9807 \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
9797 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}} 9808 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}
9798 =
9799 0
9800 %
9801 \ifekd@mapps%
9802 \ifbool{subsq@unit@\ekdan@type}{%
9803 \ifnum%
9804 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
9805 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}}
9806 = 9809 =
9807 0 9810 0
9808 %%%begin 9811 %
9809 \ifnum% 9812 \ifekd@mapps % then, if multiple layers have been defined...
9810 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% 9813 \ifbool{subsq@unit@\ekdan@type}{%
9811 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-e}} 9814 \ifnum
9812 = 9815 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(
9813 0 9816 ekdosis.getlnlab())}-b}}%
9814 \ifekd@appinapp 9817 {\getrefnumber{\luadirect{tex.sprint(
9815 \ifnum% 9818 ekdosis.getprevlnlab())}-b}}
9816 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9819 =
9817 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevprevlnlab())}-b}} 9820 0
9818 = 9821 %%% begin
9819 0 9822 \ifnum
9820 \else 9823 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(
9821 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9824 ekdosis.getlnlab())}-e}}%
9822 \unexpanded\expandafter{\ekd@postrefnum}% issue the no 9825 {\getrefnumber{\luadirect{tex.sprint(
9823 \fi 9826 ekdosis.getprevlnlab())}-e}}
9824 \fi 9827 =
9825 \else 9828 0
9826 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9829 \ifekd@appinapp
9827 \unexpanded\expandafter{\ekd@postrefnum}% issue the no 9830 \ifnum
9828 \fi 9831 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(
9829 %%% end 9832 ekdosis.getlnlab())}-b}}%
9833 {\getrefnumber{\luadirect{tex.sprint(
9834 ekdosis.getprevprevlnlab())}-b}}
9835 =
9836 0
9837 \else
9838 \LRnum{\getrefnumber{\luadirect{tex.sprint(
9839 ekdosis.getlnlab())}-b}}%
9840 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
9841 \fi
9842 \fi
9843 \else
9844 \LRnum{\getrefnumber{\luadirect{tex.sprint(
9845 ekdosis.getlnlab())}-b}}%
9846 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
9847 \fi
9848 %%% end
9849 \else
9850 \LRnum{\getrefnumber{\luadirect{tex.sprint(
9851 ekdosis.getlnlab())}-b}}%
9852 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
9853 \fi
9854 }{\LRnum{\getrefnumber{\luadirect{tex.sprint(
9855 ekdosis.getlnlab())}-b}}%
9856 \unexpanded\expandafter{\ekd@postrefnum}}% issue the no
9830 \else 9857 \else
9831 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9858 \ifsubsq@unit
9832 \unexpanded\expandafter{\ekd@postrefnum}% issue the no 9859 %
9833 \fi% 9860 \ifnum
9834 }{\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9861 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(
9835 \unexpanded\expandafter{\ekd@postrefnum}}% issue the no 9862 ekdosis.getlnlab())}-b}}%
9836 \else 9863 {\getrefnumber{\luadirect{tex.sprint(
9837 \ifsubsq@unit% 9864 ekdosis.getprevlnlab())}-b}}
9838 % 9865 =
9839 \ifnum% 9866 0
9840 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9867 %%% begin
9841 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}} 9868 \ifnum
9842 = 9869 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(
9843 0 9870 ekdosis.getlnlab())}-e}}%
9844 %%%begin 9871 {\getrefnumber{\luadirect{tex.sprint(
9845 \ifnum% 9872 ekdosis.getprevlnlab())}-e}}
9846 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% 9873 =
9847 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-e}} 9874 0
9848 = 9875 \ifekd@appinapp
9849 0 9876 \ifnum
9850 \ifekd@appinapp 9877 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(
9851 \ifnum% 9878 ekdosis.getlnlab())}-b}}%
9852 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9879 {\getrefnumber{\luadirect{tex.sprint(
9853 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevprevlnlab())}-b}} 9880 ekdosis.getprevprevlnlab())}-b}}
9854 = 9881 =
9855 0 9882 0
9856 \else 9883 \else
9857 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9884 \LRnum{\getrefnumber{\luadirect{tex.sprint(
9858 \unexpanded\expandafter{\ekd@postrefnum}% issue the no 9885 ekdosis.getlnlab())}-b}}%
9859 \fi 9886 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
9860 \fi 9887 \fi
9861 \else 9888 \fi
9862 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9889 \else
9863 \unexpanded\expandafter{\ekd@postrefnum}% issue the no 9890 \LRnum{\getrefnumber{\luadirect{tex.sprint(
9864 \fi 9891 ekdosis.getlnlab())}-b}}%
9865 %%% end 9892 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
9866 \else 9893 \fi
9867 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9894 %%% end
9868 \unexpanded\expandafter{\ekd@postrefnum}% issue the no 9895 \else
9869 \fi 9896 \LRnum{\getrefnumber{\luadirect{tex.sprint(
9870 % 9897 ekdosis.getlnlab())}-b}}%
9871 \else 9898 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
9872 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9899 \fi
9873 \unexpanded\expandafter{\ekd@postrefnum}% issue the no 9900 %
9874 \fi 9901 \else
9875 \fi 9902 \LRnum{\getrefnumber{\luadirect{tex.sprint(
9876 % 9903 ekdosis.getlnlab())}-b}}%
9904 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
9905 \fi
9906 \fi
9907 %
9877 \else 9908 \else
9878 \ifekd@elidednumbers 9909 \ifekd@elidednumbers
9879 \luadirect{tex.sprint(ekdosis.numrange( 9910 \luadirect{tex.sprint(ekdosis.numrange(
9880 \luastring{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}, 9911 \luastring{\getrefnumber{\luadirect{tex.sprint(
9881 \luastring{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}))}% 9912 ekdosis.getlnlab())}-b}},
9913 \luastring{\getrefnumber{\luadirect{tex.sprint(
9914 ekdosis.getlnlab())}-e}}))}%
9882 \unexpanded\expandafter{\ekd@postrefnum}% issue the nos 9915 \unexpanded\expandafter{\ekd@postrefnum}% issue the nos
9883 \else 9916 \else
9884 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% 9917 \LRnum{\getrefnumber{\luadirect{tex.sprint(
9885 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% 9918 ekdosis.getlnlab())}-b}}--%
9919 \LRnum{\getrefnumber{\luadirect{tex.sprint(
9920 ekdosis.getlnlab())}-e}}%
9886 \unexpanded\expandafter{\ekd@postrefnum}% issue the nos 9921 \unexpanded\expandafter{\ekd@postrefnum}% issue the nos
9922 \fi
9887 \fi 9923 \fi
9888 \fi% 9924 \else
9889 \else
9890 \ifboolexpr{bool {ekd@pagelineation} or bool {ekd@pagevlineation}} 9925 \ifboolexpr{bool {ekd@pagelineation} or bool {ekd@pagevlineation}}
9891 {\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% 9926 {\LRnum{\getrefnumber{\luadirect{tex.sprint(
9892 \LRnum{\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}.% 9927 ekdosis.getlnlab())}-b}}--%
9893 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% 9928 \LRnum{\getpagerefnumber{\luadirect{tex.sprint(
9929 ekdosis.getlnlab())}-e}}.%
9930 \LRnum{\getrefnumber{\luadirect{tex.sprint(
9931 ekdosis.getlnlab())}-e}}%
9894 \unexpanded\expandafter{\ekd@postrefnum}}% issue pg and ln nos 9932 \unexpanded\expandafter{\ekd@postrefnum}}% issue pg and ln nos
9895 {\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% 9933 {\LRnum{\getrefnumber{\luadirect{tex.sprint(
9896 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% 9934 ekdosis.getlnlab())}-b}}--%
9935 \LRnum{\getrefnumber{\luadirect{tex.sprint(
9936 ekdosis.getlnlab())}-e}}%
9897 \unexpanded\expandafter{\ekd@postrefnum}}% issue the nos 9937 \unexpanded\expandafter{\ekd@postrefnum}}% issue the nos
9898 \fi% 9938 \fi
9899 \ifekdl@forcenum 9939 \ifekdl@forcenum
9900 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% 9940 \LRnum{\getrefnumber{\luadirect{tex.sprint(
9901 \unexpanded\expandafter{\ekd@postrefnum}% force the no 9941 ekdosis.getlnlab())}-b}}%
9902 \fi 9942 \unexpanded\expandafter{\ekd@postrefnum}% force the no
9903 }% 9943 \fi
9944 \egroup
9904} 9945}
9905% \end{macrocode} 9946% \end{macrocode}
9906% Define keys to be used by the optional arguments of \cs{lem} and 9947% Define keys to be used by the optional arguments of \cs{lem} and
@@ -10463,17 +10504,17 @@ Sample text with a \textcolor{red}{word} in red.
10463\ekvdefinekeys{ekd@footnotes}{ 10504\ekvdefinekeys{ekd@footnotes}{
10464 choice arrangement = { 10505 choice arrangement = {
10465 column = \unless\ifekd@alignmentstarted 10506 column = \unless\ifekd@alignmentstarted
10466 \footnotelayout{c}\fi, 10507 \pcol@fnlayout@c\fi,
10467 page = \unless\ifekd@alignmentstarted 10508 page = \unless\ifekd@alignmentstarted
10468 \footnotelayout{p}\fi, 10509 \pcol@fnlayout@p\fi,
10469 merge = \unless\ifekd@alignmentstarted 10510 merge = \unless\ifekd@alignmentstarted
10470 \footnotelayout{m}\fi}, 10511 \pcol@fnlayout@m\fi},
10471 unknown-choice arrangement = \PackageError{ekdosis}{unknown 10512 unknown-choice arrangement = \PackageError{ekdosis}{unknown
10472 arrangement=#1}{`arrangement' must be either `column', 10513 arrangement=#1}{`arrangement' must be either `column',
10473 `page' or `merge'.}, 10514 `page' or `merge'.},
10474 noval reset = \ekd@parafootnotesfalse 10515 noval reset = \ekd@parafootnotesfalse
10475 \unless\ifekd@alignmentstarted 10516 \unless\ifekd@alignmentstarted
10476 \footnotelayout{c}\fi, 10517 \pcol@fnlayout@c\fi,
10477 bool paragraph = \ifekd@parafootnotes, 10518 bool paragraph = \ifekd@parafootnotes,
10478 store type = \ekdfn@type, 10519 store type = \ekdfn@type,
10479 initial type = default, 10520 initial type = default,