View Single Post
Old 02-11-2024, 09:09 AM   #96
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,361
Karma: 20212223
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
There isn’t going to be a completely automatic tool to do that, but there are a lot of different tools to do specific things. You just need to learn to use those tools.
  • Moving all inline styles into a shared CSS file source software or plug-in
  • Only using classes/ids to style the exceptional cases, not the normal cases regex
  • Removing redundant declarations from the CSS file plug-in
  • Using more semantic HTML - from <div class="para"> to <p> for example regex
  • ... others?

The software authors use to create the book SHOULD have the option to export using a css stylesheet instead of inline styling. If you don’t have access to the source file then Sigil (or Calibre IIRC) have plugins that can do that.

Regular expressions (regex) is a type of advanced search that you can use to find/replace phrases/text. It can easily make hundreds, or thousands, of changes in seconds. Just remember, with great power comes great risk (or something like that ). It can totally wreck your text if you make a mistake - so save/backup early and often.
Calibre has a built-in tool called Regex Functions that can do Title Case (Sigil has a plug-in). As Quoth mentioned, DEATH speaks in all caps, but a regex wouldn’t know the difference between DEATH speaking and any other smallcaps. You, the coder, needs to make that distinction when you use the tools. (I haven’t read all the discworld books, but I don’t remember them specifying that he HAD to use all caps - it could be that was the only kind of typography they had to use at the time to give it that importance???)

Regex example:
Find: <div class="para">(.*?)</div>
Replace: <p>\1</p>

You can easily change the styling in the css stylesheet.
Turtle91 is offline   Reply With Quote