Quote:
Originally Posted by playful
A bit of a Sigil-noobie question.
Working with 1000+ html files.
Each has a proper title tag such as <title>1 - it all began here</title> but no h1, h2 etc. tags.
Out of the box, when generating the TOC, is there a way to make Sigil take the <title> tags into account?
|
You could do this with 2 Find/Replaces. One to insert the <title> as <h1>, and one to remove the <h1>.
Note: Make sure you turn Sigil into
Regex mode, and make sure you check the box for
Dot All.
* * *
Step 1: Convert <title> into an <h1>:
Find: <title>(.+?)</title>(.+)<body>
Replace: <title>\1</title>\2<body><h1>\1</h1>
Step 2: Press
Tools > Table of Contents > Generate Table of Contents, then create your TOC.
Step 3: Do the opposite. Remove the <h1> we just created:
Find: <body><h1>(.+?)</h1>
Replace: <body>
If you do this often, you can even create a Saved Search for both of those fixes.
Quote:
Originally Posted by JSWolf
The title tags would normally have the book's title and not the chapter title.
|
No. For more extensive discussion on best practices for <title>, see discussion in the
2018 thread "Two questions", especially my Post #2.