Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 05-05-2016, 04:32 AM   #1
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
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">
replaces the inline style with a class.

Whereas
Code:
<p STYLE="font-weight: bold">
the style remains inline.


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).
Attached Files
File Type: zip calibre_test_xhtml.zip (33.0 KB, 80 views)
sherman is offline   Reply With Quote
Old 05-05-2016, 06:34 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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.
kovidgoyal is offline   Reply With Quote
Old 05-05-2016, 07:13 AM   #3
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
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.
sherman is offline   Reply With Quote
Old 05-05-2016, 07:41 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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=
kovidgoyal is offline   Reply With Quote
Old 05-05-2016, 08:11 AM   #5
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
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.
sherman is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 09:07 PM.


MobileRead.com is a privately owned, operated and funded community.