From 95b0467394d2948bf399a347cc75effb29e7df65 Mon Sep 17 00:00:00 2001
From: Klaus Thoden
Date: Mon, 12 Feb 2018 16:58:01 +0100
Subject: [PATCH] An XML-unaware fix
---
eoaconvert.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/eoaconvert.py b/eoaconvert.py
index f30d57c..1a863e2 100755
--- a/eoaconvert.py
+++ b/eoaconvert.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
-# Time-stamp: <2018-02-12 16:42:59 (kthoden)>
+# Time-stamp: <2018-02-12 16:57:53 (kthoden)>
# license?
__version__= "1.0"
@@ -1547,11 +1547,24 @@ def cleanup():
# here followed the conversion to epub and the conversion to django.xml
# both parts were removed and put into separate files.
-ergebnisdatei = open("tmp_files/IntermediateXMLFile.xml", "w")
+intermediate_file = "tmp_files/IntermediateXMLFile.xml"
+ergebnisdatei = open(intermediate_file, "w")
ergebnis = etree.tostring(xmlTree, pretty_print=True, encoding="unicode")
ergebnisdatei.write(ergebnis)
ergebnisdatei.close()
+# replacing a milestone element by a closing and opening combination
+with open(intermediate_file, 'r') as tmp_file:
+ filedata = tmp_file.read()
+
+# Replace the target string
+filedata = filedata.replace('', '
')
+
+# Write the file out again
+with open(intermediate_file, 'w') as outfile:
+ outfile.write(filedata)
+
+# saving some data
data_to_pickle = {'chapterdict' : dictChapters,
'eqdict' : dictEquations,
'listdict' : dictLists,