Quote:
Originally Posted by Turtle91
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.
|
Removed redundant CSS can also be done with the source software. calibre can remove extra CSS without a plugin as it's a built-in function of the editor.
As for Death, the eBooks having him speaking in all caps but uses smallcaps instead of lowercase. So in order to make sure this works in all cases, a smaller font size is used instead of small caps in CSS. If you use
font-variant: small-caps instead of a smaller font size, you can spoil the effect in programs that do not support small-caps.
If you decide to use small-caps, you have to make sure that it's OK when it doesn't work. For example, 3P.M. will be OK if they are not in small-caps. Death speaking will not be OK.
As for the regex example, that can be done (and more) with Diaps Editing Toolbag. It's a plugin for calibre editor and Sigil. I use it a lot.