diff --git a/src/imxml2epub.py b/src/imxml2epub.py index 7c867cd..5bbf6f3 100755 --- a/src/imxml2epub.py +++ b/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. @@ -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

-Tag to

so that it may be removed #xmlFigure.getparent().tag = "div"