Skip to content

Commit

Permalink
Another chapter counter
Browse files Browse the repository at this point in the history
  • Loading branch information
kthoden committed Jan 15, 2020
1 parent 852cf04 commit 837397a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/imxml2epub.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,6 @@ def add_css_snippet(css_snippet, css_file):

logging.info(f"{logseparator}Preparing Figures")
xmlFigures = xmlEbookTree.xpath(".//EOAfigure[not(contains(@type,'hionly'))]")
libeoaconvert.debug_xml_here(xmlEbookTree, "find_eoafigures", DEBUG_DIR)
logging.info("Found %s figures", len(xmlFigures))
for xmlFigure in xmlFigures:
# Copy File of the Image
Expand Down Expand Up @@ -1678,6 +1677,8 @@ class FootnoteError(Exception):

logging.info(f"{logseparator}Preparing Cross-References")

# restart chapter counter
intChapterNumber = 1
for xmlChapter in xmlChapters:
xmlReferences = xmlChapter.xpath(".//EOAref[not(parent::EOAref)]")
for xmlReference in xmlReferences:
Expand Down Expand Up @@ -1763,13 +1764,14 @@ class FootnoteError(Exception):
logging.info("XXXXXXXX")
xmlReference.clear()
if args.hyperimage and hitarget_id and reference_type in ["collage", "number"]:
hyperimage_link = f"{publication_landingpage[:-11]}/{intChapterNumber - 1}/index.html#{hitarget_id}"
hyperimage_link = f"{publication_landingpage[:-11]}/{intChapterNumber}/index.html#{hitarget_id}"
xmlReference.tag = "a"
xmlReference.set("href", hyperimage_link)
else:
pass
xmlReference.text = strResult
xmlReference.tail = tmpTail
intChapterNumber += 1

# Substitute Page-References with their targets
for xmlChapter in xmlChapters:
Expand Down

0 comments on commit 837397a

Please sign in to comment.