From b9f6093c92fe7326c5438e97bef939c0cf05541d Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Tue, 2 Apr 2019 19:54:03 +0200
Subject: added origDate. new command \SigLine. tidied up cmdtotag. new
 function ekdosis.basic_cs()

---
 ekdosis.dtx | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 51 insertions(+), 7 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 1adbc99..9e82bb5 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -358,7 +358,7 @@ Running "make install" installs the files in the local TeX tree.
 % Build and process the list of witnesses and hands.
 %    \begin{macrocode}
 \newkeycommand+[\|]{\declare@new@witness}[settlement={}, repository={},
-idno={}, msName={}][3]{%
+idno={}, msName={}, origDate={}][3]{%
   |\luadirect|{%
     ekdosis.newwitness(
     |\luastringN|{#1},
@@ -367,7 +367,8 @@ idno={}, msName={}][3]{%
     |\luastringN|{\commandkey{settlement}},
     |\luastringN|{\commandkey{repository}},
     |\luastringN|{\commandkey{idno}},
-    |\luastringN|{\commandkey{msName}})}
+    |\luastringN|{\commandkey{msName}},
+    |\luastringN|{\commandkey{origDate}})}
 }
 \NewDocumentCommand{\DeclareNewWitness}{m m O{} +O{}}{%
   \declare@new@witness[#3]{#1}{#2}{#4}
@@ -381,6 +382,9 @@ idno={}, msName={}][3]{%
 \NewDocumentCommand{\getsiglum}{m}{%
   \luadirect{tex.sprint(ekdosis.getsiglum(\luastringN{#1}))}%
 }
+\NewDocumentCommand{\SigLine}{m}{%
+  \luadirect{tex.sprint(ekdosis.basic_cs(\luastringN{#1}))}
+}
 %    \end{macrocode}
 % Add a \hologo{(La)TeX} command to be processed as a |TEI xml| tag:
 %    \begin{macrocode}
@@ -631,7 +635,8 @@ function ekdosis.newwitness(id,
 			    Settlement,
 			    Repository,
 			    Idno,
-			    MsName)
+			    MsName,
+			    OrigDate)
    if xmlidfound(id)
    then
       tex.print([[\unexpanded{\PackageWarning{ekdosis}{"]]
@@ -653,6 +658,11 @@ function ekdosis.newwitness(id,
 				msName = MsName
 			     },
 			     detailsDesc = description})
+      local indexwit = getindex(id, listWit)
+      if OrigDate ~= "" then
+	 listWit[indexwit].history = {}
+	 listWit[indexwit].history.origin = {origDate = OrigDate}
+      end
    end
    return true
 end
@@ -705,13 +715,15 @@ end
 
 local cmdtotags = {
    {a="footnote", b="note", c=" place=\"bottom\""},
+   {a="textsuperscript", b="hi", c=" rend=\"sup\""},
+   {a="textsubscript", b="hi", c=" rend=\"sub\""},
    {a="textbf", b="hi", c=" rend=\"bold\""},
+   {a="textit", b="hi", c=" rend=\"italic\""},
+   {a="textsc", b="hi", c=" rend=\"smallcaps\""},
+   {a="textsf", b="hi", c=" rend=\"sf\""},
+   {a="arbup", b="hi", c=" rend=\"sup\""},
    {a="txarb", b="foreign", c=" xml:lang=\"arb\""},
-   {a="emph", b="hi", c=" rend=\"italic\""},
    {a="arb", b="foreign", c=" xml:lang=\"arb\""},
-   {a="app", b="app", c=""},
-   {a="lem", b="lem", c=""},
-   {a="rdg", b="rdg", c=""}
 }
 
 function ekdosis.newcmdtotag(cmd, tag, attr)
@@ -820,6 +832,13 @@ function ekdosis.openteistream()
       	 f:write("</handDesc>", "\n")
 	 f:write("</physDesc>", "\n")
       else end
+      if listWit[i].history ~= nil then
+	 f:write("<history>", "\n")
+	 f:write("<origin>", "\n")
+	 f:write("<origDate>", ekdosis.textotei(listWit[i].history.origin.origDate), "</origDate>", "\n")
+	 f:write("</origin>", "\n")
+	 f:write("</history>", "\n")
+      end
       if listWit[i].detailsDesc == "" then else
 	 f:write("<p>", ekdosis.textotei(listWit[i].detailsDesc), "</p>", "\n")
       end
@@ -854,6 +873,31 @@ function ekdosis.exporttei(str)
 end
 -- end totei functions
 
+-- begin basic TeX Conspectus siglorum
+function ekdosis.basic_cs(msid)
+   local indexwit = getindex(msid, listWit)
+   siglum = listWit[indexwit].head
+   if listWit[indexwit].detailsDesc == ""
+   then
+      name = listWit[indexwit].msIdentifier.msName
+   else
+      name = listWit[indexwit].msIdentifier.msName
+	 .."\\thinspace\\newline\\bgroup\\footnotesize{}"..
+	 listWit[indexwit].detailsDesc
+	 .."\\egroup{}"
+   end
+   if listWit[indexwit].history ~= nil
+      and
+      listWit[indexwit].history.origin ~= nil
+   then
+      date = listWit[indexwit].history.origin.origDate
+   else
+      date = ""
+   end
+   return siglum.."&"..name.."&"..date
+end
+-- end basic TeX Conspectus siglorum
+
 function ekdosis.closestream()
    os.remove(tex.jobname..".ekd")
    os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd")
-- 
cgit v1.2.3

