From b69ac2bddddfcce6748b3c1ce6142f0d64b81ff5 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Fri, 16 Apr 2021 17:27:08 +0200 Subject: new command \teidirect to insert code in the TEI xml file only --- ekdosis.dtx | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ekdosis.el | 3 ++ 2 files changed, 104 insertions(+) diff --git a/ekdosis.dtx b/ekdosis.dtx index 5efc419..a40bd57 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -475,6 +475,11 @@ along with this program. If not, see \DeclareHand{hIpc}{hI}{I\textsuperscript{pc}}[Lectio post correctionem] \DeclareWitness{hR}{R}{\emph{Vaticanus Gr.} 277} \DeclareWitness{hH}{H}{\emph{Parisinus Gr.} 2142} +\DeclareWitness{hGalE1.Q}{Gal.E1(Q)}{\emph{Parisinus Gr.} + 2174}[origDate=s. XIV] +\DeclareWitness{hGalE1.M}{Gal.E1(M)}{\emph{Monacencis Gr.} + 231}[origDate=s. XVI] + \DeclareShorthand{hGalE1.M.Q}{Gal.E1(MQ)}{hGalE1.M,hGalE1.Q} \DeclareSource{Lit}{Littré} \DeclareSource{Erm}{Ermerins} \DeclareSource{Sm}{Smith} @@ -5922,6 +5927,90 @@ Sample text with a \textcolor{red}{word} in red. % % \fi % +% \subsection{Inserting Code in the \texttt{TEI xml} Ouput File} +% \label{sec:inserting-code-tei} +% It may be needed to insert code in the \texttt{TEI xml} output file +% only, for example when clear enough information is written in the +% apparatus criticus by means of such optional arguments as |pre|, +% |post|, |prewit| or |postwit| that are not processed for \texttt{TEI +% xml} ouput.\footnote{See above \vref{sec:single-text-editing}.} +% +% \DescribeMacro{\teidirect} \newfeature[v1.3] \cs{teidirect}\oarg{xml +% attributes}\marg{xml element}\marg{code}\\ +% Two mandatory arguments are expected by \cs{teidirect}, namely the +% \texttt{TEI xml} element followed by the contents to be found in the +% ouput file between the opening and closing tags. Additionally, +% attribute-value pairs to be found inside the start-tag of the +% element can be specified in the optional argument of the command. An +% example follows: +% +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos]{latex} +% Preamble: +\DeclareWitness{GalE1.M}{Gal.E1(M)}{\emph{Monacencis Gr.} + 231}[origDate=s. XVI] +\DeclareWitness{GalE1.Q}{Gal.E1(Q)}{\emph{Parisinus Gr.} + 2174}[origDate=s. XIV] + \DeclareShorthand{GalE1.M.Q}{Gal.E1(MQ)}{GalE1.M,GalE1.Q} + +% Document: +ἐν \app{ + \lem[wit=codd]{καύμασιν} + \rdg[wit=GalE1.M.Q, postwit=\unskip(23.16)]{καύματι} + \teidirect{note}{p. 23, l. 16 Wenckebach}} +\end{minted} +% \iffalse +% +% \fi +% +% \begin{remarks} +% \item |GalE1.M.Q| (l.~11) has been defined as a shorthand to denote +% the agreement of two otherwise defined manuscripts by means of +% \cs{DeclareWitness}: |GalE1.M| and |GalE1.Q|. (See ll.~2--6.) +% \item The |postwit| optional argument has been used to further +% specify the location where this variant reading can be found in +% the critical edition of Galen's Commentary on Hippocrates' +% \emph{Epidemics}, Book~1 (l.~11). But as the effect of |postwit| +% is limited to the PDF output, \cs{teidirect} has been used to +% convey this item of information to the \texttt{TEI xml} ouput file +% (l.~12). +% \end{remarks} +% +% PDF output:--- +% \medskip +% +% \needspace{7\baselineskip} +% \resetlinenumber +% \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] +% \begin{specimen} +% \begin{ancientgreek} +% ἐν \app{ +% \lem[wit=hcodd]{καύμασιν} +% \rdg[wit=hGalE1.M.Q, postwit=\unskip(23.16)]{καύματι} +% \teidirect{note}{p. 23, l. 16 Wenckebach}} +% \end{ancientgreek} +% \end{specimen} +% \end{alignment} +% +% \texttt{TEI xml} output:--- +% +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos]{xml} +

ἐν + + καύμασιν + καύματι + p. 23, l. 16 Wenckebach +

+\end{minted} +% \iffalse +% +% \fi +% % \subsection{Specific \texttt{TEI} Modules} % \label{sec:specific-tei-modules} % The following example illustrates how \pkg{ekdosis} can be adapted @@ -7374,6 +7463,16 @@ Sample text with a \textcolor{red}{word} in red. } % \end{macrocode} % \end{macro} +% \begin{macro}{\teidirect} +% \changes{v1.3}{2021/04/16}{direct insertion of elements in the +% \texttt{TEI xml} file} +% \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code} +% does nothing in \LaTeX. Its only use is to insert elements in the +% \texttt{TEI xml} output file. +% \begin{macrocode} +\NewDocumentCommand{\teidirect}{O{}mm}{\ignorespaces} +% \end{macrocode} +% \end{macro} % \begin{macro}{\EnvtoTEI} % \begin{macro}{\EnvtoTEI*} % \cs{EnvtoTEI}\meta{*}\marg{env name}\marg{TEI element}\oarg{TEI @@ -9530,6 +9629,8 @@ local texpatttotags = { {a="\\poemlines%s+{(.-)}", b=""}, {a="\\pagebreak%s+%[[1-4]%]", b=""}, {a="\\pagebreak%s+", b=""}, + {a="\\teidirect%s+(%b[]){(.-)}(%b{})", b="<%2 ekd@os%1ekd@cs>ekd@ob%3ekd@cb"}, + {a="\\teidirect%s+{(.-)}(%b{})", b="<%1>ekd@ob%2ekd@cb"}, {a="\\altrfont%s+", b=""}, {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"}, {a="\\LR%s+(%b{})", b="ekd@ob%1ekd@cb"}, diff --git a/ekdosis.el b/ekdosis.el index f1d40b0..5b627d4 100644 --- a/ekdosis.el +++ b/ekdosis.el @@ -127,6 +127,9 @@ (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) '("{{1}}" ("surplus")) t) + (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) + '("[t]" ("teidirect")) + t) ;; This package relies on lualatex, so check for it: (TeX-check-engine-add-engines 'luatex) (TeX-add-symbols -- cgit v1.2.3