Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 04-08-2012, 01:04 AM   #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
Wink xpath exp for just roman unumerals as Chapter headings

I need an xpath for just roman numerals to put in "Structure Detection" > "Detect Chapters at" part of the conversion dialog. Each Chapter heading is on a line by itself and consists of just a roman numeral.Thanks,
Paul
p3aul is offline   Reply With Quote
Old 04-08-2012, 01:58 AM   #2
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,892
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Quote:
Originally Posted by p3aul View Post
I need an xpath for just roman numerals to put in "Structure Detection" > "Detect Chapters at" part of the conversion dialog. Each Chapter heading is on a line by itself and consists of just a roman numeral.Thanks,
Paul
I don't have an xpath for you, but do have a shot in the dark that might work. Try enabling Heuristic Processing and checking the Detect and markup unformatted chapter headings and sub headings.

Good Luck.
DoctorOhh is online now   Reply With Quote
Advert
Old 04-08-2012, 02:47 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
Thanks, but that was the first thing tried. I've never really had much luck with Heuristic Processing. What seems logically simple, HP just ignores.
here is wan example of the first chapter:
I: In which Two Men go forth and One Arrives

What could be more obvious than a Roman Numeral?
This is the latest thing I've tried:
//*[re:test(., '^[I-XXIII]+:$')]
p3aul is offline   Reply With Quote
Old 04-08-2012, 04:48 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,977
Karma: 5183568
Join Date: Mar 2006
Location: Mississippi, USA
Device: Kindle 3, Kobo Glo HD
Quote:
Originally Posted by p3aul View Post
here is wan example of the first chapter:
I: In which Two Men go forth and One Arrives

What could be more obvious than a Roman Numeral?
This is the latest thing I've tried:
//*[re:test(., '^[I-XXIII]+:$')]
The "$" matches the end of a line, which isn't right here. Try
Code:
//*[re:test(., '^[IXV]+:')]
There is no need to repeat elements in the "[ ]" list and "I-X" means all characters from I to X. If you want a "-" put it at the end of the list.
wallcraft is offline   Reply With Quote
Old 04-08-2012, 05:16 AM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,919
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
I would include 'LC' in your set of possible Roman numerals (50,100) for other books that have more that 39 chapters (XL onwards)
theducks is online now   Reply With Quote
Advert
Old 04-08-2012, 01:22 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
Hi Wallcraft! once again you've come through for me! I like your suggestion also, "theducks"!

My reason for putting in the dash was to include numerals from I(1) to XXIII(23) in case the chapters went that high. I knew they didn't go above XXIII. and all I had to use was a previous xpath statement you gave me: //*[re:test(., '^CHAPTER [I-XXIII]+$')] so I deleted "CHAPTER"

In the case of the xpath above, wallcraft, you only used one set of RN; IXV but the program detected all the chapters in the book which went up to XVIII. Why did it do that? I'm confused. Why wouldn't my "I-XXIII" work?
Thanks,
Paul
p3aul is offline   Reply With Quote
Old 04-08-2012, 01:33 PM   #7
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
OH, I think I see! Does the "IXV" mean all characters that are I or X or V ? Well I have another xpath to add to my list!

Last edited by p3aul; 04-08-2012 at 01:35 PM. Reason: self-applied power to my lightbulb!
p3aul is offline   Reply With Quote
Old 04-08-2012, 01:50 PM   #8
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,977
Karma: 5183568
Join Date: Mar 2006
Location: Mississippi, USA
Device: Kindle 3, Kobo Glo HD
Quote:
Originally Posted by p3aul View Post
In the case of the xpath above, wallcraft, you only used one set of RN; IXV but the program detected all the chapters in the book which went up to XVIII.
The "+" means one or more instances of the preceding character, which (from the []) can be an I or a X or a V. As theducks said, [IXVLC] would cover more cases.
wallcraft is offline   Reply With Quote
Old 04-08-2012, 04:30 PM   #9
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
Thanks all! I've been collecting all these xpath statements in a file I call Calibre tips and tricks. I'mm also learning a little about xpath along the way.
Paul
p3aul is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter Headings Paxman53 Conversion 3 10-12-2011 12:31 PM
Why H1 and H2 Chapter Headings? Ransom Calibre 11 08-10-2011 04:29 PM
Help converting chapter headings p3aul Conversion 6 04-03-2011 12:56 PM
Xpath expression for detecting chapter marks p3aul Calibre 5 11-14-2010 11:14 PM
xpath for chapter detection romnempire Calibre 7 07-26-2010 05:34 PM


All times are GMT -4. The time now is 08:04 PM.


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