Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove colon from image caption if there is no actualf caption text
  • Loading branch information
kthoden committed Sep 24, 2020
1 parent 644acbf commit dce729c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/imxml2epub.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
# Time-stamp: <2020-09-02 09:13:11 (kthoden)>
# Time-stamp: <2020-09-24 16:09:29 (kthoden)>

""" Convert a customized DocBook XML file into a set of files that
constitute the contents of an EPUB file.
Expand Down Expand Up @@ -830,7 +830,10 @@ def add_css_snippet(css_snippet, css_file):
dictLangFigures = translation_xml.find("//entry[@name='fig']").attrib
xmlChapter = xmlFigure.xpath("./ancestor::div1")[0]
figures_text = dictLangFigures[libeoaconvert.two_letter_language(xmlChapter.get("language"))]
xmlFigureCaption.text = f"{figures_text} {str(intFigureNumber)}: {strFigureCaption}"
if len(strFigureCaption) == 0:
xmlFigureCaption.text = f"{figures_text} {str(intFigureNumber)}"
else:
xmlFigureCaption.text = f"{figures_text} {str(intFigureNumber)}: {strFigureCaption}"
xmlFigure.addnext(xmlFigureCaption)
# Change the tag of the parent <p>-Tag to <div> so that it may be removed
#xmlFigure.getparent().tag = "div"
Expand Down

0 comments on commit dce729c

Please sign in to comment.