![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
fixing up chapter numbers
i often find books that have chapter starts as numbers in bold, and i need them to be in H1 or H2 tags in order to calibre to detect and build TOC.
is there any sigil - regex find replace command that could pick out lines like Code:
<p class="calibre8"><span class="calibre3 bold">7</span></p> Code:
<h2>7</h2> the numbering of the calibre tags varies from book to book but I'm happy to set those up once per book the construction p class="calibre8"><span class="calibre3 bold" does not occur outside of chapter headers so that can be replaced with h2, but I then have to also replace the end of string p with h2 & that is what has me beat. Last edited by cybmole; 01-11-2011 at 01:30 PM. |
![]() |
![]() |
![]() |
#2 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 490
Karma: 1665031
Join Date: Nov 2010
Location: Vancouver Island, Nanaimo
Device: K2 (retired), Kobo Touch (passed to the wife), KGlo, Galaxy TabPro
|
Find:
<p class="calibre8"><span class="calibre3 bold">([0-9])</span></p> Replace: <h2>\1</h2> This will do chapters 1-9. For Chapters 10+ Find: <p class="calibre8"><span class="calibre3 bold">([0-9][0-9])</span></p> Replace: <h2>\1</h2> |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,981
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
or
<p class="calibre8"><span class="calibre3 bold">(\d+)</span></p> for any number of digits in a row. |
![]() |
![]() |
![]() |
#4 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 490
Karma: 1665031
Join Date: Nov 2010
Location: Vancouver Island, Nanaimo
Device: K2 (retired), Kobo Touch (passed to the wife), KGlo, Galaxy TabPro
|
|
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
thanks guys - I am slowly getting the hang of regex find+replace.
this is useful for books which have chapters within sections/parts as calibre's structure detect only puts the main sections into TOC ( unless chapters numbers are converted to h2 tags as per this thread) |
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fixing Up Typography | ahi | Workshop | 65 | 11-18-2013 04:35 AM |
Ebook chapter titles: with or without chapter number? | amoroso | Writers' Corner | 16 | 06-14-2011 06:35 AM |
Is there a hack for displaying page numbers rather than location numbers? | nesler | Kindle Developer's Corner | 16 | 02-15-2011 12:00 AM |
Next Chapter skips to End in last chapter? | JoGoCo | Kobo Reader | 5 | 07-13-2010 09:23 PM |
K2 v K1: Chapter-to-chapter missing from some books? | Starhawk | Amazon Kindle | 4 | 03-10-2009 06:27 PM |