![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 97
Karma: 100000
Join Date: Nov 2010
Device: KOA3, KV, KOA2
|
Overwrite CSS during conversion
I think conversion is my best bet for what I want to do, but maybe there's a plugin or another calibre feature I could use.
I download fanfics via a couple of different methods. However, I like them to look the same format-wise. I've determined that manually editing each epub by replacing the CSS from an epub "template" (meaning it looks the way I want) will do the job, at least for the most part. What I want to do is do a bulk conversion (ideally, or I guess single conversion if absolutely necessary) and do this type of CSS replacement. I've tried placing the wanted CSS in the extra CSS both converting from epub to epub and from mobi to epub but while there are some changes, it's still not the way I want it to look. I did some looking around the forum and the extra CSS or manually editing the epub CSS were the only ways I found. If anyone has a suggestion I'd be grateful. Thanks! Riothamus |
![]() |
![]() |
![]() |
#2 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,665
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
The only way to get your fanfics to look consistent is to hand edit the code yourself. Chances are the CSS will be different and changing with with a fixed CSS won't work as the class names would be different and you won't know what they do. So really get to learning HTML/CSS to be able to hand edit your fanfics.
|
![]() |
![]() |
![]() |
#3 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,586
Karma: 14328510
Join Date: Nov 2019
Device: none
|
JSWolf's answer assumes that your CSS is using classes. My CSS only specifies html tags; e.g.,
Code:
body { font-size: 100%; border: 0; margin: 0; padding: 0; width: auto; } body * { line-height: inherit; } p { font-size: 100%; margin: 0; padding: 0; border: 0; text-indent: 2em; } a { color: inherit; text-decoration: none; } h1,h2,h3,h4 { text-align: center; } .bold { font-weight: bold; } .italic { font-style: italic; } .bold_italic { font-weight: bold; font-style: italic; } img { margin-left: auto; margin-right: auto; max-width: 100%; border: none; } Code:
<p class="calibre1"> My goal is to always have the same left and right margins, same line spacing, and same font size every time I open a book (in other words, they were set in the Kobo). Some things are lost with this, for example, spacing after chapter titles, particularly when fools used the p tag instead of one of the h tags. The one thing I don't want to lose is the bold and italic stuff, so before nuking the book's CSS I search for classes with italic and bold and add those classes to the .bold and .italic (so that the CSS becomes something like ".bold,.calibre8,.calibre12 {"), and the ones that are both bold and italic are added to .bold_italic (and likewise underlined bold gets added to .bold_italic). The regular expression I use for searching for that stuff is "bold|italic|font-weight: [56789]"; some books use font-weight:400 to reset to normal, which isn't necessary with my scheme. So the book's html and all of the classes, spans, and whatnot in the html are untouched. Some books will have spaces between paragraphs by using p tags around a space entity so when I see that nonsense I delete all of those with a global replace. Some use divs instead of ps for the paragraphs so I use Diap's toolbag plugin to replace the divs with ps. Most of the time the epub was converted from the Kindle format. If it was an epub to begin with I do an epub to epub conversion so that calibre can clean the html, fixing inline styles and whatnot. Last edited by hobnail; 09-22-2022 at 09:59 PM. |
![]() |
![]() |
![]() |
#4 | ||
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,665
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Another thing that I see is not done (but if you like it, OK) is there is no widows and orphans of 1 to turn them off. Even if your Kobo has them off, if you ever read this eBook with something that has them on, they will be on. Quote:
Last edited by JSWolf; 09-23-2022 at 03:46 AM. |
||
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Use CSS sheet in conversion | GrosNours | Conversion | 8 | 11-29-2018 10:35 AM |
page_styles1.css after conversion | VirgoGirl | Conversion | 11 | 08-08-2017 12:18 PM |
css code ignored in conversion | barrytatt | Conversion | 2 | 12-26-2014 06:41 AM |
Removing embedded font/overwrite some css? | silentguy | Conversion | 4 | 01-25-2011 12:41 PM |
Additional CSS for conversion | LARdT | Calibre | 6 | 02-18-2010 07:52 PM |