diff --git a/imxml2django.py b/imxml2django.py index 0e64502..0416d98 100755 --- a/imxml2django.py +++ b/imxml2django.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8; mode: python -*- -# Time-stamp: <2018-03-19 16:07:01 (kthoden)> +# Time-stamp: <2018-04-30 16:24:20 (kthoden)> import pickle import os @@ -67,8 +67,13 @@ dictTables = data["tabdict"] dictPagelabels = data["pagelabeldict"] +if not os.path.exists(os.getcwd() + os.path.sep + "debug"): + os.mkdir(os.getcwd() + os.path.sep + "debug") + xmlTree = etree.parse("tmp_files/IntermediateXMLFile.xml") +libeoaconvert.debug_xml_here(xmlTree, "fresh") + print(""" ############################################################################ # Convert tralics-XML to Django Data Structure # @@ -87,7 +92,7 @@ etree.strip_attributes(xmlTree, "noindent") # Remove temp-Tag etree.strip_tags(xmlTree, "temp") - +libeoaconvert.debug_xml_here(xmlTree, "afterstriptags") # Write Temporary XML-Maintree ergebnisdatei = open("tmp_files/Devel_django.xml", "w") ergebnis = etree.tostring(xmlTree, pretty_print=True, encoding="unicode") @@ -883,6 +888,8 @@ def djangoParseHeadline(xmlElement): xmlEOAchapter.append(djangoParseObject(xmlChapterChild)) intChapterNumber += 1 +libeoaconvert.debug_xml_here(xmlTree, "afterchapter") + print("----------------------------------------------") print("Processing Facsimile Parts") @@ -1047,7 +1054,9 @@ def bring_footnote_down_django(footnote, fragment, footnote_number, object_numbe xmlEOAsection.set("order", str(intObjectNumber)) intObjectNumber += 1 xmlHead = etree.Element("head") + xmlHead.text = libeoaconvert.dictLangFootnotes[libeoaconvert.two_letter_language(xmlEOAchapter.get("language"))] + xmlEOAsection.append(xmlHead) xmlResult.append(xmlEOAsection) @@ -1476,13 +1485,20 @@ def bring_footnote_down_django(footnote, fragment, footnote_number, object_numbe logging.debug("Sorting %s entries for regular index." % str(len(xml_regular_EOAindices))) xml_eoa_print_regular_index = make_index(xml_regular_EOAindices, index_type = "regular") +libeoaconvert.debug_xml_here(xmlDjangoTree, "djangotree") +libeoaconvert.debug_xml_here(xmlEOAdocument, "xmleoadocument") +libeoaconvert.debug_xml_here(xmlTree, "xmltree") + # If EOAprintindex is found, append xml_eoa_print_regular_index to xmlEOAdocument xmlPrintindex = xmlTree.find(".//EOAprintindex") if xmlPrintindex is not None != 0: # Remove

from xmlDjangoTree + print("found an index") xmlPrintindex.tag = "temp" xmlPrintindex.getparent().tag = "temp" xmlEOAdocument.append(xml_eoa_print_regular_index) +else: + print("found no index") print("----------------------------------------------") print("Sorting and Creating Person Index")