aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ekdosis.dtx48
1 files changed, 48 insertions, 0 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index 7687345..690f8f5 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -399,6 +399,11 @@ idno={}, msName={}, origDate={}][3]{%
399 \luastringN{#4})} 399 \luastringN{#4})}
400} 400}
401\@onlypreamble\DeclareNewHand 401\@onlypreamble\DeclareNewHand
402\NewDocumentCommand{\DeclareNewScholar}{m m}{
403 \luadirect{ekdosis.newscholar(\luastringN{#1},
404 \luastringN{#2})}
405}
406\@onlypreamble\DeclareNewScholar
402\NewDocumentCommand{\getsiglum}{m}{% 407\NewDocumentCommand{\getsiglum}{m}{%
403 \luadirect{tex.sprint(ekdosis.getsiglum(\luastringN{#1}))}% 408 \luadirect{tex.sprint(ekdosis.getsiglum(\luastringN{#1}))}%
404} 409}
@@ -420,6 +425,10 @@ idno={}, msName={}, origDate={}][3]{%
420 \luadirect{ekdosis.setteifilename(\luastringN{#1})} 425 \luadirect{ekdosis.setteifilename(\luastringN{#1})}
421} 426}
422\@onlypreamble\SetTEIFileName 427\@onlypreamble\SetTEIFileName
428\NewDocumentCommand{\SetxmlBibResource}{m}{
429 \luadirect{ekdosis.setxmlbibresource(\luastringN{#1})}
430}
431\@onlypreamble\SetxmlBibResource
423% \end{macrocode} 432% \end{macrocode}
424% \begin{macrocode} 433% \begin{macrocode}
425\newbool{ekd@started} 434\newbool{ekd@started}
@@ -748,6 +757,30 @@ function ekdosis.newhand(id, witid, siglum, description)
748 return true 757 return true
749end 758end
750 759
760local xmlbibresource = nil
761
762function ekdosis.setxmlbibresource(str)
763 xmlbibresource = str..".xml"
764 return true
765end
766
767function ekdosis.newscholar(id, siglum)
768 if xmlidfound(id)
769 then
770 tex.print([[\unexpanded{\PackageWarning{ekdosis}{"]]
771 ..id..
772 [[" already exists as a xml:id. ]]
773 ..
774 [[Please pick another id.}}]])
775 else
776 table.insert(xmlids, {xmlid = id})
777 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)
778 table.insert(idsRend, {xmlid = id, head = siglum})
779 table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end)
780 end
781 return true
782end
783
751function ekdosis.getsiglum(str, opt) 784function ekdosis.getsiglum(str, opt)
752 str = str.."," 785 str = str..","
753 str = string.gsub(str, "%s-(%,)", "%1") 786 str = string.gsub(str, "%s-(%,)", "%1")
@@ -876,6 +909,7 @@ end
876 909
877function ekdosis.openteistream() 910function ekdosis.openteistream()
878 local f = io.open(teifilename.."_tmp.xml", "a+") 911 local f = io.open(teifilename.."_tmp.xml", "a+")
912 f:write('<?xml version="1.0" encoding="utf-8"?>', "\n")
879 f:write("<TEI xmlns=\"http://www.tei-c.org/ns/1.0\">", "\n") 913 f:write("<TEI xmlns=\"http://www.tei-c.org/ns/1.0\">", "\n")
880 f:write("<teiHeader>", "\n") 914 f:write("<teiHeader>", "\n")
881 f:write("<listWit>", "\n") 915 f:write("<listWit>", "\n")
@@ -944,6 +978,20 @@ local tidy = nil
944function ekdosis.closeteistream(opt) 978function ekdosis.closeteistream(opt)
945 local f = io.open(teifilename.."_tmp.xml", "a+") 979 local f = io.open(teifilename.."_tmp.xml", "a+")
946 f:write("\n", "</body>", "\n") 980 f:write("\n", "</body>", "\n")
981 if xmlbibresource ~= nil then
982 bibf = assert(io.open(xmlbibresource, "r"))
983 t = bibf:read("*a")
984 f:write("<back>", "\n")
985 f:write("<listBibl>", "\n")
986 for i in string.gmatch(t, "<biblStruct.->.-</biblStruct>")
987 do
988 f:write("\n", i, "\n")
989 end
990 f:write("</listBibl>", "\n")
991 f:write("</back>", "\n")
992 bibf:close()
993 else
994 end
947 f:write("</text>", "\n") 995 f:write("</text>", "\n")
948 f:write("</TEI>", "\n") 996 f:write("</TEI>", "\n")
949 f:close() 997 f:close()