Quote:
Originally Posted by cybmole
i did something similar one time. I used regex to "find" the number bit of the ID tag which was in each file, and which already incremented, then "replaced" that into the chapter heading location. so you have any such tags to work from ?
|
Unfortunately, Sigil only adds ids to heading tags, if there are multiple heading tags in a file.
@Keeth: You'll have to outsmart Sigil and make it add sequential ids to each heading tag. Assuming that each chapter is a separate .html file and contains only one heading tag at the beginning of the file, for example
<h3>Chapter</h3> do the following:
1. Replace all
<h3>Chapter</h3> with
<h3>Chapter</h3><h4>Chapter</h4>.
2. Regenerate the TOC. You should end up with:
<h3>Chapter</h3><h4 id="sigil_toc_id_1">Chapter</h4> for the first chapter.
3. Replace all
<h3>Chapter</h3> with nothing. I.e. delete them.
4. Now you can finally add the chapter numbers. Change the mode to Regex and use the following expressions:
Find:
<h4 id="sigil_toc_id_(\d+)">(.*?)</h4>
Replace:
<h3 id="sigil_toc_id_\1">\2 \1</h3>
5. Regenerate the TOC.