Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
References
  • Loading branch information
Klaus Thoden committed May 29, 2018
1 parent e5315c7 commit 9092acb
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions imxml2epub.py
Expand Up @@ -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]
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 9092acb

Please sign in to comment.