04-13-2020, 08:06 AM | #1 |
Junior Member
Posts: 1
Karma: 10
Join Date: Apr 2020
Device: Kobo Clara HD
|
Footnotes being detected as chapters
Hi everyone,
I'm converting an html page to epub that contains the title of the document inside an h1 on the html header and the chapter titles inside <h2> tags, but there is not attribute that contains the words ('chapter', 'section' etc.). So I changed the XPath expression that detects chapters into this Code:
//*[((name()='h1' or name()='h2') and re:test(., '[a-z]+', 'i'))] This rule worked well but It added the title of the book to the table of contents, resulting in a section without content. To avoid that I removed the 'h1' from the expression. Code:
//*[(name()='h2' and re:test(., '[a-z]+', 'i'))] The structure of the HTML is something like this: Code:
<section> <h2 style="text-align: justify;"><a name="cap1"><strong>Lorem Ipsum</strong></a></h2> <p style="text-align: justify;">Mauris egestas vestibulum eros convallis sodales. Curabitur semper sapien quis tellus tempor ultrices. Donec sagittis pellentesque metus, in tempus velit. Suspendisse consectetur pretium erat vel consequat. </p> .... <footer> <font size="-1"> <p style="text-align: justify;"><a href="#_ftnref1" name="_ftn1">[1]</a> Maecenas eu scelerisque justo, sed tristique dolor. </p> ... </font> </footer> </section> Code:
//h:section/h:h2 |
04-13-2020, 08:20 AM | #2 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
This is because your expression is not matching anything and calibre is fallign back to links. You need to use local-name() to match bare tag names without namespace for instance.
|
Tags |
footnotes, sections, table of contents, xpath |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Keep footnotes in the chapters during conversion. | Chaim.Bar-Ilan | Conversion | 6 | 08-12-2023 11:25 AM |
chapters opening as pop-up footnotes | Fedwin | Calibre | 5 | 11-23-2014 12:25 AM |
Footnotes added to TOC, and levels not detected | eggheadbooks1 | Conversion | 2 | 05-10-2011 01:11 AM |
azw to mobi: Not detecting chapters/page break at chapters and no TOC | RachDvn | Calibre | 3 | 01-16-2011 09:53 AM |
Getting Chapters detected Properly | gandor62 | Calibre | 11 | 06-02-2010 09:31 PM |