Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 11-13-2010, 10:55 PM   #1
p3aul
Captain Courageous
p3aul doesn't litterp3aul doesn't litter
 
p3aul's Avatar
 
Posts: 239
Karma: 102
Join Date: Apr 2009
Device: calibre, PRS 505
Post 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
p3aul is offline   Reply With Quote
Old 11-13-2010, 11:11 PM   #2
wallcraft
reader
wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.
 
wallcraft's Avatar
 
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]+$')]"
The "^" is for start of line, "[0-9]" is a digit, "+" is one or more instances, "$" is end of line.
wallcraft is offline   Reply With Quote
Advert
Old 11-14-2010, 12:43 AM   #3
p3aul
Captain Courageous
p3aul doesn't litterp3aul doesn't litter
 
p3aul's Avatar
 
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
Attached Thumbnails
Click image for larger version

Name:	error2.jpg
Views:	343
Size:	180.2 KB
ID:	61176  
p3aul is offline   Reply With Quote
Old 11-14-2010, 01:22 AM   #4
wallcraft
reader
wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.
 
wallcraft's Avatar
 
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.
wallcraft is offline   Reply With Quote
Old 11-14-2010, 05:09 AM   #5
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by p3aul View Post
Well, I just got an error and it wouldn't compile.
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").
Manichean is offline   Reply With Quote
Advert
Old 11-14-2010, 11:14 PM   #6
p3aul
Captain Courageous
p3aul doesn't litterp3aul doesn't litter
 
p3aul's Avatar
 
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.
p3aul is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 09:43 PM.


MobileRead.com is a privately owned, operated and funded community.