01-11-2024, 08:05 PM | #1 |
Junior Member
Posts: 1
Karma: 10
Join Date: Jan 2024
Device: none
|
Editing CSS by default
Привет,
Есть много книг в формате fb2. 1. В какой формат лучше конвертировать в пакетном режиме и как это сделать? EPUB? 2. Как изменить CSS по умолчанию? 3. Как добавить собственный CSS? [Edited by mod to add: Google Translate: Hello, How to change default CSS, insert custom CSS into all books? Sincerely, Eugene Last edited by pdurrant; 01-12-2024 at 03:45 AM. |
01-19-2024, 08:48 AM | #2 |
A Hairy Wizard
Posts: 3,220
Karma: 19000635
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
I’m not aware of software that will automatically insert text into multiple epubs. You may wish to look at .zip manipulation software and GREP ???
It also seems a fairly simple problem easily solved with a python program. You may be able to find someone to whip that up for you. |
01-19-2024, 11:04 AM | #3 |
Fool
Posts: 421
Karma: 3585252
Join Date: Feb 2003
Device: Kindle: Voyage,PW1,KOA, Kobo: Clara Colour, Nook GLP, Pocketbook verse
|
I may be misunderstanding the question, but I believe that you can set CSS to be added to each Calibre conversion by adding the required CSS to the "Styling" tab of the Look and Feel options or to the "Transform Styles" tab.
|
01-19-2024, 05:24 PM | #4 |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Create new css file. Select all xhtml files in BookBrowser and use right click to link it.
|
01-19-2024, 05:30 PM | #5 | |
Grand Sorcerer
Posts: 11,477
Karma: 230178176
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
|
Quote:
|
|
01-19-2024, 08:58 PM | #6 |
Bibliophagist
Posts: 40,487
Karma: 156983616
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
If you are trying to replace all the current CSS in an ebook with a custom version, please remember that you will have to make sure all the class names match.
For an example, in the last while, I've seen indented paragraphs using CSS classes called indent, para, CO-X04, bodyp, etc. or simply using a <p> making almost impossible to simply replace the old stylesheet with a new stylesheet that will work. |
01-20-2024, 08:24 AM | #7 | |
the rook, bossing Never.
Posts: 12,344
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
You really have to view the ebook in Calibre Editor and it's usually quicker to fix the four CSS for body, first paragraph, chapter heading and images. Sometimes only body and first paragraph, sometimes also verses, quotations, scene separators. I fixed an ebook yesterday that ONLY had divs for headings, first paragraph, colophons, body paragraph etc. Everything! Didn't take long to edit CSS and change 'div' variously to 'p' or 'h2'. Adding my own custom CSS would have done nothing. Also every CSS except headings had 'left' justified and 'small' font (instead of say 1em). There were 184 unused CSS removed by Calibre Editor. |
|
01-20-2024, 11:46 AM | #8 |
Fool
Posts: 421
Karma: 3585252
Join Date: Feb 2003
Device: Kindle: Voyage,PW1,KOA, Kobo: Clara Colour, Nook GLP, Pocketbook verse
|
Of course, it all depends on what you wish to accomplish. The OP seemed to want bulk changes. Calibre's conversion option works well for that. And, if you don't care about the risks of inadvertent problems, the use of the !important qualifier can make unexamined original CSS irrelevant.
I used this in the early days to convert all ebooks to bold. It overrode existing bold declarations so you couldn't see the intended emphasis, but it made it possible for me to read the text. (Now of course, ereader screens are better, you can usually select bold-ish fonts or modify boldness levels on the device.) |
01-20-2024, 01:00 PM | #9 | |
Grand Sorcerer
Posts: 11,477
Karma: 230178176
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
|
Quote:
Last edited by Sirtel; 01-20-2024 at 01:08 PM. |
|
01-20-2024, 01:01 PM | #10 | |
Grand Sorcerer
Posts: 11,477
Karma: 230178176
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
|
Quote:
|
|
01-20-2024, 01:10 PM | #11 |
the rook, bossing Never.
Posts: 12,344
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
I do remove line-height and white-space on ALL ebooks added to calibre by conversion, even epub-epub.
Also if it's from gutenberg or similar I add extra conversion options, such as smarten punctuation, remove paragraph spacing and add indents (mostly only changes body text). Gutenberg mysteriously offiically believes in typewriter quotes and spaced paragraphs, but they did launch etexts in 1972 and neither unicode (after 1987) nor CSS (approx 1996) nor HTML (1990 approx) were invented till later. Though Hypertext is maybe before 1980s, see Project Xanadu, Dynabook, Futurenet CAD/CAE and Apple Hypercard. Then if it's a publisher I've not seen before I take a quick look in the viewer. I guess I'm lazier than you as I only edit some ebooks! IMO '!important' in a published ebook is an example of bad design. Also some ebook designers try to do too clever layout, maybe aided by media queries; again it's a poor design decision. It's not paper, so KISS applies. They have no control over ereader or app used. Last edited by Quoth; 01-20-2024 at 01:15 PM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Editing default blank HTML file | WV-Mike | Sigil | 3 | 07-14-2023 07:28 PM |
default css of sigil | valarcher | Sigil | 8 | 07-25-2022 04:10 PM |
Patching vs. editing CSS for W/O and Breaks | fabianmoreno01 | Kobo Developer's Corner | 2 | 03-11-2022 07:55 AM |
Calibre 2.0 problem editing CSS | BobC | Editor | 14 | 08-24-2014 04:02 PM |