From 7aa2b0c21de0f45a4e350893077d706ad678d25b Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Fri, 26 Apr 2019 18:11:44 +0200
Subject: renamed ekdosis.textotei() to local function textotei(). set
 tei_p_open to true before passing str on to textotei()

---
 ekdosis.dtx | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 056d13e..e612149 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -998,7 +998,7 @@ local function cmdtotei(str)
    return str
 end
 
-function ekdosis.textotei(str)
+local function textotei(str)
    str = xml_entities(str)
    if tei_p_open
    then
@@ -1040,8 +1040,8 @@ function ekdosis.openteistream()
    f:write("<listWit>", "\n")
    for i = 1,#listWit do
       f:write('<witness xml:id=\"', listWit[i].xmlid, "\">", "\n")
-      f:write('<abbr type="siglum">', ekdosis.textotei(listWit[i].abbr), "</abbr>", "\n")
-      f:write(ekdosis.textotei(listWit[i].detailsDesc), "\n")
+      f:write('<abbr type="siglum">', textotei(listWit[i].abbr), "</abbr>", "\n")
+      f:write(textotei(listWit[i].detailsDesc), "\n")
       f:write("<msDesc>", "\n")
       if listWit[i].msIdentifier.settlement == ""
 	 and listWit[i].msIdentifier.repository == ""
@@ -1052,16 +1052,16 @@ function ekdosis.openteistream()
       else
 	 f:write("<msIdentifier>", "\n")
 	 if listWit[i].msIdentifier.settlement ~= "" then
-	    f:write("<settlement>", ekdosis.textotei(listWit[i].msIdentifier.settlement), "</settlement>", "\n")
+	    f:write("<settlement>", textotei(listWit[i].msIdentifier.settlement), "</settlement>", "\n")
 	 else end
 	 if listWit[i].msIdentifier.repository ~= "" then
-	    f:write("<repository>", ekdosis.textotei(listWit[i].msIdentifier.repository), "</repository>", "\n")
+	    f:write("<repository>", textotei(listWit[i].msIdentifier.repository), "</repository>", "\n")
 	 else end
 	 if listWit[i].msIdentifier.idno ~= "" then
-	    f:write("<idno>", ekdosis.textotei(listWit[i].msIdentifier.idno), "</idno>", "\n")
+	    f:write("<idno>", textotei(listWit[i].msIdentifier.idno), "</idno>", "\n")
 	 else end
 	 if listWit[i].msIdentifier.msName ~= "" then
-	    f:write("<msName>", ekdosis.textotei(listWit[i].msIdentifier.msName), "</msName>", "\n")
+	    f:write("<msName>", textotei(listWit[i].msIdentifier.msName), "</msName>", "\n")
 	 else end
 	 f:write("</msIdentifier>", "\n")
       end
@@ -1071,16 +1071,16 @@ function ekdosis.openteistream()
 	 while listWit[i].handDesc[j]
 	 do
 	    f:write("<handDesc xml:id=\"", listWit[i].handDesc[j].xmlid, "\">", "\n")
-	    -- f:write('<p><abbr type="siglum">', ekdosis.textotei(listWit[i].handDesc[j].abbr), "</abbr></p>", "\n")
+	    -- f:write('<p><abbr type="siglum">', textotei(listWit[i].handDesc[j].abbr), "</abbr></p>", "\n")
 	    if listWit[i].handDesc[j].handNote == ""
 	    then
-	       f:write('<handNote><abbr type="siglum">', ekdosis.textotei(listWit[i].handDesc[j].abbr), "</abbr></handNote>", "\n")
+	       f:write('<handNote><abbr type="siglum">', textotei(listWit[i].handDesc[j].abbr), "</abbr></handNote>", "\n")
 	    else
 	       f:write("<handNote>", "\n")
-	       f:write('<abbr type="siglum">', ekdosis.textotei(listWit[i].handDesc[j].abbr), "</abbr>", "\n")
-	       f:write("<p>", ekdosis.textotei(listWit[i].handDesc[j].handNote), "</p>", "\n")
+	       f:write('<abbr type="siglum">', textotei(listWit[i].handDesc[j].abbr), "</abbr>", "\n")
+	       f:write("<p>", textotei(listWit[i].handDesc[j].handNote), "</p>", "\n")
 	       f:write("</handNote>", "\n")
-	       -- f:write("<handNote>\n<p>", ekdosis.textotei(listWit[i].handDesc[j].handNote), "</p>\n</handNote>", "\n")
+	       -- f:write("<handNote>\n<p>", textotei(listWit[i].handDesc[j].handNote), "</p>\n</handNote>", "\n")
 	    end
 	    j = j + 1
 	    f:write("</handDesc>", "\n")
@@ -1090,12 +1090,12 @@ function ekdosis.openteistream()
       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("<origDate>", 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")
+      -- f:write("<p>", textotei(listWit[i].detailsDesc), "</p>", "\n")
       -- end
       f:write("</msDesc>", "\n")
       f:write("</witness>", "\n")
@@ -1159,9 +1159,9 @@ end
 
 function ekdosis.exporttei(str)
    local f = io.open(teifilename.."_tmp.xml", "a+")
-   str = ekdosis.textotei(str)
    f:write("\n<p>")
    tei_p_open = true
+   str = textotei(str)
    f:write(str)
    if tei_p_open
    then
-- 
cgit v1.2.3

