09-29-2024, 11:37 AM | #1 |
Evangelist
Posts: 413
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
TOC h2: h3
If I have an ebook where chapter titles are
Code:
<h2>Chapter 1</h2> <h3>Title of C1</h3> Code:
Chapter 1: Title of C1 Generate TOC from headings doesn't quite do this. I feel I'm missing something obvious. EDIT: Is there a way to have the TOC be a bit different from the text in the heading, for example "1: Title" while in the text it's "Chapter 1: Title". Or to add a word throughout the TOC. Last edited by foosion; 09-29-2024 at 03:04 PM. |
09-29-2024, 02:24 PM | #2 |
Enthusiast
Posts: 46
Karma: 10
Join Date: Aug 2018
Location: Paris (France)
Device: Kobo Kindle Vivlio-Inkpad3
|
Why not write simply this :
Code:
<h2>Chapter 1<br/><span class="small">Title of C1</small></h2> ... <h2>Chapter 2<br/><span class="small">Title of C2</small></h2> ... Code:
span.small{ font-size: 90%; /* or the whole character format you want to give to h3 */ } |
Advert | |
|
09-29-2024, 03:03 PM | #3 |
Evangelist
Posts: 413
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
That's basically what I ended up doing. I was hoping there was a way to combine different headings.
I edited the OP to ask another question. |
09-29-2024, 03:13 PM | #4 |
Well trained by Cats
Posts: 30,409
Karma: 58055234
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
<h2 class-"whatever" title="the real words for the TOC">
A little REGEXfoo and you can build the title= bit |
09-29-2024, 03:14 PM | #5 |
Wizard
Posts: 1,337
Karma: 6700864
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
I normally use...
PHP Code:
For your second question, use the title="" property PHP Code:
|
Advert | |
|
09-29-2024, 03:32 PM | #6 | |
Evangelist
Posts: 413
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
My regex was: Search: Code:
<p class="cn" id=".*?">(.*?)</p>\ <p class="ct">(.*?)</p> Code:
<h2>\1: \2</h2> |
|
09-29-2024, 03:35 PM | #7 | |
Evangelist
Posts: 413
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
Please explain or link the title="" property. As I mention above, when I search I just find <title>. |
|
09-29-2024, 03:50 PM | #8 | |
Wizard
Posts: 1,337
Karma: 6700864
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Yes. Sorry. I missed the crux of your comment. Then I would use the title="" attribute for the full TOC entry.
PHP Code:
Quote:
|
|
09-29-2024, 04:01 PM | #9 |
Wizard
Posts: 1,337
Karma: 6700864
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
And your S&R regex will be...
Search: PHP Code:
PHP Code:
|
09-29-2024, 04:01 PM | #10 | |
Evangelist
Posts: 413
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
|
|
09-29-2024, 04:04 PM | #11 |
Bibliophagist
Posts: 39,879
Karma: 154464500
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
If you do a search for say, 'title attribute', you will get quite a few hits. One that you may find useful, IMNSHO, is HTML Global title Attribute.
The title attribute is not the same as the title tag. Sigil and calibre's ebook-editor will use the content of the title="<insert text here>" attribute of the h tag when generating the ToC. In the examples given, you could use regex to extract the text from the h2 and p tags and concatenate them into a title="whatever" as an attribute of the h2 tag. Last edited by DNSB; 09-29-2024 at 04:05 PM. Reason: Edit: once again read to end of thread before replying... |
09-29-2024, 04:16 PM | #12 |
Well trained by Cats
Posts: 30,409
Karma: 58055234
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
You can also use title= when you want a slight different version to appear in a TOC.
PS It is also NEEDED when your chapter title heads are Graphical |
09-29-2024, 05:27 PM | #13 |
Bibliophagist
Posts: 39,879
Karma: 154464500
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
An example of that is one ebook where the author used graphics for the chapter headers. Looked great until you recreated the ToC and either manually edited in the chapter numbers or added them using title=. I ended up selecting all the chapter images and renaming the them into a usable format and then a simple regex did the deal.
<h3 class="chapnum" title="Chapter 18"><img class="glyphw25" src="../Images/chapter_18.jpeg" alt="Chapter 18"/></h3> |
09-29-2024, 11:22 PM | #14 | |
Running with scissors
Posts: 1,557
Karma: 14325282
Join Date: Nov 2019
Device: none
|
Quote:
I think this is similar to what I had used. But it's been years and I've forgotten. There's a chapter numbering plugin for Sigil that I used to generate the "Chapter One" etc. with h1 tags, and then below that I think I had an h2 tag with the descriptive name. Then I used a regex to convert that to something like Code:
<h2>Chapter One <span>Descriptive Title</span></h2> Code:
h2 span, h3 span { display: block; font-size: larger; font-style: italic; font-variant: normal; font-weight: bold; margin-top: 1.25em } If you look for the book Batwing Bowles by Dane Coolidge here in the mobileread library you can see the final result. Both the TOC and the chapter first pages. Last edited by hobnail; 09-29-2024 at 11:25 PM. |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Multiple HTML files w/ TOC to MOBI, not added in order listed in TOC | dysfunction | Conversion | 3 | 01-03-2014 12:40 AM |
Ho do I create a TOC for ePub which does convert to an active TOC in Kindle Previewer | K-Thom | Calibre | 1 | 09-24-2013 06:32 PM |
Kindler previewer not recognizing toc.ncx file, my html toc, or the start point... | petercrowell | Kindle Formats | 2 | 05-01-2012 08:14 AM |
Use Regex to Code an Inline TOC, from an External TOC's .ncx File | mostlynovels | ePub | 2 | 03-16-2011 12:15 PM |
Making a TOC for LRFs? Issues with Calibre + LRF TOC editor not working | Magitek | LRF | 0 | 05-06-2009 01:25 PM |