11-13-2010, 10:55 PM | #1 |
Captain Courageous
Posts: 239
Karma: 102
Join Date: Apr 2009
Device: calibre, PRS 505
|
Xpath expression for detecting chapter marks
Can someone create an xpath expression for me to detect chapters that are numbers and are listed on a line by them selves. It must be able to detect both single digits and double-digits. As in:
blah blah blah. 3 more blah blah blah It's important to note that I use ebook-convert ONLY on the command line to do my conversions. With all due respects to the GUI, I prefer the command line. Thanks, Paul |
11-13-2010, 11:11 PM | #2 |
reader
Posts: 6,975
Karma: 5183568
Join Date: Mar 2006
Location: Mississippi, USA
Device: Kindle 3, Kobo Glo HD
|
I have not tested it, but try
Code:
--chapter "//*[re:test(., '^[0-9]+$')]" |
Advert | |
|
11-14-2010, 12:43 AM | #3 |
Captain Courageous
Posts: 239
Karma: 102
Join Date: Apr 2009
Device: calibre, PRS 505
|
Well, I just got an error and it wouldn't compile. Here is a screen shot. Maybe you can see the problem from the error msg.
Thanks, Paul |
11-14-2010, 01:22 AM | #4 |
reader
Posts: 6,975
Karma: 5183568
Join Date: Mar 2006
Location: Mississippi, USA
Device: Kindle 3, Kobo Glo HD
|
There are two --chapter entries, the first one should be removed. The xpath part is in double quotes and it is placed after a single --chapter command line argument.
Last edited by wallcraft; 11-14-2010 at 01:25 AM. |
11-14-2010, 05:09 AM | #5 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
My inner geek forced me to write this: That's not compiling, that's running a program (or failing to do so ). Compiling is the act of turning human-readable program source code into machine code (as in "an executable program").
|
Advert | |
|
11-14-2010, 11:14 PM | #6 |
Captain Courageous
Posts: 239
Karma: 102
Join Date: Apr 2009
Device: calibre, PRS 505
|
Wallcraft: Beautiful! Thank you for pointing out my error, and for providing the code.
UPDATE: Hey, I want you to know that your xpath statement works on roman numeral also! I just substituted those for a book where the chapters were all roman numbers and it worked! Manichean: Code, script? So what's a name? just a label. BTW, I was programming in machine code when you were in diapers! Last edited by p3aul; 11-15-2010 at 06:39 AM. |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
can calibre creat a TOC by reading numerals as chapter marks | p3aul | Calibre | 7 | 10-04-2010 04:18 AM |
xpath for chapter detection | romnempire | Calibre | 7 | 07-26-2010 05:34 PM |
Xpath TOC Expression | Agama | Calibre | 2 | 07-12-2010 02:24 AM |
XPath Expression wizard?? | tonyx3 | Calibre | 1 | 01-26-2010 04:49 AM |
XPath Expression Wizard Error | Crusader | Calibre | 4 | 12-27-2009 12:09 PM |