diff options
-rw-r--r-- | ekdosis.dtx | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index 2381af4..535ef81 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -388,12 +388,14 @@ idno={}, msName={}, origDate={}][3]{% | |||
388 | \NewDocumentCommand{\DeclareNewWitness}{m m O{} +O{}}{% | 388 | \NewDocumentCommand{\DeclareNewWitness}{m m O{} +O{}}{% |
389 | \declare@new@witness[#3]{#1}{#2}{#4} | 389 | \declare@new@witness[#3]{#1}{#2}{#4} |
390 | } | 390 | } |
391 | \@onlypreamble\DeclareNewWitness | ||
391 | \NewDocumentCommand{\DeclareNewHand}{m m m +O{}}{ | 392 | \NewDocumentCommand{\DeclareNewHand}{m m m +O{}}{ |
392 | \luadirect{ekdosis.newhand(\luastringN{#1}, | 393 | \luadirect{ekdosis.newhand(\luastringN{#1}, |
393 | \luastringN{#2}, | 394 | \luastringN{#2}, |
394 | \luastringN{#3}, | 395 | \luastringN{#3}, |
395 | \luastringN{#4})} | 396 | \luastringN{#4})} |
396 | } | 397 | } |
398 | \@onlypreamble\DeclareNewHand | ||
397 | \NewDocumentCommand{\getsiglum}{m}{% | 399 | \NewDocumentCommand{\getsiglum}{m}{% |
398 | \luadirect{tex.sprint(ekdosis.getsiglum(\luastringN{#1}))}% | 400 | \luadirect{tex.sprint(ekdosis.getsiglum(\luastringN{#1}))}% |
399 | } | 401 | } |
@@ -409,6 +411,13 @@ idno={}, msName={}, origDate={}][3]{% | |||
409 | \luastringN{#3})} | 411 | \luastringN{#3})} |
410 | } | 412 | } |
411 | % \end{macrocode} | 413 | % \end{macrocode} |
414 | % Set |TEI| file name | ||
415 | % \begin{macrocode} | ||
416 | \NewDocumentCommand{\SetTEIFileName}{m}{ | ||
417 | \luadirect{ekdosis.setteifilename(\luastringN{#1})} | ||
418 | } | ||
419 | \@onlypreamble\SetTEIFileName | ||
420 | % \end{macrocode} | ||
412 | % \begin{macrocode} | 421 | % \begin{macrocode} |
413 | \newbool{ekd@started} | 422 | \newbool{ekd@started} |
414 | \newbool{do@app} | 423 | \newbool{do@app} |
@@ -807,8 +816,15 @@ function ekdosis.textotei(str) | |||
807 | return str | 816 | return str |
808 | end | 817 | end |
809 | 818 | ||
819 | local teifilename = tex.jobname.."-tei" | ||
820 | |||
821 | function ekdosis.setteifilename(str) | ||
822 | teifilename = str | ||
823 | return true | ||
824 | end | ||
825 | |||
810 | function ekdosis.openteistream() | 826 | function ekdosis.openteistream() |
811 | local f = io.open(tex.jobname.."_tmp-tei.xml", "a+") | 827 | local f = io.open(teifilename.."_tmp.xml", "a+") |
812 | f:write("<TEI xmlns=\"http://www.tei-c.org/ns/1.0\">", "\n") | 828 | f:write("<TEI xmlns=\"http://www.tei-c.org/ns/1.0\">", "\n") |
813 | f:write("<teiHeader>", "\n") | 829 | f:write("<teiHeader>", "\n") |
814 | f:write("<listWit>", "\n") | 830 | f:write("<listWit>", "\n") |
@@ -870,22 +886,22 @@ end | |||
870 | local tidy = nil | 886 | local tidy = nil |
871 | 887 | ||
872 | function ekdosis.closeteistream(opt) | 888 | function ekdosis.closeteistream(opt) |
873 | local f = io.open(tex.jobname.."_tmp-tei.xml", "a+") | 889 | local f = io.open(teifilename.."_tmp.xml", "a+") |
874 | f:write("\n", "</body>", "\n") | 890 | f:write("\n", "</body>", "\n") |
875 | f:write("</text>", "\n") | 891 | f:write("</text>", "\n") |
876 | f:write("</TEI>", "\n") | 892 | f:write("</TEI>", "\n") |
877 | f:close() | 893 | f:close() |
878 | os.remove(tex.jobname.."-tei.xml") | 894 | os.remove(teifilename..".xml") |
879 | os.rename(tex.jobname.."_tmp-tei.xml", tex.jobname.."-tei.xml") | 895 | os.rename(teifilename.."_tmp.xml", teifilename..".xml") |
880 | if opt == "tidy" then | 896 | if opt == "tidy" then |
881 | os.execute("tidy -qmi -xml "..tex.jobname.."-tei.xml") | 897 | os.execute("tidy -qmi -xml "..teifilename..".xml") |
882 | else | 898 | else |
883 | end | 899 | end |
884 | return true | 900 | return true |
885 | end | 901 | end |
886 | 902 | ||
887 | function ekdosis.exporttei(str) | 903 | function ekdosis.exporttei(str) |
888 | local f = io.open(tex.jobname.."_tmp-tei.xml", "a+") | 904 | local f = io.open(teifilename.."_tmp.xml", "a+") |
889 | str = ekdosis.textotei(str) | 905 | str = ekdosis.textotei(str) |
890 | f:write("\n<p>") | 906 | f:write("\n<p>") |
891 | f:write(str) | 907 | f:write(str) |