From 7cb69bc53c72e547c6d0ecb881a3233a5a79f342 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Thu, 20 Aug 2020 11:35:56 +0200
Subject: improved \DeclareScholar now builds a list of persons within the
 <listPerson> element. new command \DeclareSource for editions used as sources

---
 ekdosis.dtx | 347 ++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 266 insertions(+), 81 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index d2e6c1f..54293c5 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -291,7 +291,7 @@ along with this program.  If not, see
                       origDate=s. XV]                      
 \DeclareWitness{sV}{V}{Vaticanus lat. 1652}[
                       origDate=s. XV]
-\DeclareScholar{sDrak}{\emph{Drakenborch}}
+\DeclareSource{sDrak}{\emph{Drakenborch}}
 \end{filecontents}
 \documentclass{ltxdoc}
  %\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry}
@@ -369,8 +369,6 @@ along with this program.  If not, see
 \labelformat{subsection}{sect.~#1}
 \labelformat{subsubsection}{sect.~#1}
 \labelformat{figure}{fig.~#1}
-\newcounter{dummy}
-\newcommand{\dummy}{\refstepcounter{dummy}}
 \usepackage[defaultindex=none,citecmd=autocite]{icite}
 \bibinput{ekdosis}
 \usepackage[nospace,american]{varioref}
@@ -385,8 +383,8 @@ along with this program.  If not, see
 }
 \ifbool{nocolordoc}
 {
-  \usepackage{fontawesome}
-  \def\oasymbol{\faUnlock}
+  \usepackage{academicons}
+  \def\oasymbol{\aiOpenAccess}
   \usepackage{biblatex-ext-oa}
 }
 {\usepackage[symbolpackage=tikz]{biblatex-ext-oa}}
@@ -513,6 +511,13 @@ along with this program.  If not, see
   \captionof{#1}{#2}%
   #3%
   \egroup}
+\NewDocumentCommand{\newfeature}{o}{%
+  \leavevmode
+  \IfNoValueTF{#1}
+  {\marginpar{\hfill\emph{New feature}}}
+  {\marginpar{\hfill\emph{New feature} #1}}%
+  \ignorespaces
+}
 % \usepackage{etoc}
 % \etocsettocdepth{paragraph}
 % \newcommand{\ekdtableofcontents}{%
@@ -538,14 +543,14 @@ along with this program.  If not, see
 \RecordChanges
  %\OnlyDescription
 \begin{document}
-  \DocInput{\jobname.dtx}
-  \PrintChanges
-  \PrintIndex
+\DocInput{\jobname.dtx}
+\PrintChanges
+\PrintIndex
 \end{document}
 %</driver>
 % \fi
 %
-% \CheckSum{1669}
+% \CheckSum{0}
 %
 % \CharacterTable
 %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -956,14 +961,14 @@ along with this program.  If not, see
 %</example>
 % \fi
 %
-% \subsection{Witnesses, Hands, Shorthands \& Scholars}
+% \subsection{Witnesses, Hands, Shorthands, Scholars \& Sources}
 % \label{sec:declarations}
 % Any reference that is to be used in the apparatus criticus must be
 % \enquote{declared} in the preamble beforehand, namely: manuscript
 % sigla (either for single manuscripts or manuscript families, primary
-% or later hands, \emph{\&c.}) or abbreviated last names of scholars.
-% To that effect, \pkg{ekdosis} provides the following preamble-only
-% commands:---
+% or later hands, \emph{\&c.}), abbreviated last names of scholars
+% and sources.  To that effect, \pkg{ekdosis} provides the following
+% preamble-only commands:---
 % 
 % \paragraph{Witnesses}
 % \DescribeMacro{\DeclareWitness} \cs{DeclareWitness}\marg{unique
@@ -1149,14 +1154,56 @@ along with this program.  If not, see
 %
 % \paragraph{Scholars}
 % \label{ref:declare-scholar}
-% \DescribeMacro{\DeclareScholar} \cs{DeclareScholar}\marg{unique
-% label}\marg{rendition}\\
+% \DescribeMacro{\DeclareScholar}\cs{DeclareScholar}\marg{unique
+% id}\marg{rendition}\oarg{options}\newfeature[v1.1]\\
+% Occasionally, it is necessary to refer to a scholar as a person. For
+% example, corrections and conjectures are commonly inserted as
+% self-references to the editor of the text in the apparatus criticus
+% in print with such words as \emph{scripsi}, \emph{addidi},
+% \emph{correxi} and the like. Other examples come from unpublished
+% conjectures of other scholars found in private
+% libraries. \cs{DeclareScholar} takes two mandatory arguments to
+% specify consecutively:---
+% \begin{enumerate}
+% \item The unique identifier of the scholar to be used both in the
+% |.tex| source file and as an |xml:id| in the \texttt{TEI xml} output
+% if any.
+% \item The rendition to be used in the apparatus criticus in print,
+% which also will be found within the |<sourceDesc>| element of the
+% \texttt{TEI} header where the description of the persons cited
+% occurs, within an |<abbr type="siglum">| element.
+% \end{enumerate}
+% Finally, the optional argument of \cs{DeclareScholar} accepts the
+% following comma-separated list of |key-value| arguments:---\\
+% \DescribeOption{rawname}|rawname|$=$\meta{name}\\
+% |rawname| refers to a name that is not to be dissected into name
+% part components such as forename, surname and the like. If |rawname|
+% be used, then \pkg{ekdosis} will ignore the following three optional
+% arguments: |forename|, |surname| and |addname|.\\
+% \DescribeOption{forename}|forename|$=$\meta{forename}\\
+% |forename| refers to first and middle names or initials.\\
+% \DescribeOption{surname}|surname|$=$\meta{surname}\\
+% |surname| stores the last name.\\
+% \DescribeOption{addname} |addname|$=$\meta{additional name}\\
+% |addname| refers to an additional or alternate name by which the
+% scholar is known viz.\ a Latinized form of the name, a nickname, an
+% epithet or alias.\\
+% \DescribeOption{note} |note|$=$\meta{note}\\
+% |note| may hold any relevant information about the material used by
+% the editor. For example, a note may specify that this material has
+% been found as marginal notes by the hand of the scholar in some
+% edition in print.
+%
+% \paragraph{Sources}
+% \label{ref:declare-source}
+% \DescribeMacro{\DeclareSource} \cs{DeclareSource}\marg{unique
+% label}\marg{rendition}\newfeature[v1.1]\\
 % The \emph{Conspectus Siglorum} that is placed ahead of the edition
 % text is traditionally divided into two parts: a)~\emph{Codices},
 % which provides the list of sigla used in the apparatus,
 % b)~\emph{Editiones uel Studia}, which provides references to
-% scholars whose published or unpublished works contain conjectures
-% used in the apparatus criticus. \cs{DeclareScholar} takes two
+% sources, either published or unpublished, which contain conjectures
+% used in the apparatus criticus. \cs{DeclareSource} takes two
 % mandatory arguments used to specify consecutively:---
 % \begin{enumerate}
 % \item A unique label used in the |.tex| source file to refer to the
@@ -1164,21 +1211,23 @@ along with this program.  If not, see
 % \item The rendition to be used in the printed apparatus criticus.
 % \end{enumerate}
 %
-% As \pkg{ekdosis} can include and use \texttt{TEI xml} compliant
-% lists of references,\footnote{See below
-% \vref{sec:references-cited-works}.} it is avisable to use
+% \danger As \pkg{ekdosis} can include and use \texttt{TEI xml}
+% compliant lists of references,\footnote{See below
+% \vref{sec:references-cited-works}.} it is advisable to use
 % Bib\hologo{(La)TeX} labels in the first argument of
-% \cs{DeclareScholar}. Likewise, shorthands fields from the
-% bibliographical database can be recalled from within the second
-% argument of \cs{DeclareScholar}:---
+% \cs{DeclareSource}. Otherwise, the unique label used to declare the
+% source would point to no |xml:id| and the \texttt{TEI xml} would not
+% be valid. Likewise, shorthands fields from the bibliographical
+% database can be recalled from within the second argument of
+% \cs{DeclareSource}:---
 % 
 % \iffalse
 %<*example>
 % \fi
 \begin{minted}[linenos=false]{latex}
-\DeclareScholar{Wil}{Wilamowitz}
+\DeclareSource{Wil}{Wilamowitz}
 % or for example:
-\DeclareScholar{Wil}{\citename{Wil}{shorteditor}}
+\DeclareSource{Wil}{\citename{Wil}{shorteditor}}
 \end{minted}
 % \iffalse
 %</example>
@@ -1188,9 +1237,9 @@ along with this program.  If not, see
 % \subsubsection{Printing Formatted Witnesses
 % --- Conspectus Siglorum}
 % \label{sec:print-witnesses}
-% Once witnesses, hands and scholars have been declared, \pkg{ekdosis}
-% provides two commands to have them printed as declared from their
-% indentifiers.
+% Once witnesses, hands, scholars and sources have been declared,
+% \pkg{ekdosis} provides two commands to have them printed as declared
+% from their indentifiers.
 %
 % \DescribeMacro{\getsiglum} \cs{getsiglum}\marg{csv list of witnesses
 % or single witness} behaves exactly as the |wit| optional argument of
@@ -1338,18 +1387,24 @@ yesterday.
 % While a single witness may be recorded as in |wit=A|,
 % comma-separated lists of multiple witnesses must obviously be
 % enclosed in curly braces, like so:
-% |wit={A,B,C}|. \label{ref:mss-sep-families}It must be noted
-% that witnesses can be grouped by using spaces as separators, like
-% so: \verb*|wit={A,B,C, D,E,F}|.\\
+% |wit={A,B,C}|. \label{ref:mss-sep-families}It must be noted that
+% witnesses can be grouped by using spaces as separators, like so:
+% \verb*|wit={A,B,C, D,E,F}|. Of course, any unique identifiers or
+% labels used to \enquote{declare} scholars and sources as described
+% above \vpagerefrange{ref:declare-scholar}{ref:declare-source} can
+% also be used as values of the |wit| optional argument.\footnote{For
+% an example of an edition text used as a witness,
+% see below in \vref{sec:references-cited-works}.}\\
 % \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,
 % \meta{alternate lemma}, if specified, supersedes what is printed in
-% the related entry of the apparatus criticus. This mechanism is useful
-% in more than one respect. For instance, it can be used to insert
-% abbreviated lemmata in the apparatus criticus, or to introduce an
-% alternate way of writing entries with Latin technical terms in the
-% apparatus criticus as will be demonstrated below in the example
+% the related entry of the apparatus criticus. This mechanism is
+% useful in more than one respect. For instance, it can be used to
+% insert abbreviated lemmata in the apparatus criticus, or to
+% introduce an alternate way of writing entries with Latin technical
+% terms in the apparatus criticus as will be demonstrated below in the
+% example
 % provided by \vref{lst:pj2}.\\
 % \DescribeOption{sep} |sep|$=$\meta{separator}\\
 % |sep| allows to change the symbol used to separate the lemma text
@@ -3311,10 +3366,10 @@ subtype="arabtex">'inna 'abI kAna mina
 % language (Latin, English and French) is to be found in two different
 % places, namely for \texttt{TEI xml} output (ll.~21--3) and for PDF
 % output through \LaTeX\ (ll.~27--9). Finally, it provides examples of
-% declaring witnesses, hands, scholars and shorthands (ll.~31--60). As
-% to the document itself, it shows how to lay out a conspectus
-% siglorum in a table (ll.~64--80), before giving detailed examples of
-% how the edition text is entered (ll.~85--101) and sectional commands
+% declaring witnesses, hands and shorthands (ll.~31--60). As to the
+% document itself, it shows how to lay out a conspectus siglorum in a
+% table (ll.~64--80), before giving detailed examples of how the
+% edition text is entered (ll.~85--101) and sectional commands
 % provided by \pkg{ekdosis} are used (ll.~86, 103 and
 % 110).\footnote{The PDF output is available as
 % \href{samples/Caesar_BG-6-13-1.pdf}{a separate file}.}
@@ -3441,11 +3496,12 @@ subtype="arabtex">'inna 'abI kAna mina
 % 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} 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.
+% \cs{DeclareWitness}, \cs{DeclareHand}, \cs{DeclareScholar} or
+% \cs{DeclareSource} 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,
@@ -3650,13 +3706,14 @@ many mathematical writings and to the sense of
 %
 % Even more subtly, provided that the code |#STC| points to some more
 % information identifying the agency concerned:\footnote{At the time
-% of writing, \enquote*{scholars} can be declared with
-% \cs{DeclareScholar} as described above
-% \vpageref{ref:declare-scholar}. Then the unique ID used in the first
-% argument of this command can point to the list of references
-% inserted by \pkg{ekdosis} in the back matter section of the
-% \texttt{TEI} ouput file. See below \vref{sec:references-cited-works}
-% for more information on how to do this.}---
+% of writing, \enquote*{sources} can be declared with
+% \cs{DeclareSource} as described above
+% \vpageref{ref:declare-source}. Then the unique identifier used in
+% the first argument of this command can point to the list of
+% references inserted by \pkg{ekdosis} in the back matter section of
+% the \texttt{TEI} ouput file. See below
+% \vref{sec:references-cited-works} for more information on how to do
+% this.}---
 % 
 % \iffalse
 %<*example>
@@ -3975,7 +4032,7 @@ Sample text with a \textcolor{red}{word} in red.
 % the Bib\hologo{(La)TeX} file (l.~1) and an |xml:id| in the
 % \texttt{TEI} file (l.~3). This same label must be used again in the
 % preamble of the |.tex| source file to declare Arnold Drakenborch as a
-% scholar,\footnote{See above \vpageref{ref:declare-scholar}.} like
+% source,\footnote{See above \vpageref{ref:declare-source}.} like
 % so:---
 %
 % \iffalse
@@ -3986,7 +4043,7 @@ Sample text with a \textcolor{red}{word} in red.
 \SetxmlBibResource{bibl} % 'bibl' is the basename of 'bibl.xml'
 
 % Declare A. Drakenborch as scholar:
-\DeclareScholar{Drak}{\emph{Drakenborch}}
+\DeclareSource{Drak}{\emph{Drakenborch}}
 \end{minted}
 % \iffalse
 %</example>
@@ -4002,19 +4059,24 @@ Sample text with a \textcolor{red}{word} in red.
 % \fi
 \begin{minted}{latex}
 % Preamble:
+\usepackage[style=oxnotes]{biblatex}
+\addbibresource{bibl.bib}
+
 \usepackage[teiexport=tidy]{ekdosis}
 
+% basename of the .xml bibliographical database:
+\SetxmlBibResource{bibl} % viz. "load bibl.xml"
+
 % Witnesses:
 \DeclareWitness{L}{L}{Laurentianus, plut, XXXVII, cod. 16}[
                       origDate=s. XV]
 % Other witnesses [...]
 
-% Scholars:
-\DeclareScholar{Drak}{\emph{Drakenborch}}
-% Other scholars [...]
-
-% basename of the .xml bibliographical database:
-\SetxmlBibResource{bibl}
+% Sources:
+\DeclareSource{Drak}{\emph{Drakenborch}}
+% Alternatively, use BibLaTeX for the rendition:
+% \DeclareSource{Drak}{\citename{Drak}{editor}}
+% Other sources [...]
 
 % Document:
 \begin{ekdosis}
@@ -4106,8 +4168,8 @@ Sample text with a \textcolor{red}{word} in red.
 % \pkg{ekdosis} can also convert into \texttt{TEI xml} references to
 % cited works. Depending on the optional arguments used in the
 % citation command, references will be converted into |<ptr>| or
-% |<ref>| elements with the appropriate ID supplied by means of the
-% |target| attribute.
+% |<ref>| elements with the appropriate identifier supplied by means
+% of the |target| attribute.
 %
 % Of course, for this mechanism to work, Bib\TeX\ or Bib\LaTeX\ must
 % be used and connected to some |.bib| bibliographical database
@@ -5070,11 +5132,11 @@ Sample text with a \textcolor{red}{word} in red.
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{\DeclareHand} As \cs{DeclareWitness}, \cs{DeclareHand}
-%   is a preamble-only command meant to collect data and store them in
-%   |Lua| tables. It takes three mandatory arguments and one optional
-%   argument. The second argument is used to connect the hand to a
-%   declared witness it is related to. Then the table in which this
-%   witness is recorded can be fed with new data.
+% is a preamble-only command meant to collect data and store them in
+% |Lua| tables. It takes three mandatory arguments and one optional
+% argument. The second argument is used to connect the hand to a
+% declared witness it is related to. Then the table in which this
+% witness is recorded can be fed with new data.
 %    \begin{macrocode}
 \NewDocumentCommand{\DeclareHand}{m m m +O{}}{
   \luadirect{ekdosis.newhand(\luastringN{#1},
@@ -5085,20 +5147,57 @@ Sample text with a \textcolor{red}{word} in red.
 \@onlypreamble\DeclareHand
 %    \end{macrocode}
 % \end{macro}
-% \begin{macro}{\DeclareScholar} There is also a table in which are
-%   collected data related to scholars' names to be used in the
-%   apparatus criticus. \cs{DeclareScholar} is a preamble-only command
-%   and takes two mandatory arguments: a unique id and a shorthand to
-%   be used in the apparatus criticus which can be extracted from a
-%   bibliographic database.
+% Build and process the list of scholars:---
 %    \begin{macrocode}
-\NewDocumentCommand{\DeclareScholar}{m m}{
-  \luadirect{ekdosis.newscholar(\luastringN{#1},
-    \luastringN{#2})}
+\ekvdefinekeys{ekd@scholar}{
+  store rawname = \rawname@value,
+  store forename = \forename@value,
+  store surname = \surname@value,
+  store addname = \addname@value,
+  store note = \note@value
 }
+%    \end{macrocode}
+% \begin{macro}{\DeclareScholar}
+% \changes{v1.1}{2020/08/20}{nows builds a list of persons}
+% \cs{DeclareScholar} is used to build a list of persons within the
+% |<listPerson>| element. It takes two mandatory arguments to specify
+% consecutively a unique identifier and the rendition to be used in
+% the apparatus criticus in print, and one optional argument used to
+% collect the name parts components and further items of information
+% from |key-value| \enquote*{named} arguments.
+%    \begin{macrocode}
+\NewDocumentCommand{\DeclareScholar}{m m O{}}{%
+  \bgroup
+  \ekvset{ekd@scholar}{#3}
+    \luadirect{ekdosis.newscholar(
+      \luastringN{#1},
+      \luastringN{#2},
+      \luastringO{\rawname@value},
+      \luastringO{\forename@value},
+      \luastringO{\surname@value},
+      \luastringO{\addname@value},
+      \luastringO{\note@value})}
+    \egroup
+  }
 \@onlypreamble\DeclareScholar
 %    \end{macrocode}
 % \end{macro}
+% \begin{macro}{\DeclareSource}
+%   \changes{v1.1}{2020/08/20}{new command}There is also a table in
+%   which are collected data related to sources to be used in the
+%   apparatus criticus. \cs{DeclareSource} is a preamble-only 
+%   command and takes two mandatory arguments: a unique id and a
+%   shorthand (preferably a Bib\hologo{(La)TeX} label) to be used in
+%   the apparatus criticus which can be extracted from a bibliographic
+%   database.
+%    \begin{macrocode}
+\NewDocumentCommand{\DeclareSource}{m m}{
+  \luadirect{ekdosis.newsource(\luastringN{#1},
+    \luastringN{#2})}
+}
+\@onlypreamble\DeclareSource
+%    \end{macrocode}
+% \end{macro}
 % \begin{macro}{\DeclareShorthand} \cs{DeclareShorthand} is a
 %   preamble-only command that can be used to record manuscript
 %   families or any kind of shorthand to be used to refer to
@@ -5118,7 +5217,7 @@ Sample text with a \textcolor{red}{word} in red.
 % \begin{macro}{\getsiglum}
 % \cs{getsiglum}\marg{csv list} takes a comma-separated list of
 % declared ids by means of \cs{DeclareWitness}, \cs{DeclareHand},
-% \cs{DeclareShorthand} or \cs{DeclareScholar} and returns their
+% \cs{DeclareShorthand} or \cs{DeclareSource} and returns their
 % respective renditions.
 %    \begin{macrocode}
 \NewDocumentCommand{\getsiglum}{m}{%
@@ -6561,6 +6660,7 @@ local next = next
 
 -- General
 xmlids = {}
+table.insert(xmlids, {xmlid = "scholars"} )
 
 local function xmlidfound(element)
    for i = 1,#xmlids do
@@ -6582,9 +6682,12 @@ local function checkxmlid(str)
 end
 
 -- Witnesses
-listWit = {}
-idsRend = {}
-shorthands = {}
+local listWit = {}
+-- Persons/Scholars
+local listPerson = {}
+
+local idsRend = {}
+local shorthands = {}
 
 local function isfound(table, value)
    for i = 1,#table do
@@ -6727,6 +6830,54 @@ function ekdosis.newshorthand(id, rend, xmlids)
    return true
 end
 
+function ekdosis.newscholar(id,
+			    siglum,
+			    rawname,
+			    Forename,
+			    Surname,
+			    AddName,
+			    Note)
+   if xmlidfound(id)
+   then
+      tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
+      	 ..id..
+      	 "\" already exists as an xml:id. "
+      	 ..
+      	 "Please pick another id.}}")
+   elseif not checkxmlid(id)
+   then
+      tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
+      	 ..id..
+      	 "\" is not a valid xml:id. \\MessageBreak "
+      	 ..
+      	 "Please pick another id.}}")
+   else
+      table.insert(xmlids, {xmlid = id})
+      table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)
+      table.insert(idsRend, {xmlid = id, abbr = siglum})
+      table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end)
+      if rawname ~= ""
+      then
+	 table.insert(listPerson, {xmlid = id,
+				   abbr = siglum,
+				   note = Note,
+				   persName = {
+				      name = rawname}
+	 })
+      else
+	 table.insert(listPerson, {xmlid = id,
+				   abbr = siglum,
+				   note = Note,
+				   persName = {
+				      forename = Forename,
+				      surname = Surname,
+				      addName = AddName}
+	 })
+      end
+   end
+   return true
+end
+
 local xmlbibresource = nil
 
 function ekdosis.setxmlbibresource(str)
@@ -6734,7 +6885,7 @@ function ekdosis.setxmlbibresource(str)
    return true
 end
 
-function ekdosis.newscholar(id, siglum)
+function ekdosis.newsource(id, siglum)
    if xmlidfound(id)
    then
       tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
@@ -7649,6 +7800,40 @@ function ekdosis.openteistream()
       f:write("</witness>", "\n")
    end
    f:write("</listWit>", "\n")
+   f:write("<listPerson xml:id=\"scholars\">", "\n")
+   for i = 1,#listPerson do
+      f:write('<person xml:id=\"', listPerson[i].xmlid, "\">", "\n")
+      f:write('<persName>', "\n")
+      f:write('<abbr type="siglum">', textotei(listPerson[i].abbr), "</abbr>", "\n")
+      if listPerson[i].persName.name ~= nil
+      then
+	 f:write(textotei(listPerson[i].persName.name))
+      else
+	 if listPerson[i].persName.forename ~= ""
+	 then
+	    f:write("<forename>", textotei(listPerson[i].persName.forename), "</forename>", "\n")
+	 else
+	    f:write("<forename><!-- forename --></forename>", "\n")
+	 end
+	 if textotei(listPerson[i].persName.surname) ~= ""
+	 then
+	    f:write("<surname>", textotei(listPerson[i].persName.surname), "</surname>", "\n")
+	 else
+	    f:write("<surname><!-- surname --></surname>", "\n")
+	 end
+	 if textotei(listPerson[i].persName.addName) ~= ""
+	 then
+	    f:write("<addName>", textotei(listPerson[i].persName.addName), "</addName>", "\n")
+	 end
+      end
+      if listPerson[i].note ~= ""
+      then
+	 f:write("<note>", textotei(listPerson[i].note), "</note>", "\n")
+      end
+      f:write('</persName>', "\n")      
+      f:write('</person>', "\n")      
+   end
+   f:write("</listPerson>", "\n")
    f:write("</sourceDesc>", "\n")
    f:write("</fileDesc>", "\n")
    f:write("<encodingDesc>", "\n")
-- 
cgit v1.2.3

