From f56c61b70af2ad5bcdb3dca418d6a3ad6cd47d3a Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Thu, 27 Aug 2020 18:47:03 +0200 Subject: improved get_attr_value() to leave aside attributes enclosed within braces --- Makefile | 2 +- ekdosis.dtx | 107 +++++++++++++++++++++++++++++++++++++----------------------- 2 files changed, 67 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index 39a1aaf..64ab76a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ NAME = ekdosis SHELL = bash -CMP = lualatex-dev +CMP = lualatex PWD = $(shell pwd) VERS = $(shell ltxfileinfo -v $(NAME).dtx|sed -e 's/^v//') LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL) diff --git a/ekdosis.dtx b/ekdosis.dtx index ac477be..5a7282e 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -1458,7 +1458,7 @@ yesterday. % witnesses can be grouped by using spaces as separators, like so: % \verb*|wit={A,B,C, D,E,F}|. Although any unique identifiers or % labels used to \enquote{declare} sources and scholars as described -% above \vpagerefrange{ref:declare-scholar}{ref:declare-source} can +% above \vpagerefrange{ref:declare-source}{ref:declare-scholar} can % also be used as values of the |wit| optional argument, it is % recommended to use |sources| and |resp| to refer to either category % respectively as described below.\\ @@ -1467,13 +1467,15 @@ yesterday. % A \enquote{source} refers to any type of document consulted by the % editor to establish the edition text. Most commonly, corrections and % emendations from previous editions are cited in the apparatus -% criticus.\footnote{For an example of an edition text used as a -% source, see below in \vref{sec:references-cited-works}.}\\ +% criticus.\footnote{For edition texts used as sources, see examples +% below in \vref{sec:emendations-conjectures} and +% \vref{sec:references-cited-works}.}\\ % \DescribeOption{resp} |resp|$=$\meta{csv list of % scholars}\label{ref:lem-resp}\newfeature[v1.1]\\ % |resp| refers to scholars responsible for the emendations, % conjectures and corrections that are cited in the apparatus -% criticus.\\ +% criticus.\footnote{See detailed examples in +% \vref{sec:emendations-conjectures}.}\\ % \DescribeOption{alt} |alt|$=$\meta{alternate lemma}\\ % While the mandatory argument of \cs{lem}, \meta{lemma text}, is % always used to print the edition text in the upper part of the page, @@ -2486,7 +2488,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ οὗτοι

subsidiis magnis -epicuriconstabilitas

+epicuri constabilitas

declinare quis est qui possit cernere sese.

@@ -2940,12 +2942,12 @@ Some \app[type=rec2]{ Asia; a language, copious, elastic, inviting self-explaining combinations and independent development; lending itself alike to daily life and imagination, to description and abstract thought. - \note[type=fontium, labelb=61e, labele=62a, lem={They + \note[type=fontium, labelb=B61e, labele=B62a, lem={They had... slave}]{Waitz, \emph{Deutsche Verfassungs Geschichte}, i. 86} They had a class of nobles, but their tongue knew no word - for slave.\linelabel{62a}\footnote{George Bancroft, \emph{History of - the United States from the Discovery of the American Continent}, - II.61--2.} + for slave.\linelabel{B62a}\footnote{George Bancroft, \emph{History + of the United States from the Discovery of the American + Continent}, II.61--2.} \end{ekdosis} \end{minted} % \iffalse @@ -2964,10 +2966,10 @@ Some \app[type=rec2]{ % self-explaining combinations and independent development; % lending itself alike to daily life and imagination, to % description and abstract thought. \note[type=fontium, -% labelb=61e, labele=62a, lem={They had... slave}]{Waitz, +% labelb=B61e, labele=B62a, lem={They had... slave}]{Waitz, % \emph{Deutsche Verfassungs Geschichte}, i. 86} They had a class % of nobles, but their tongue knew no word for -% slave.\linelabel{62a}\footnote{George Bancroft, \emph{History of +% slave.\linelabel{B62a}\footnote{George Bancroft, \emph{History of % the United States from the Discovery of the American Continent}, % II.61--2.} % \end{specimen} @@ -3175,7 +3177,7 @@ argument of the % apparatus, as described in \vref{sec:single-layer-app}, can be % typeset within the Arabic environment that is provided by % \pkg{polyglossia}. Unfortunately, the same cannot be said for -% multi-layer apparatus. +% multiple-layer apparatus. % % Whether \pkg{babel} or \pkg{polyglossia} is used, \pkg{ekdosis} % automatically applies the current language to the entries of the @@ -3693,7 +3695,10 @@ subtype="arabtex">'inna 'abI kAna mina } \ekddiv{ - head={<Τμῆμα πρῶτον>}, + head={\app{ + \lem[resp=egomute, post=suppleui, + type=emendation]{\supplied{Τμῆμα πρῶτον}} + \rdg[wit=codd, alt=om.]{}}}, type=section, depth=2, n=II.1 @@ -3730,7 +3735,15 @@ subtype="arabtex">'inna 'abI kAna mina % depth=1, % n=II} % -% \ekddiv{head={<Τμῆμα πρῶτον>}, type=section, depth=2, n=II.1} +% \ekddiv{ +% head={\app{ +% \lem[resp=egomute, post=suppleui, +% type=emendation]{\supplied{Τμῆμα πρῶτον}} +% \rdg[wit=hcodd, alt=om.]{}}}, +% type=section, +% depth=2, +% n=II.1 +% } % % \ekddiv{head=1, type=paragraph, depth=3, n=II.1.1} Ἄνθρακες % θερινοὶ ἐν Κραννῶνι· [...] @@ -3751,7 +3764,14 @@ subtype="arabtex">'inna 'abI kAna mina λόγος β’

- <Τμῆμα πρῶτον> + + + + Τμῆμα πρῶτον + + + +
1

Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]

@@ -3970,30 +3990,6 @@ subtype="arabtex">'inna 'abI kAna mina % \textsf{Lua} functions which involve string matching (both forward % and reverse matching) and recursions. % -% \paragraph{The \texttt{xml:id} Attribute} -% As a general rule, the |xml:id| global attribute must be unique for -% the element that bears the attribute. Furthermore, it must begin -% with a letter or an underscore and contain no characters other that -% letters, digits, hyphens, underscores and full stops. \pkg{ekdosis} -% issues a warning when it finds that any \meta{unique id} of -% \meta{unique label} expected in the first argument of -% \cs{DeclareWitness}, \cs{DeclareHand}, \cs{DeclareSource} or -% \cs{DeclareScholar} is not unique or breaks the rules just -% described, but does not prevent the |.tex| source file from -% compiling. Instead, it prints the string || in place of the -% expected formatted siglum so that the error in the |.tex| source -% file can be easily spotted and corrected. -% -% \danger As the \meta{unique id} declared with \cs{DeclareShorthand} -% is not to be exported in the \texttt{TEI xml} outputfile, -% \pkg{ekdosis} checks neither its uniqueness nor its validness. -% -% \danger It must be noted that \LaTeX\ labels that are provided in -% commands such as \cs{label}, \cs{cite} and the like must also be -% unique in the document. As \LaTeX\ will issue warnings if it finds -% duplicates, \cs{ekdosis} does not check their uniqueness but will -% issue warnings if such labels contain invalid strings. -% % \paragraph{\texttt{TEI xml} Export Settings} % \label{ref:setteixmlexport} % \DescribeMacro{\SetTEIxmlExport} \cs{SetTEIxmlExport}\marg{csv list @@ -4025,6 +4021,30 @@ subtype="arabtex">'inna 'abI kAna mina % paragraphs within |

| elements when |autopar| has been set to % |false| by means of \cs{SetTEIxmlExport} described above. % +% \paragraph{The \texttt{xml:id} Attribute} +% As a general rule, the |xml:id| global attribute must be unique for +% the element that bears the attribute. Furthermore, it must begin +% with a letter or an underscore and contain no characters other that +% letters, digits, hyphens, underscores and full stops. \pkg{ekdosis} +% issues a warning when it finds that any \meta{unique id} of +% \meta{unique label} expected in the first argument of +% \cs{DeclareWitness}, \cs{DeclareHand}, \cs{DeclareSource} or +% \cs{DeclareScholar} is not unique or breaks the rules just +% described, but does not prevent the |.tex| source file from +% compiling. Instead, it prints the string || in place of the +% expected formatted siglum so that the error in the |.tex| source +% file can be easily spotted and corrected. +% +% \danger As the \meta{unique id} declared with \cs{DeclareShorthand} +% is not to be exported in the \texttt{TEI xml} outputfile, +% \pkg{ekdosis} checks neither its uniqueness nor its validness. +% +% \danger It must be noted that \LaTeX\ labels that are provided in +% commands such as \cs{label}, \cs{cite} and the like must also be +% unique in the document. As \LaTeX\ will issue warnings if it finds +% duplicates, \cs{ekdosis} does not check their uniqueness but will +% issue warnings if such labels contain invalid strings. +% % \subsection{Routine \LaTeX\ Commands and Environments} % \label{sec:routine-cmds} % The list of \LaTeX\ commands known by \pkg{ekdosis} at the time of @@ -4320,7 +4340,7 @@ many mathematical writings and to the sense of %<*example> % \fi \begin{minted}[linenos=false]{latex} -\TeXtoTEIPatt{\textcolor {#1}{#2}}{#2} +\TeXtoTEIPatt{\textcolor␣{#1}{#2}}{#2} Sample text with a \textcolor{red}{word} in red. \end{minted} @@ -5825,7 +5845,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \end{macro} % -%\paragraph{Multi-layer apparatuses} +%\paragraph{Multiple-layer apparatuses} % \pkg{ekdosis} must know if an entry is to be processed in a single- % or multiple-layer context:--- % \begin{macrocode} @@ -7642,6 +7662,10 @@ end -- Get values of attributes local function get_attr_value(str, attr) str = str.."," + str = string.gsub(str, "%b{}", function(body) + body = string.gsub(body, attr, attr.."@ekd") + return string.format("%s", body) + end) local attrval = string.match(str, "%f[%w]"..attr.."%s?%=%s?%b{}") or string.match(str, "%f[%w]"..attr.."%s?%=%s?.-%,") or "" @@ -7650,6 +7674,7 @@ local function get_attr_value(str, attr) return string.format("%s", bbraces) end) attrval = string.gsub(attrval, attr.."%s?%=%s?(.-)%s?%,", "%1") + str = string.gsub(str, attr.."@ekd", attr) return attrval end -- cgit v1.2.3