![]() |
#1 |
calibre/Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,451
Karma: 1838452
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis, iPad Pro
|
Inline css not handled correctly by HTML to epub?
I've got some single html files which have the css embedded within a style tag at the top, rather than a separate css file. I drop it into Calibre and it converts to a zip, everything still fine. However when I then convert to EPUB, Calibre seems to not find the css class (or at least some of them), and this results in the content being wrapped in <span> type tags with no class.
If however I take the time to move the style css into a separate .css file with a <link> element to it, and repeat the whole process, Calibre does the desired nice conversion, and those same span tags now have a class specified. Is this expected behaviour or should I open a ticket? EDIT: Of course I run the latest Calibre from source, currently 0.7.53 Last edited by kiwidude; 04-03-2011 at 10:22 PM. |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
I don't think that's expected, I rarely use inline css, but when I have it's always worked fine. I noted you qualified that 'some of them' were not found - was there something different about the classes that failed?
|
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,460
Karma: 48895676
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
|
|
![]() |
![]() |
![]() |
#4 |
calibre/Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,451
Karma: 1838452
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis, iPad Pro
|
@idolse - I said "some of them" as a qualifier because I didn't check all the styles to see which did/didn't appear.
Here is the original stylesheet that is inlined. The span.small-caps and span.largecap were the two that I initially noticed: Spoiler:
Here is an example paragraph before conversion from further down the doc: Code:
<p class="first"><span class="largecap">W</span><span class="small-caps">hen all Siniava’s troops had surrendered</span>, Kieri Phelan’s troops assumed... Code:
<div class="center"> <p class="center1"><span>W</span><span>hen all Siniava’s troops had surrendered</span>, Kieri Phelan’s troops assumed... Spoiler:
Note that it also affects how "well" the document is split etc in terms of chapter breaks. You end up with both lost styles and a document that needs a lot more manual cleanup work to get split as one chapter per file etc. If instead I move all that css above into a separate .css file linked before importing, this is the result after conversion of that same paragraph: Code:
<div class="letterbody"> <p class="first1"><span class="largecap">W</span><span class="small-caps">hen all Siniava’s troops had surrendered</span>, Kieri Phelan’s troops assumed... Spoiler:
|
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
This looks like a bug with the class names changing like that. But I've seen things that sort of look like bugs with css normalization actually not be bugs in the past.
Was the div with class="center" in your original code, or is this created where Calibre split the files? Also were there any settings in extra css, or was that empty? Smallcaps isn't really supported in the epub spec, so there is a small possibility there is also some special casing code coming into play here. |
![]() |
![]() |
Advert | |
|
![]() |
#6 | ||
calibre/Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,451
Karma: 1838452
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis, iPad Pro
|
Quote:
Quote:
I will raise a ticket and attach the document to it. |
||
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Agree that a ticket is probably the best approach - if you didn't have anything in extra css that basically confirms you weren't throwing any special wrench in the gears (extra css is usually the cause when I've done this sort of thing to myself). The fact that the css class names were changing/being moved around along with the actual contents of the class changing seems to indicate a bug.
|
![]() |
![]() |
![]() |
#8 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 42,325
Karma: 19574690
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
If you're seeing a difference when the css is inline vs. in a separate file there are two likely candidates:
1) A parsing problem inline css is first parsed by an XML parser and then by a css parser 2) A cascading issue, the inheritance rules for css are slightly different in these cases. |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
epub code snippets (html / css) | zelda_pinwheel | ePub | 196 | 10-09-2016 04:21 AM |
HTML/CSS for (German) s p a c e d o u t emphasis | frabjous | Workshop | 21 | 05-16-2011 04:52 PM |
Another ePub does not display correctly. | KjellM | EPUBReader | 7 | 07-16-2010 03:31 AM |
HTML and CSS for Dummies | weedfreak | Sigil | 17 | 01-07-2010 09:34 PM |
Problems generating ePub from HTML/CSS | AlexBell | Calibre | 3 | 07-17-2009 05:10 AM |