09-30-2010, 11:15 PM | #1 |
Captain Courageous
Posts: 239
Karma: 102
Join Date: Apr 2009
Device: calibre, PRS 505
|
can calibre creat a TOC by reading numerals as chapter marks
I have a rather long book in txt format and I don't want to go to the hassle of putting two # marks in from of each numbered chapter in order to use --markdown. I wonder if I could use xpath statement to detect numerals on a line by themselves as chapter marks. If so could someone tell me how to format them?
Thanks P3aul (pronounced "Paul", the 3 is silent) |
09-30-2010, 11:26 PM | #2 |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Try enabling preprocessing under structure detection when you do the conversion. You'll also need to change the chapter detection xpath to look for \d+ instead of Chapter|Part, etc
|
Advert | |
|
10-03-2010, 02:12 PM | #3 |
Captain Courageous
Posts: 239
Karma: 102
Join Date: Apr 2009
Device: calibre, PRS 505
|
Can you tell me the exact location in pref to do this?
Thanks, Paul |
10-03-2010, 04:03 PM | #4 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
It's in the structure detection part of the conversion settings.
|
10-03-2010, 09:49 PM | #5 |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
You'll also need to change the chapter detection xpath. Change the default to this:
Code:
//h:h2[re:test(., "\d+", "i")] Last edited by ldolse; 10-03-2010 at 09:53 PM. |
Advert | |
|
10-04-2010, 03:51 AM | #6 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
|
10-04-2010, 04:03 AM | #7 | |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Quote:
The default chapter detection xpath is: Code:
//*[((name()='h1' or name()='h2') and re:test(., 'chapter|book|section|part\s+', 'i')) or @class = 'chapter'] You could just change one part of the xpath - 'chapter|book|section|part\s+' to '\d+' or '.*', but I used the xpath wizard, which spit out the xpath I posted previously. |
|
10-04-2010, 04:18 AM | #8 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
tips for research reading- notes/search/marks | 1611mac | General Discussions | 6 | 07-13-2010 12:14 PM |
Les Miserables - TOC / Chapter Flags? | gshipley | Amazon Kindle | 1 | 09-28-2009 10:07 PM |
ADE and long chapter names in ToC | frabjous | Reading and Management | 3 | 08-14-2009 11:16 AM |
Chapter or TOC Creation help needed | gandor62 | Calibre | 4 | 04-15-2009 02:18 PM |
html2epub TOC and chapter detection help | ilovejedd | Calibre | 6 | 02-22-2009 05:58 PM |