aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2020-08-27 18:47:03 +0200
committerRobert Alessi <alessi@robertalessi.net>2020-08-27 18:47:03 +0200
commitf56c61b70af2ad5bcdb3dca418d6a3ad6cd47d3a (patch)
treea5d9216a1f4c2090cf8eb903e7411942c07be160
parentf11c5a44e78ad2706fe77886e19b1e55877d4ef6 (diff)
downloadekdosis-f56c61b70af2ad5bcdb3dca418d6a3ad6cd47d3a.tar.gz
improved get_attr_value() to leave aside attributes enclosed within braces
-rw-r--r--Makefile2
-rw-r--r--ekdosis.dtx107
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 @@
1NAME = ekdosis 1NAME = ekdosis
2SHELL = bash 2SHELL = bash
3CMP = lualatex-dev 3CMP = lualatex
4PWD = $(shell pwd) 4PWD = $(shell pwd)
5VERS = $(shell ltxfileinfo -v $(NAME).dtx|sed -e 's/^v//') 5VERS = $(shell ltxfileinfo -v $(NAME).dtx|sed -e 's/^v//')
6LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL) 6LOCAL = $(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.
1458% witnesses can be grouped by using spaces as separators, like so: 1458% witnesses can be grouped by using spaces as separators, like so:
1459% \verb*|wit={A,B,C, D,E,F}|. Although any unique identifiers or 1459% \verb*|wit={A,B,C, D,E,F}|. Although any unique identifiers or
1460% labels used to \enquote{declare} sources and scholars as described 1460% labels used to \enquote{declare} sources and scholars as described
1461% above \vpagerefrange{ref:declare-scholar}{ref:declare-source} can 1461% above \vpagerefrange{ref:declare-source}{ref:declare-scholar} can
1462% also be used as values of the |wit| optional argument, it is 1462% also be used as values of the |wit| optional argument, it is
1463% recommended to use |sources| and |resp| to refer to either category 1463% recommended to use |sources| and |resp| to refer to either category
1464% respectively as described below.\\ 1464% respectively as described below.\\
@@ -1467,13 +1467,15 @@ yesterday.
1467% A \enquote{source} refers to any type of document consulted by the 1467% A \enquote{source} refers to any type of document consulted by the
1468% editor to establish the edition text. Most commonly, corrections and 1468% editor to establish the edition text. Most commonly, corrections and
1469% emendations from previous editions are cited in the apparatus 1469% emendations from previous editions are cited in the apparatus
1470% criticus.\footnote{For an example of an edition text used as a 1470% criticus.\footnote{For edition texts used as sources, see examples
1471% source, see below in \vref{sec:references-cited-works}.}\\ 1471% below in \vref{sec:emendations-conjectures} and
1472% \vref{sec:references-cited-works}.}\\
1472% \DescribeOption{resp} |resp|$=$\meta{csv list of 1473% \DescribeOption{resp} |resp|$=$\meta{csv list of
1473% scholars}\label{ref:lem-resp}\newfeature[v1.1]\\ 1474% scholars}\label{ref:lem-resp}\newfeature[v1.1]\\
1474% |resp| refers to scholars responsible for the emendations, 1475% |resp| refers to scholars responsible for the emendations,
1475% conjectures and corrections that are cited in the apparatus 1476% conjectures and corrections that are cited in the apparatus
1476% criticus.\\ 1477% criticus.\footnote{See detailed examples in
1478% \vref{sec:emendations-conjectures}.}\\
1477% \DescribeOption{alt} |alt|$=$\meta{alternate lemma}\\ 1479% \DescribeOption{alt} |alt|$=$\meta{alternate lemma}\\
1478% While the mandatory argument of \cs{lem}, \meta{lemma text}, is 1480% While the mandatory argument of \cs{lem}, \meta{lemma text}, is
1479% always used to print the edition text in the upper part of the page, 1481% 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}{;}+
2486 </lem> 2488 </lem>
2487</app>οὗτοι</p> 2489</app>οὗτοι</p>
2488<p>subsidiis magnis 2490<p>subsidiis magnis
2489<sic>epicuri</sic>constabilitas</p> 2491<sic>epicuri</sic> constabilitas</p>
2490<p>declinare quis est qui 2492<p>declinare quis est qui
2491<sic>possit cernere sese</sic>.</p> 2493<sic>possit cernere sese</sic>.</p>
2492<p> 2494<p>
@@ -2940,12 +2942,12 @@ Some \app[type=rec2]{
2940 Asia; a language, copious, elastic, inviting self-explaining 2942 Asia; a language, copious, elastic, inviting self-explaining
2941 combinations and independent development; lending itself alike to 2943 combinations and independent development; lending itself alike to
2942 daily life and imagination, to description and abstract thought. 2944 daily life and imagination, to description and abstract thought.
2943 \note[type=fontium, labelb=61e, labele=62a, lem={They 2945 \note[type=fontium, labelb=B61e, labele=B62a, lem={They
2944 had... slave}]{Waitz, \emph{Deutsche Verfassungs Geschichte}, 2946 had... slave}]{Waitz, \emph{Deutsche Verfassungs Geschichte},
2945 i. 86} They had a class of nobles, but their tongue knew no word 2947 i. 86} They had a class of nobles, but their tongue knew no word
2946 for slave.\linelabel{62a}\footnote{George Bancroft, \emph{History of 2948 for slave.\linelabel{B62a}\footnote{George Bancroft, \emph{History
2947 the United States from the Discovery of the American Continent}, 2949 of the United States from the Discovery of the American
2948 II.61--2.} 2950 Continent}, II.61--2.}
2949\end{ekdosis} 2951\end{ekdosis}
2950\end{minted} 2952\end{minted}
2951% \iffalse 2953% \iffalse
@@ -2964,10 +2966,10 @@ Some \app[type=rec2]{
2964% self-explaining combinations and independent development; 2966% self-explaining combinations and independent development;
2965% lending itself alike to daily life and imagination, to 2967% lending itself alike to daily life and imagination, to
2966% description and abstract thought. \note[type=fontium, 2968% description and abstract thought. \note[type=fontium,
2967% labelb=61e, labele=62a, lem={They had... slave}]{Waitz, 2969% labelb=B61e, labele=B62a, lem={They had... slave}]{Waitz,
2968% \emph{Deutsche Verfassungs Geschichte}, i. 86} They had a class 2970% \emph{Deutsche Verfassungs Geschichte}, i. 86} They had a class
2969% of nobles, but their tongue knew no word for 2971% of nobles, but their tongue knew no word for
2970% slave.\linelabel{62a}\footnote{George Bancroft, \emph{History of 2972% slave.\linelabel{B62a}\footnote{George Bancroft, \emph{History of
2971% the United States from the Discovery of the American Continent}, 2973% the United States from the Discovery of the American Continent},
2972% II.61--2.} 2974% II.61--2.}
2973% \end{specimen} 2975% \end{specimen}
@@ -3175,7 +3177,7 @@ argument of the
3175% apparatus, as described in \vref{sec:single-layer-app}, can be 3177% apparatus, as described in \vref{sec:single-layer-app}, can be
3176% typeset within the Arabic environment that is provided by 3178% typeset within the Arabic environment that is provided by
3177% \pkg{polyglossia}. Unfortunately, the same cannot be said for 3179% \pkg{polyglossia}. Unfortunately, the same cannot be said for
3178% multi-layer apparatus. 3180% multiple-layer apparatus.
3179% 3181%
3180% Whether \pkg{babel} or \pkg{polyglossia} is used, \pkg{ekdosis} 3182% Whether \pkg{babel} or \pkg{polyglossia} is used, \pkg{ekdosis}
3181% automatically applies the current language to the entries of the 3183% automatically applies the current language to the entries of the
@@ -3693,7 +3695,10 @@ subtype="arabtex">'inna 'abI kAna mina
3693 } 3695 }
3694 3696
3695 \ekddiv{ 3697 \ekddiv{
3696 head={<Τμῆμα πρῶτον>}, 3698 head={\app{
3699 \lem[resp=egomute, post=suppleui,
3700 type=emendation]{\supplied{Τμῆμα πρῶτον}}
3701 \rdg[wit=codd, alt=om.]{}}},
3697 type=section, 3702 type=section,
3698 depth=2, 3703 depth=2,
3699 n=II.1 3704 n=II.1
@@ -3730,7 +3735,15 @@ subtype="arabtex">'inna 'abI kAna mina
3730% depth=1, 3735% depth=1,
3731% n=II} 3736% n=II}
3732% 3737%
3733% \ekddiv{head={<Τμῆμα πρῶτον>}, type=section, depth=2, n=II.1} 3738% \ekddiv{
3739% head={\app{
3740% \lem[resp=egomute, post=suppleui,
3741% type=emendation]{\supplied{Τμῆμα πρῶτον}}
3742% \rdg[wit=hcodd, alt=om.]{}}},
3743% type=section,
3744% depth=2,
3745% n=II.1
3746% }
3734% 3747%
3735% \ekddiv{head=1, type=paragraph, depth=3, n=II.1.1} Ἄνθρακες 3748% \ekddiv{head=1, type=paragraph, depth=3, n=II.1.1} Ἄνθρακες
3736% θερινοὶ ἐν Κραννῶνι· [...] 3749% θερινοὶ ἐν Κραννῶνι· [...]
@@ -3751,7 +3764,14 @@ subtype="arabtex">'inna 'abI kAna mina
3751 <rdg wit="#V">λόγος β’</rdg> 3764 <rdg wit="#V">λόγος β’</rdg>
3752 </app></head> 3765 </app></head>
3753 <div type="section" n="II.1"> 3766 <div type="section" n="II.1">
3754 <head>&lt;Τμῆμα πρῶτον&gt;</head> 3767 <head>
3768 <app>
3769 <lem resp="#ego" type="emendation">
3770 <supplied>Τμῆμα πρῶτον</supplied>
3771 </lem>
3772 <rdg wit="#V #I #R #H" />
3773 </app>
3774 </head>
3755 <div type="paragraph" n="II.1.1"> 3775 <div type="paragraph" n="II.1.1">
3756 <head>1</head> 3776 <head>1</head>
3757 <p>Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]</p> 3777 <p>Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]</p>
@@ -3970,30 +3990,6 @@ subtype="arabtex">'inna 'abI kAna mina
3970% \textsf{Lua} functions which involve string matching (both forward 3990% \textsf{Lua} functions which involve string matching (both forward
3971% and reverse matching) and recursions. 3991% and reverse matching) and recursions.
3972% 3992%
3973% \paragraph{The \texttt{xml:id} Attribute}
3974% As a general rule, the |xml:id| global attribute must be unique for
3975% the element that bears the attribute. Furthermore, it must begin
3976% with a letter or an underscore and contain no characters other that
3977% letters, digits, hyphens, underscores and full stops. \pkg{ekdosis}
3978% issues a warning when it finds that any \meta{unique id} of
3979% \meta{unique label} expected in the first argument of
3980% \cs{DeclareWitness}, \cs{DeclareHand}, \cs{DeclareSource} or
3981% \cs{DeclareScholar} is not unique or breaks the rules just
3982% described, but does not prevent the |.tex| source file from
3983% compiling. Instead, it prints the string |<??>| in place of the
3984% expected formatted siglum so that the error in the |.tex| source
3985% file can be easily spotted and corrected.
3986%
3987% \danger As the \meta{unique id} declared with \cs{DeclareShorthand}
3988% is not to be exported in the \texttt{TEI xml} outputfile,
3989% \pkg{ekdosis} checks neither its uniqueness nor its validness.
3990%
3991% \danger It must be noted that \LaTeX\ labels that are provided in
3992% commands such as \cs{label}, \cs{cite} and the like must also be
3993% unique in the document. As \LaTeX\ will issue warnings if it finds
3994% duplicates, \cs{ekdosis} does not check their uniqueness but will
3995% issue warnings if such labels contain invalid strings.
3996%
3997% \paragraph{\texttt{TEI xml} Export Settings} 3993% \paragraph{\texttt{TEI xml} Export Settings}
3998% \label{ref:setteixmlexport} 3994% \label{ref:setteixmlexport}
3999% \DescribeMacro{\SetTEIxmlExport} \cs{SetTEIxmlExport}\marg{csv list 3995% \DescribeMacro{\SetTEIxmlExport} \cs{SetTEIxmlExport}\marg{csv list
@@ -4025,6 +4021,30 @@ subtype="arabtex">'inna 'abI kAna mina
4025% paragraphs within |<p>| elements when |autopar| has been set to 4021% paragraphs within |<p>| elements when |autopar| has been set to
4026% |false| by means of \cs{SetTEIxmlExport} described above. 4022% |false| by means of \cs{SetTEIxmlExport} described above.
4027% 4023%
4024% \paragraph{The \texttt{xml:id} Attribute}
4025% As a general rule, the |xml:id| global attribute must be unique for
4026% the element that bears the attribute. Furthermore, it must begin
4027% with a letter or an underscore and contain no characters other that
4028% letters, digits, hyphens, underscores and full stops. \pkg{ekdosis}
4029% issues a warning when it finds that any \meta{unique id} of
4030% \meta{unique label} expected in the first argument of
4031% \cs{DeclareWitness}, \cs{DeclareHand}, \cs{DeclareSource} or
4032% \cs{DeclareScholar} is not unique or breaks the rules just
4033% described, but does not prevent the |.tex| source file from
4034% compiling. Instead, it prints the string |<??>| in place of the
4035% expected formatted siglum so that the error in the |.tex| source
4036% file can be easily spotted and corrected.
4037%
4038% \danger As the \meta{unique id} declared with \cs{DeclareShorthand}
4039% is not to be exported in the \texttt{TEI xml} outputfile,
4040% \pkg{ekdosis} checks neither its uniqueness nor its validness.
4041%
4042% \danger It must be noted that \LaTeX\ labels that are provided in
4043% commands such as \cs{label}, \cs{cite} and the like must also be
4044% unique in the document. As \LaTeX\ will issue warnings if it finds
4045% duplicates, \cs{ekdosis} does not check their uniqueness but will
4046% issue warnings if such labels contain invalid strings.
4047%
4028% \subsection{Routine \LaTeX\ Commands and Environments} 4048% \subsection{Routine \LaTeX\ Commands and Environments}
4029% \label{sec:routine-cmds} 4049% \label{sec:routine-cmds}
4030% The list of \LaTeX\ commands known by \pkg{ekdosis} at the time of 4050% 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
4320%<*example> 4340%<*example>
4321% \fi 4341% \fi
4322\begin{minted}[linenos=false]{latex} 4342\begin{minted}[linenos=false]{latex}
4323\TeXtoTEIPatt{\textcolor {#1}{#2}}{<hi rend="#1">#2</hi>} 4343\TeXtoTEIPatt{\textcolor{#1}{#2}}{<hi rend="#1">#2</hi>}
4324 4344
4325Sample text with a \textcolor{red}{word} in red. 4345Sample text with a \textcolor{red}{word} in red.
4326\end{minted} 4346\end{minted}
@@ -5825,7 +5845,7 @@ Sample text with a \textcolor{red}{word} in red.
5825% \end{macrocode} 5845% \end{macrocode}
5826% \end{macro} 5846% \end{macro}
5827% 5847%
5828%\paragraph{Multi-layer apparatuses} 5848%\paragraph{Multiple-layer apparatuses}
5829% \pkg{ekdosis} must know if an entry is to be processed in a single- 5849% \pkg{ekdosis} must know if an entry is to be processed in a single-
5830% or multiple-layer context:--- 5850% or multiple-layer context:---
5831% \begin{macrocode} 5851% \begin{macrocode}
@@ -7642,6 +7662,10 @@ end
7642-- Get values of attributes 7662-- Get values of attributes
7643local function get_attr_value(str, attr) 7663local function get_attr_value(str, attr)
7644 str = str.."," 7664 str = str..","
7665 str = string.gsub(str, "%b{}", function(body)
7666 body = string.gsub(body, attr, attr.."@ekd")
7667 return string.format("%s", body)
7668 end)
7645 local attrval = string.match(str, "%f[%w]"..attr.."%s?%=%s?%b{}") 7669 local attrval = string.match(str, "%f[%w]"..attr.."%s?%=%s?%b{}")
7646 or string.match(str, "%f[%w]"..attr.."%s?%=%s?.-%,") 7670 or string.match(str, "%f[%w]"..attr.."%s?%=%s?.-%,")
7647 or "" 7671 or ""
@@ -7650,6 +7674,7 @@ local function get_attr_value(str, attr)
7650 return string.format("%s", bbraces) 7674 return string.format("%s", bbraces)
7651 end) 7675 end)
7652 attrval = string.gsub(attrval, attr.."%s?%=%s?(.-)%s?%,", "%1") 7676 attrval = string.gsub(attrval, attr.."%s?%=%s?(.-)%s?%,", "%1")
7677 str = string.gsub(str, attr.."@ekd", attr)
7653 return attrval 7678 return attrval
7654end 7679end
7655 7680