aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2021-04-16 17:27:08 +0200
committerRobert Alessi <alessi@robertalessi.net>2021-04-16 17:27:08 +0200
commitb69ac2bddddfcce6748b3c1ce6142f0d64b81ff5 (patch)
treed4e68f744060dfe860afe13fa76ba9e56bfb008b
parenta150a011bb28e5728aa95534403bb43d026a6a41 (diff)
downloadekdosis-b69ac2bddddfcce6748b3c1ce6142f0d64b81ff5.tar.gz
new command \teidirect to insert code in the TEI xml file only
-rw-r--r--ekdosis.dtx101
-rw-r--r--ekdosis.el3
2 files changed, 104 insertions, 0 deletions
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
475\DeclareHand{hIpc}{hI}{I\textsuperscript{pc}}[Lectio post correctionem] 475\DeclareHand{hIpc}{hI}{I\textsuperscript{pc}}[Lectio post correctionem]
476\DeclareWitness{hR}{R}{\emph{Vaticanus Gr.} 277} 476\DeclareWitness{hR}{R}{\emph{Vaticanus Gr.} 277}
477\DeclareWitness{hH}{H}{\emph{Parisinus Gr.} 2142} 477\DeclareWitness{hH}{H}{\emph{Parisinus Gr.} 2142}
478\DeclareWitness{hGalE1.Q}{Gal.E1(Q)}{\emph{Parisinus Gr.}
479 2174}[origDate=s. XIV]
480\DeclareWitness{hGalE1.M}{Gal.E1(M)}{\emph{Monacencis Gr.}
481 231}[origDate=s. XVI]
482 \DeclareShorthand{hGalE1.M.Q}{Gal.E1(MQ)}{hGalE1.M,hGalE1.Q}
478\DeclareSource{Lit}{Littré} 483\DeclareSource{Lit}{Littré}
479\DeclareSource{Erm}{Ermerins} 484\DeclareSource{Erm}{Ermerins}
480\DeclareSource{Sm}{Smith} 485\DeclareSource{Sm}{Smith}
@@ -5922,6 +5927,90 @@ Sample text with a \textcolor{red}{word} in red.
5922%</example> 5927%</example>
5923% \fi 5928% \fi
5924% 5929%
5930% \subsection{Inserting Code in the \texttt{TEI xml} Ouput File}
5931% \label{sec:inserting-code-tei}
5932% It may be needed to insert code in the \texttt{TEI xml} output file
5933% only, for example when clear enough information is written in the
5934% apparatus criticus by means of such optional arguments as |pre|,
5935% |post|, |prewit| or |postwit| that are not processed for \texttt{TEI
5936% xml} ouput.\footnote{See above \vref{sec:single-text-editing}.}
5937%
5938% \DescribeMacro{\teidirect} \newfeature[v1.3] \cs{teidirect}\oarg{xml
5939% attributes}\marg{xml element}\marg{code}\\
5940% Two mandatory arguments are expected by \cs{teidirect}, namely the
5941% \texttt{TEI xml} element followed by the contents to be found in the
5942% ouput file between the opening and closing tags. Additionally,
5943% attribute-value pairs to be found inside the start-tag of the
5944% element can be specified in the optional argument of the command. An
5945% example follows:
5946%
5947% \iffalse
5948%<*example>
5949% \fi
5950\begin{minted}[linenos]{latex}
5951% Preamble:
5952\DeclareWitness{GalE1.M}{Gal.E1(M)}{\emph{Monacencis Gr.}
5953 231}[origDate=s. XVI]
5954\DeclareWitness{GalE1.Q}{Gal.E1(Q)}{\emph{Parisinus Gr.}
5955 2174}[origDate=s. XIV]
5956 \DeclareShorthand{GalE1.M.Q}{Gal.E1(MQ)}{GalE1.M,GalE1.Q}
5957
5958% Document:
5959ἐν \app{
5960 \lem[wit=codd]{καύμασιν}
5961 \rdg[wit=GalE1.M.Q, postwit=\unskip(23.16)]{καύματι}
5962 \teidirect{note}{p. 23, l. 16 Wenckebach}}
5963\end{minted}
5964% \iffalse
5965%</example>
5966% \fi
5967%
5968% \begin{remarks}
5969% \item |GalE1.M.Q| (l.~11) has been defined as a shorthand to denote
5970% the agreement of two otherwise defined manuscripts by means of
5971% \cs{DeclareWitness}: |GalE1.M| and |GalE1.Q|. (See ll.~2--6.)
5972% \item The |postwit| optional argument has been used to further
5973% specify the location where this variant reading can be found in
5974% the critical edition of Galen's Commentary on Hippocrates'
5975% \emph{Epidemics}, Book~1 (l.~11). But as the effect of |postwit|
5976% is limited to the PDF output, \cs{teidirect} has been used to
5977% convey this item of information to the \texttt{TEI xml} ouput file
5978% (l.~12).
5979% \end{remarks}
5980%
5981% PDF output:---
5982% \medskip
5983%
5984% \needspace{7\baselineskip}
5985% \resetlinenumber
5986% \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
5987% \begin{specimen}
5988% \begin{ancientgreek}
5989% ἐν \app{
5990% \lem[wit=hcodd]{καύμασιν}
5991% \rdg[wit=hGalE1.M.Q, postwit=\unskip(23.16)]{καύματι}
5992% \teidirect{note}{p. 23, l. 16 Wenckebach}}
5993% \end{ancientgreek}
5994% \end{specimen}
5995% \end{alignment}
5996%
5997% \texttt{TEI xml} output:---
5998%
5999% \iffalse
6000%<*example>
6001% \fi
6002\begin{minted}[linenos]{xml}
6003<p xml:lang="grc">ἐν
6004<app>
6005 <lem wit="#V #I #R #H">καύμασιν</lem>
6006 <rdg wit="#GalE1.#M #GalE1.Q">καύματι</rdg>
6007 <note>p. 23, l. 16 Wenckebach</note>
6008</app></p>
6009\end{minted}
6010% \iffalse
6011%</example>
6012% \fi
6013%
5925% \subsection{Specific \texttt{TEI} Modules} 6014% \subsection{Specific \texttt{TEI} Modules}
5926% \label{sec:specific-tei-modules} 6015% \label{sec:specific-tei-modules}
5927% The following example illustrates how \pkg{ekdosis} can be adapted 6016% The following example illustrates how \pkg{ekdosis} can be adapted
@@ -7374,6 +7463,16 @@ Sample text with a \textcolor{red}{word} in red.
7374} 7463}
7375% \end{macrocode} 7464% \end{macrocode}
7376% \end{macro} 7465% \end{macro}
7466% \begin{macro}{\teidirect}
7467% \changes{v1.3}{2021/04/16}{direct insertion of elements in the
7468% \texttt{TEI xml} file}
7469% \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code}
7470% does nothing in \LaTeX. Its only use is to insert elements in the
7471% \texttt{TEI xml} output file.
7472% \begin{macrocode}
7473\NewDocumentCommand{\teidirect}{O{}mm}{\ignorespaces}
7474% \end{macrocode}
7475% \end{macro}
7377% \begin{macro}{\EnvtoTEI} 7476% \begin{macro}{\EnvtoTEI}
7378% \begin{macro}{\EnvtoTEI*} 7477% \begin{macro}{\EnvtoTEI*}
7379% \cs{EnvtoTEI}\meta{*}\marg{env name}\marg{TEI element}\oarg{TEI 7478% \cs{EnvtoTEI}\meta{*}\marg{env name}\marg{TEI element}\oarg{TEI
@@ -9530,6 +9629,8 @@ local texpatttotags = {
9530 {a="\\poemlines%s+{(.-)}", b=""}, 9629 {a="\\poemlines%s+{(.-)}", b=""},
9531 {a="\\pagebreak%s+%[[1-4]%]", b=""}, 9630 {a="\\pagebreak%s+%[[1-4]%]", b=""},
9532 {a="\\pagebreak%s+", b=""}, 9631 {a="\\pagebreak%s+", b=""},
9632 {a="\\teidirect%s+(%b[]){(.-)}(%b{})", b="<%2 ekd@os%1ekd@cs>ekd@ob%3ekd@cb</%2>"},
9633 {a="\\teidirect%s+{(.-)}(%b{})", b="<%1>ekd@ob%2ekd@cb</%1>"},
9533 {a="\\altrfont%s+", b=""}, 9634 {a="\\altrfont%s+", b=""},
9534 {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"}, 9635 {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"},
9535 {a="\\LR%s+(%b{})", b="ekd@ob%1ekd@cb"}, 9636 {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 @@
127 (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) 127 (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list)
128 '("{{1}}" ("surplus")) 128 '("{{1}}" ("surplus"))
129 t) 129 t)
130 (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list)
131 '("[t]" ("teidirect"))
132 t)
130 ;; This package relies on lualatex, so check for it: 133 ;; This package relies on lualatex, so check for it:
131 (TeX-check-engine-add-engines 'luatex) 134 (TeX-check-engine-add-engines 'luatex)
132 (TeX-add-symbols 135 (TeX-add-symbols