Ticket #4418 (closed defect: fixed)
epub: calibre overwrites list-style: none with list-style-type: disc
| Reported by: | minstrel | Owned by: | kovidgoyal |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | EPUB Output | Version: | trunk |
| Keywords: | list-style, list-style-type, epub | Cc: |
Description
Problem:
The following problem occurs when converting from HTML to epub:
My HTML file contains an unordered list <ul> which has been styled using the "list-style: none" attribute. According to ?http://xhtml.com/en/css/reference/list-style-type/, "list-style" is a shorthand property for simultaneously specifying several "list" attributes, including "list-style-type".
When generating epub output, Calibre copies over the "list-style: none" from the input CSS, but additionally adds an attribute "list-style-type: disc".
This leads to a wrong list-style (discs are being rendered although originally it was specified that the list marker should be omitted)
Analysis:
It seems that Calibre is adding a "default" list-style-type to the style definition.
Proposal:
Alternative A)
Instead of BOTH copying over the original "list-style: none" attribute AND adding the "list-style-type: disc", Calibre should either analyze the "list-style" shorthand definition and break it down into atomic definitions (e.g. "list-style-type", "list-style-position" and "list-style-image").
Alternative B)
Calibre should analyze whether a specified "list-style" contains one of the allowed "list-style-type" literals; if this is the case, the "list-style-type: disc" specification WILL NOT be written to the output file.
Example: (code snippets)
Input from original HTML file:
ul {
list-style-type: none;
margin-left: 0em;
margin-bottom: 0em;
padding-left: 1.5em;
text-indent: -1.5em;
}
ul.conspirators {
margin-left: 3em;
}
Calibre output (stylesheet.css):
.conspirators {
display: block;
list-style: none;
list-style-type: disc;
margin-bottom: 0;
margin-left: 3em;
margin-right: 0;
margin-top: 1em;
padding-left: 1.5em;
text-indent: -1.5em
}
usage in the HTML:
<ul class="conspirators"> <li>Robert Catesby,</li> <li>Robert Winter</li> </ul>
