Attributes lost for hierarchical custom styles when reading odt documents

Bug #1478346 reported by bgiroud on 2015-07-26
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

Context: Calibre 2.32.1, Ubuntu 14.04 LTS and LibreOffice 4.2.8.2; custom styles with a dot in the name, being part of a hierarchy of an ODT file when converting to EPUB with ebook-convert.

Ex.: style roman.dialogue has parent style roman.description and should inherit the text-align:justify from it.

The problem (and solution) lies in calibre/src/odf/odf2xhtml.py, in s_style_style where it says:
        [...]
        if parent:
            #parent = parent.replace(".","_") # added by Bernard Giroud
            parent = "%s-%s" % (sfamily, parent)
            parent = special_styles.get(parent, "."+parent)
            if parent in self.styledict:
                [...]

When reading style roman.dialogue, the dot in the name field of the current style has been replaced by a '_' a few line ahead (see name = name.replace(".","_")), which was also the case for the parent style roman.description before being stored in the table. But when looking for the current parent, the replacement is not made, and hence the parent style is not found.

Solution: activate the statement with the comment for replacing the dot in the snippet above, then the parent style is found and the attributes are correctly inherited.

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers