I have a difficulty with a badly formatted epub book.
It has few files, no TOC and no tagged chapter headings.
The chapters as text are *1* *2* etc without the quotes and nothing to hang a TOC on.
The code for the headings is
Code:
<p class="calibre11"><b class="calibre10"><span lang="EN-US" class="calibre1">*1*</span></b></p>
I have managed to devise a regex to find all the chapter headings and tag as h2 now the problems arise.
Code:
To find (\*[0-9]+\*) to replace <h2>\1</h2>
In their natural state the headings are centred but using the calibre editor they become left aligned because the h2 tags are placed around the text only. This is what I get:
Code:
<p class="calibre11"><b class="calibre10"><span lang="EN-US" class="calibre1"><h2>*1*</h2></span></b></p>
If I manually find the headings and use the drop down list of tags I get the same code. If, however, I use Sigil and manually find the heading and use the h2 button the heading stays centred and sized as original and the code I get is:
Code:
<h2 class="calibre11"><b class="calibre10"><span class="calibre1" xml:lang="EN-US">*1*</span></b></h2>
I can see two possible solutions to keep the headings centred and use calibre editor. Neither of which do I know how to do.
1. Edit the formatting of h2 how is that done?
2. Formulate the regex to include all from <p to /p> and replace it with code like that produced by Sigil
Any and all helpful suggestions will be appreciated.
The more I learn, the more I realise I dont know.