09-13-2017, 12:17 PM | #1 |
Junior Member
Posts: 5
Karma: 10
Join Date: Jun 2017
Device: Kindle
|
Preventing Calibre from rewriting custom HTML in recipe?
I have a recipe which outputs custom HTML. When I convert it to EPUB or MOBI in Calibre, a lot of the HTML gets rewritten. Specifically, a lot of the HTML class names get rewritten. For example
Code:
<div class="foobar"> Code:
<div class="calibre6"> Is there any way to completely prevent Calibre from rewriting or modifying my HTML? Thank You |
09-13-2017, 01:47 PM | #2 |
creator of calibre
Posts: 44,380
Karma: 23766374
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
No, conversion always flattens CSS.
|
Advert | |
|
09-13-2017, 05:40 PM | #3 |
Junior Member
Posts: 5
Karma: 10
Join Date: Jun 2017
Device: Kindle
|
kovidgoyal:
Thank you for your help. If I wanted to disable the CSS flattening in the Calibre code, should I start by looking at the MOBI and EPUB converter code? Or, should I look somewhere else? |
09-13-2017, 10:16 PM | #4 |
creator of calibre
Posts: 44,380
Karma: 23766374
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The conversion pipeline in general depends on CSS flattening. DIsbaling it is no trivial task.
|
09-14-2017, 01:01 PM | #5 |
Junior Member
Posts: 5
Karma: 10
Join Date: Jun 2017
Device: Kindle
|
kovidgoyal:
Is there at least some way to remove the padding, margin, and bullet points from a "<ul>" tag? Right now, I have this: Code:
extra_css = ( """ #foo ul { padding-left: 0px; margin-left: 0px; list-style-type: none; } """ ) Thanks for your help. |
Advert | |
|
09-14-2017, 01:03 PM | #6 |
Resident Curmudgeon
Posts: 76,002
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Use the editor to load the HTML/CSS and split it as needed and then edit as needed and you've got an ePub as you want.
|
09-14-2017, 09:02 PM | #7 |
creator of calibre
Posts: 44,380
Karma: 23766374
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
If you are converting to MOBI, it does not support any CSS. And if you are converting periodicals, then you have to convert to MOBI, since AZW3, which does support CSS, does not support periodicals.
|
09-15-2017, 01:16 AM | #8 |
Junior Member
Posts: 5
Karma: 10
Join Date: Jun 2017
Device: Kindle
|
kovidgoyal:
That is very helpful information. Thank you. Is there a technique by which I could create a Recipe which will not behave as a periodical, so that it can be used with AZW3? |
09-15-2017, 01:42 AM | #9 |
creator of calibre
Posts: 44,380
Karma: 23766374
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Set your output format to EPUB. Then convert the EPUB to azw3, or use the command line ebook-convert tool which can convert .recipe files directly to any format.
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Something is preventing custom upgrades on my jailbroken KPW 5.3.1 | pirl8 | Kindle Developer's Corner | 6 | 02-26-2013 05:55 PM |
Calibre Recipe HTML content differs from raw html of index.html. | krunk | Calibre | 4 | 09-20-2010 09:48 PM |
New to Calibre - Recipe/HTML question | ClairePMR | Calibre | 3 | 07-23-2010 11:53 AM |
Custom Recipe | CABITSS | Introduce Yourself | 2 | 09-22-2009 10:30 AM |
Custom Recipe | CABITSS | Calibre | 3 | 09-22-2009 10:29 AM |