View Single Post
Old 06-12-2022, 12:59 PM   #6
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by GnRFan79 View Post
Is there a way, say using Calibre’s epub > epub functionality, to remove all of the formatting from an epub, effectively reverting the epub back to absolute basics/default formatting?
In calibre's editor f you delete all of the css in the stylesheet.css file that will do that, although the .xhtml or .html files will have all of the class= stuff still, but after removing the css that will all be ignored. Corner cases would be if they have css in the .xhtml/.html files. Another one that I occasionally bump into is the .xhtml/.html files use divs instead of ps for paragraphs. Also annoying is when they use p tags instead of h tags for the chapter titles but after this stuff the chapter headings are just plain.

After deleting the css from the stylesheet.css you can add your own there, which shouldn't use any classes except for default size bold and italic which you copied and saved from the original css. Here's what I use (compressed to save screen space):

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;}
.italic{font-style:italic;}
.bold{font-weight:bold;}
img{max-width:100%;border:none;}
For the bold and italic I search the original css for classes that have the font size at 100% or 1em and copy the class name and add them to my .italic or .bold. For example it would say .italic, .calibre8{...} if the original css had italic for the calibre8 class.

I'm doing this for my kobo, so I use calibre to convert from the amazon format to epub, and have calibre's settings to set the font size to 1em or 100%. Occasionally I start with an epub so I do an epub to epub conversion. On the kobo the above css gives a ragged right layout, which is what I want.


My objective with all this folderol is to have a consistent line spacing and font size and ragged right. So every time I open a new book I don't need to adjust any of the sliders. The end result isn't pretty but with novels there rarely is any fancy formatting that matters.
hobnail is offline   Reply With Quote