05-05-2016, 04:32 AM | #1 |
Guru
Posts: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
|
Inline STYLE attribute not converted to class
Hi,
I've noticed a small issue when performing a conversion to epub. It seems (at least in some cases) that Calibre is ignoring converting the style attribute to a class, when the attribute is upper case. eg: Code:
<p style="font-weight: bold"> Whereas Code:
<p STYLE="font-weight: bold"> Not sure if this is a bug, or by design. Seems to happen with any ebook with an (x)html source, including AZW. Attached is a sample xhtml file and resulting epub (it does the same for HTML as well). |
05-05-2016, 06:34 AM | #2 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
It's a performance tradeoff, since attributes can occur in large numbers checking for all variations of casing is a big performance hit. Remember that in HTML attributes are case insensitive while in XHTML they are case-sensitive. Because ebooks usually work with XHTML calibre is optimized for that.
|
05-05-2016, 07:13 AM | #3 |
Guru
Posts: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
|
Ah Ok.
It is slightly annoying. Current workaround for the affected ebooks is to open it in the editor and choose "fix HTML" before conversion. I tend to only come across it in some AZW files that obviously do not adhere to XHTML. |
05-05-2016, 07:41 AM | #4 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Use a search and replace expression in the conversion settings to replace
STYLE= with style= |
05-05-2016, 08:11 AM | #5 |
Guru
Posts: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
|
Hey, thanks Kovid. I hadn't thought of doing that.
You may want to edit your post though, you've written it in such a way that the forum software has mistaken your square brackets for vbcode or something and are not visible. The regex came through in my email though. I think you had the brackets the wrong way around as well. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Aura H2O MicroSDHC card class 4 or class 10? | chipro12 | Kobo Reader | 5 | 07-04-2015 02:24 AM |
Feature request: new CSS class from computed style | kat7 | Sigil | 23 | 01-02-2015 01:30 PM |
How to remove multiple class attribute from div | lrui | Recipes | 4 | 08-13-2012 09:47 PM |
Embedded fonts and inline style | paulfiera | Calibre | 4 | 02-26-2012 01:32 PM |
Value of Attribute "Class" is Invalid Error | TFaire | ePub | 2 | 09-23-2011 11:25 AM |