From 7f6d19adb83a2e81312a69208876c360f1848d7d Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Fri, 26 Aug 2022 15:44:26 +0200
Subject: new alternate command \App to allow for better code folding with
 ekdosis.el

---
 ekdosis.dtx | 108 ++++++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 87 insertions(+), 21 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 18bc279..db99e5c 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -61,7 +61,7 @@ along with this program.  If not, see
 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<package>\ProvidesPackage{ekdosis}
 %<*package>
-    [2022/05/15 v1.5-dev Typesetting TEI xml-compliant critical editions]
+    [2022/08/26 v1.5-dev Typesetting TEI xml-compliant critical editions]
 %</package>
 %<*driver>
 \begin{filecontents}[noheader,overwrite]{bibdata.xml}
@@ -685,9 +685,11 @@ along with this program.  If not, see
 \newbool{nocolordoc}
 \definecolor{ekdcolor}{RGB}{243,241,235}
 \definecolor{cinnamon}{rgb}{0.82, 0.41, 0.12}
+\definecolor{lavender}{RGB}{152,115,172}
 \ifbool{nocolordoc}{
   \colorlet{ekdcolor}{white}
-  \colorlet{cinnamon}{black}}{}
+  \colorlet{cinnamon}{black}
+  \colorlet{lavender}{gray}}{}
 \definecolor{gainsboro}{RGB}{222,222,222}
 \PassOptionsToPackage{bookmarks=true}{hyperref}
 \usepackage[numbered]{hypdoc}
@@ -1927,11 +1929,53 @@ yesterday.
 % option}. For more information about inserting notes in
 % multiple-layer apparatus, see \vref{sec:notes-in-multilayer-app}.
 %
-% \paragraph{Base text and variants} As can be seen in the example
-% above, there are two kinds of individual readings: the \emph{lemma},
-% which contains the base text accepted by the editor, and the
-% \emph{reading}, which contains deviant readings rejected by the
-% editor.
+% \paragraph{Alternate Command}
+% \DescribeMacro{\App}
+% \newfeature[v1.5]\cs{App}|[type=|\meta{type}|]|\marg{lemma
+% text}\marg{readings and notes}\phts\label{ref:App-cmd}\\
+% \cs{App} is strictly equivalent to \cs{app}, except that the
+% apparatus entries are meant to be distributed in two different
+% arguments, like so:---
+% 
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[linenos=false]{latex}
+I saw my friend \App{\lem{Peter}}{\rdg{John}} yesterday.
+or:
+I saw my friend \App{\lem{Peter}}{
+    \rdg{John}
+  } yesterday.
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+%
+% Used in the \textsf{emacs} editor conjointly with the AUC\TeX\ style
+% file that is provided by \pkg{ekdosis}, this command allows for much
+% more flexible code folding where notes and variants are hidden to
+% let only the base text appear on the screen.  Code folding, once
+% applied, results in a clean source text with no clutter as
+% follows:---
+% 
+% \iffalse
+%<*example>
+% \fi
+\begin{minted}[escapeinside=++]{latex}
+I saw my friend +\textcolor{lavender}{Peter}+ yesterday.
+\end{minted}
+% \iffalse
+%</example>
+% \fi
+% 
+% \danger There is no point in using this command for anything other
+% than this specific purpose.
+% 
+% \paragraph{Base text and variants} As can be seen in \vref{lst:pj1}
+% and the examples provided above, there are two kinds of individual
+% readings: the \emph{lemma}, which contains the base text accepted by
+% the editor, and the \emph{reading}, which contains deviant readings
+% rejected by the editor.
 %
 % \danger What follows refers to the notions of \enquote{witness},
 % \enquote{source} and \enquote{scholar} as defined above
@@ -6287,7 +6331,7 @@ subtype="arabtex">'inna 'abI kAna mina
 %   command uses a private control sequence, it must be found within
 %   \cs{makeatletter} \dots\ \cs{makeatother}.
 % \item Line~10: \cs{ekddot} will only work with multiple-layer
-%   apparatus criticus. Therefore, \cs{DeclareAppa{\allowbreak}ratus}
+%   apparatus criticus. Therefore, |\DeclareAppa|\allowbreak|ratus|
 %   must be used even if only one layer of critical notes be needed.
 % \end{remarks}
 %
@@ -8270,7 +8314,7 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \paragraph{\textsf{ekdosis} Symbol}
 % \begin{macro}{\eKd}
-% \changes{v1.5}{2022/05/15}{Prints \textsf{ekdosis} indentifying
+% \changes{v1.5}{2022/08/26}{Prints \textsf{ekdosis} indentifying
 % symbol} As of v1.5, \pkg{ekdosis} has its own identifying
 % symbol. It is produced by \cs{eKd} and best printed with the Old
 % Standard Greek font.
@@ -8533,7 +8577,7 @@ Sample text with a \textcolor{red}{word} in red.
 % \begin{macro}{\teidirectE}
 % \changes{v1.3}{2021/08/18}{direct insertion of elements in the
 % \texttt{TEI xml} file}
-% \changes{v1.5}{2022/05/15}{direct insertion of empty elements in the
+% \changes{v1.5}{2022/08/26}{direct insertion of empty elements in the
 % \texttt{TEI xml} file}
 % \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code}
 % does nothing in \LaTeX. It is only used to insert elements in the
@@ -8548,7 +8592,7 @@ Sample text with a \textcolor{red}{word} in red.
 % \end{macro}
 % \end{macro}
 % \begin{macro}{\getTEIxmlid}
-% \changes{v1.5}{2022/05/15}{returns \texttt{TEI xml:ids} from a
+% \changes{v1.5}{2022/08/26}{returns \texttt{TEI xml:ids} from a
 % csv-list of ids} This command returns from a csv-list of unique
 % identifiers declared in commands such as \cs{DeclareWitness} and the
 % like a space-separated list of their corresponding |xml:id|s, each
@@ -9150,7 +9194,7 @@ Sample text with a \textcolor{red}{word} in red.
 % \pkg{ekdosis} does not use the \enquote{pagewise} numbering mode
 % that is provided by \pkg{lineno}. Therefore,
 % \cs{outerlinenumbers} and \cs{innerlinenumbers} are defined in
-% addition to \cs{rightlinenum{\allowbreak}bers} and
+% addition to |\rightlinenum|\allowbreak|bers| and
 % \cs{leftlinenumbers}.
 %    \begin{macrocode}
 \def\outerlinenumbers{%
@@ -9275,8 +9319,8 @@ Sample text with a \textcolor{red}{word} in red.
 % \cs{app}|[type=|\meta{type}|]|\marg{apparatus entries} takes one
 % mandatory argument and accepts one optional argument. |type=| refers
 % to the layer the note must go into and \meta{apparatus entries}
-% contains command used to insert the entries, either \cs{lem},
-% \cs{rdg} or \cs{note}\meta{*}:---
+% contains commands used to insert the entries, either \cs{lem},
+% \cs{rdg} or \cs{note}:---
 %    \begin{macrocode}
 \NewDocumentCommand{\app}{O{} > { \TrimSpaces } +m}{%
   \leavevmode
@@ -9295,6 +9339,26 @@ Sample text with a \textcolor{red}{word} in red.
   \endgroup}
 %    \end{macrocode}
 % \end{macro}
+% \begin{macro}{\App}
+% \changes{v1.5}{2022/08/26}{To be used conjointly with
+% \texttt{ekdosis.el}}
+% In contrast to \cs{app}, \cs{App} takes two mandatory arguments and
+% accepts one optional argument like so:
+% \cs{App}|[type=|\meta{type}|]|\marg{lemma text}\marg{variants and
+% notes}. As just described above, |type=| refers to the layer the
+% note must go into. \cs{App} is strictly equivalent to \cs{app},
+% except that lemmas, variants and notes are split into two different
+% arguments, which allows for more flexible code folding. \meta{lemma
+% text} is meant to receive \cs{lem}, while \cs{rdg} and \cs{note} go
+% into \meta{variants and notes}.
+%    \begin{macrocode}
+\NewDocumentCommand{\App}{omm}{%
+  \IfNoValueTF{#1}
+  {\app{#2#3}}
+  {\app[#1]{#2#3}}%
+}
+%    \end{macrocode}
+% \end{macro}
 % \begin{macro}{\ekdpage}
 % \changes{v1.4}{2021/11/21}{prints page marks used internally by
 % \textsf{ekdosis} to generate the apparatus blocks on pages}
@@ -10149,7 +10213,7 @@ Sample text with a \textcolor{red}{word} in red.
 % \end{macro}
 % \paragraph{Lacunae}
 % \begin{macro}{\ilabel}
-% \changes{v1.5}{2022/05/15}{recalls and sets the ending label of
+% \changes{v1.5}{2022/08/26}{recalls and sets the ending label of
 % lemmas used to mark lacunae in witnesses} When \cs{lem} has been
 % used with the optional argument |ilabel=<label>|,
 % \cs{ilabel}\marg{label} must be used to mark the point where the
@@ -10465,7 +10529,7 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{\ekdEOprint}
-% \changes{v1.5}{2022/05/15}{Sets headers and footers on
+% \changes{v1.5}{2022/08/26}{Sets headers and footers on
 % \enquote{paired} facing pages}
 % To set headers and footers on \enquote{paired} facing pages,
 % \cs{ekdEOprint} accepts two mandatory, self-evident arguments, like
@@ -10505,7 +10569,7 @@ Sample text with a \textcolor{red}{word} in red.
 % counter to set the value of the page numbers. This counter should be
 % incremented every two pages.
 % \begin{counter}{pairedpage}
-% \changes{v1.5}{2022/05/15}{A counter incremented every two pages}
+% \changes{v1.5}{2022/08/26}{A counter incremented every two pages}
 % |pairedpage| is first set as a global counter:---
 %    \begin{macrocode}
 \newcounter{pairedpage}
@@ -10513,19 +10577,19 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \end{counter}
 % \begin{macro}{\setpairedpagenum}
-%   \changes{v1.5}{2022/05/15}{sets the same page number on paired
+%   \changes{v1.5}{2022/08/26}{sets the same page number on paired
 %   pages} \cs{setpairedpagenum}\marg{number} is used just ahead of
 %   the alignment environment to set the number of the first left-hand
 %   paired page.
 % \begin{macro}{\setpairedpage}
-%   \changes{v1.5}{2022/05/15}{sets the page number of the first paired
+%   \changes{v1.5}{2022/08/26}{sets the page number of the first paired
 %   page} \cs{setpairedpage} is an argument-less command meant to be
 %   issued in commands used to set headers or footers before
 %   \cs{thepage}. This command has the counter |pairedpage|
 %   incremented on right-hand pages only, and sets |page| $\leftarrow$
 %   |pairedpage| on every page.
 % \begin{macro}{\resetpagenumber}
-%   \changes{v1.5}{2022/05/15}{resets normal running page numbers}
+%   \changes{v1.5}{2022/08/26}{resets normal running page numbers}
 %   \cs{resetpagenumber} must be used right out of \enquote{mirrored}
 %   paired pages alignment environments. This argument-less command
 %   corrects any numbering error on the page following the edition
@@ -10547,7 +10611,7 @@ Sample text with a \textcolor{red}{word} in red.
 % \end{macro}
 % \paragraph{Divisions of the Body}
 % \pkg{ekdosis} can convert \cs{book}, \cs{part}, \cs{chapter},
-% \cs{section}, \cs{subsec{\allowbreak}tion} and \cs{subsubsection}
+% \cs{section}, |\subsec|\allowbreak|tion| and \cs{subsubsection}
 % into corresponding \texttt{TEI} \enquote*{numbered}
 % |<div|\textsubscript{\emph{n}}|>| elements, where $1\leq n\leq 6$.
 % \begin{macro}{\MkBodyDivs}
@@ -11306,6 +11370,8 @@ local texpatttotags = {
    {a="\\ekdpb%s+%*?{(.-)}", b=""},
    {a="\\ekdpb%s+%*\\?", b=""},
    {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"},
+   {a="\\App%s+(%b[])(%b{})(%b{})", b="\\app[%1]{%2%3}"},
+   {a="\\App%s+(%b{})(%b{})", b="\\app{%1%2}"},
    {a="\\LR%s+(%b{})", b="ekd@ob%1ekd@cb"},
    {a="\\RL%s+(%b{})", b="ekd@ob%1ekd@cb"},
    {a="\\%=%=%=%s?", b="—"},
-- 
cgit v1.2.3

