diff --git a/imxml2epub.py b/imxml2epub.py index f42278e..e184808 100755 --- a/imxml2epub.py +++ b/imxml2epub.py @@ -1288,12 +1288,33 @@ class FootnoteError(Exception): for xmlChapter in xmlChapters: xmlReferences = xmlChapter.findall(".//EOAref") for xmlReference in xmlReferences: + + + # the new stuff + # label_text = xmlReference.find("Label").text[1:] + # logging.debug("label text is %s" % label_text) + + # corresponding_eoa_id_element = xmlTree.xpath("//*[@xml:id='{}']".format(label_text)) + + # if len(corresponding_eoa_id_element) > 1: + # print("The xml:id %s has been assigned more than once. This is not allowed. Exiting." % corresponding_eoa_id_element) + # sys.exit() + # else: + # eoa_id_element = corresponding_eoa_id_element[0] + + # eoa_id = eoa_id_element.get("id") + # end of the new stuff + + print("XXXXXXXX") strResult = "!!! Cross Reference !!!" + xmlReferenceLabel = xmlReference.find("Label") xmlReferenceLabelText = xmlReferenceLabel.text + xmlReferenceRef = xmlReference.find("ref") xmlReferenceRefTarget = xmlReferenceRef.get("target") + if xmlReferenceLabelText in dictEquations: print("Verweis auf Array gefunden:" + xmlReferenceLabelText) strResult = dictEquations[xmlReferenceLabelText] @@ -1366,7 +1387,7 @@ class FootnoteError(Exception): tmpTail = xmlIndexentry.tail or "" xmlIndexentry.clear() xmlIndexentry.tail = tmpTail -etree.strip_tags(xmlEbookTree, "EOAlabel", "EOAindex", "EOApageref", "EOAcitenumeric", "EOAtable", "EOAref", "note", "div", "div2", "div3", "div4", "div5", "citetext", "newpage", "EOAciteyear", "EOAtablelabel" , "hi", "pagebreak", "page", "pagestyle", "EOAcitation", "EOAciteauthoryear", "EOAcitemanual", "EOAprintbibliography", "EOAindexperson", "EOAprintindex", "EOAindexlocation", "EOAprintpersonindex", "EOAprintlocationindex","anchor", "temp", "EOAletterhead") +etree.strip_tags(xmlEbookTree, "EOAlabel", "EOAindex", "EOApageref", "EOAcitenumeric", "EOAtable", "EOAref", "note", "div", "div2", "div3", "div4", "div5", "citetext", "newpage", "EOAciteyear", "EOAtablelabel" , "hi", "pagebreak", "page", "pagestyle", "EOAcitation", "EOAciteauthoryear", "EOAcitemanual", "EOAprintbibliography", "EOAindexperson", "EOAprintindex", "EOAindexlocation", "EOAprintpersonindex", "EOAprintlocationindex","anchor", "temp", "EOAletterhead", "EOAhifigure") etree.strip_attributes(xmlEbookTree, "id-text", "noindent", "type", "label", "spacebefore", "rend") # also contained "id" etree.strip_elements(xmlEbookTree, "citekey", with_tail=False) @@ -1451,8 +1472,6 @@ class FootnoteError(Exception): # Content_OPF hinzufügen intTechnicalChapterNumber += 1 -shutil.copy(EPUB_FILES + "eoa-epub.css", os.getcwd() + "/CONVERT/epub/OEBPS/") - # Saving toc.ncx tmpFileName = os.getcwd() + "/CONVERT/epub/OEBPS/toc.ncx" tmpFile = open (tmpFileName, "w")