01-26-2024, 10:36 PM | #1 |
Wizard
Posts: 1,085
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Multi-line chapter titles with <br/> and the TOC
I'm finding a lot of chapter titles with a <br/> for a multiline heading
Making a TOC the <br/> is ignored and the lines run together in the TOC Is there RegEx that I can use, but I think it'd be better if the TOC making code just converted <br/> to a space I use the Inline TOC option a lot also |
01-26-2024, 10:40 PM | #2 |
Bibliophagist
Posts: 40,506
Karma: 156983616
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Generally, I add a title="" element to the header tag. I use a simple regex to add the chapter number and text to the title element.
|
01-27-2024, 08:55 AM | #3 |
Guru
Posts: 751
Karma: 1537886
Join Date: Sep 2013
Device: Kobo Forma
|
I use a Saved Search to add a space before all my <br> tags:
Code:
Search: ([a-z.,:;>])<br/> Replace: \1 <br/> |
01-27-2024, 10:33 AM | #4 | |
Well trained by Cats
Posts: 30,443
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
I use the title= method when I want the TOC to be different than the (Chapter) heading |
|
01-27-2024, 04:13 PM | #5 |
Wizard
Posts: 1,085
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Thanks to all --
I added the Hx test since I only wanted this for headings and put it in my Saved Searches Sometimes there's a digit before the br/, e.g. Chapter 1<br/>Going Home Find: <([Hh][1-6])>(.*?)<br/>(.*?)</\1> Replace: <\1>\2 <br/>\3</\1> (space before the br/ ) It'll probably fail for a 3 line header IMHO a better solution would be for the TOC module just change <br/> to space |
01-27-2024, 06:42 PM | #6 |
Guru
Posts: 751
Karma: 1537886
Join Date: Sep 2013
Device: Kobo Forma
|
Good point about the digit (especially for chapter headers). I've updated my saved search to include that:
Code:
([a-z\d.,:;>])<br/> Actually, now that I think about it, that search should probably be for any non-whitespace character before the <br/> (at least I can't come up with a reason where that wouldn't work): Code:
(\S)<br/> |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Repeated chapter titles using TOC tool | okonek | Calibre | 9 | 12-10-2018 09:36 AM |
Chapter numbers / titles in ToC | ts0329 | Conversion | 4 | 02-08-2016 12:13 AM |
Ebook chapter titles: with or without chapter number? | amoroso | Writers' Corner | 16 | 06-14-2011 07:35 AM |
Multi-Level TOC | edbro | Calibre | 4 | 09-16-2010 07:54 PM |
Chapter import in the multi-flow redesign | ghostyjack | Sigil | 1 | 10-23-2009 11:30 AM |