diff options
-rw-r--r-- | ekdosis.dtx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index 2d4579c..056d13e 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -1115,6 +1115,17 @@ end | |||
1115 | 1115 | ||
1116 | local tidy = nil | 1116 | local tidy = nil |
1117 | 1117 | ||
1118 | local function cleanup_tei() | ||
1119 | local f = assert(io.open(teifilename.."_tmp.xml", "r")) | ||
1120 | t = f:read("*a") | ||
1121 | t = string.gsub(t, "%<p%>%</p%>\n", "") | ||
1122 | t = string.gsub(t, "^\n", "") | ||
1123 | local fw = assert(io.open(teifilename.."_tmp.xml", "w")) | ||
1124 | fw:write(t) | ||
1125 | fw:close() | ||
1126 | return true | ||
1127 | end | ||
1128 | |||
1118 | function ekdosis.closeteistream(opt) | 1129 | function ekdosis.closeteistream(opt) |
1119 | local f = io.open(teifilename.."_tmp.xml", "a+") | 1130 | local f = io.open(teifilename.."_tmp.xml", "a+") |
1120 | f:write("\n", "</body>", "\n") | 1131 | f:write("\n", "</body>", "\n") |
@@ -1136,6 +1147,7 @@ function ekdosis.closeteistream(opt) | |||
1136 | f:write("</text>", "\n") | 1147 | f:write("</text>", "\n") |
1137 | f:write("</TEI>", "\n") | 1148 | f:write("</TEI>", "\n") |
1138 | f:close() | 1149 | f:close() |
1150 | cleanup_tei() | ||
1139 | os.remove(teifilename..".xml") | 1151 | os.remove(teifilename..".xml") |
1140 | os.rename(teifilename.."_tmp.xml", teifilename..".xml") | 1152 | os.rename(teifilename.."_tmp.xml", teifilename..".xml") |
1141 | if opt == "tidy" then | 1153 | if opt == "tidy" then |