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 10-26-2011, 09:08 PM   #1
hymie
Enthusiast
hymie began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Oct 2011
Device: iPhone
class="none" vs class="none1"

Greetings.

I am trying to use Calibre to convert an e-book with lousy chapter marks.

A chapter is marked with
<span class="none">

However, there are other parts of the book (italic text) which are marked with
<span class="none1">

I'm trying to get an XPath that recognizes the difference.

//h:span[re:test(@class, "none", "i")] matches both sets
//h:span[re:test(@class, "none\b", "i")] matches both sets
//h:span[re:test(@class, "none$", "i")] matches nothing
//h:span[re:test(@class, '"none"', "i")] matches nothing

//h:span[re:test(@class, "["]none["]", "i")] is an invalid XPath
//*[@class="none"] matched nothing
//h:span[@class="none"] matched nothing

How can I properly find my chapters?

Thanks.

--hymie!
hymie is offline   Reply With Quote
Old 10-26-2011, 09:11 PM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,571
Karma: 145863177
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by hymie View Post
Greetings.

I am trying to use Calibre to convert an e-book with lousy chapter marks.

A chapter is marked with
<span class="none">

However, there are other parts of the book (italic text) which are marked with
<span class="none1">

I'm trying to get an XPath that recognizes the difference.

//h:span[re:test(@class, "none", "i")] matches both sets
//h:span[re:test(@class, "none\b", "i")] matches both sets
//h:span[re:test(@class, "none$", "i")] matches nothing
//h:span[re:test(@class, '"none"', "i")] matches nothing

//h:span[re:test(@class, "["]none["]", "i")] is an invalid XPath
//*[@class="none"] matched nothing
//h:span[@class="none"] matched nothing

How can I properly find my chapters?

Thanks.

--hymie!
Are these spans of none and none1 only used for the chapter headers? If so, do a regex to replace the <span> and associated </span> with <h2> and </h2>. Then the xpath for h2 will work.
JSWolf is online now   Reply With Quote
Advert
Old 10-27-2011, 06:45 AM   #3
hymie
Enthusiast
hymie began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Oct 2011
Device: iPhone
Smile solved [class="none" vs class="none1"]

Quote:
Originally Posted by JSWolf View Post
Are these spans of none and none1 only used for the chapter headers? If so, do a regex to replace the <span> and associated </span> with <h2> and </h2>. Then the xpath for h2 will work.
There's more to the story, but with your advice, I just figured it out.
  • Take my original RTF (I left that out of my first post)
  • set the output to HTMLZ
  • set "how to handle CSS" to "tag"
  • convert the RTF to HTMLZ
  • take the HTMLZ
  • set "detect chapters at" to //h:b
  • convert the HTML to EPUB

Thanks.

--hymie!
hymie is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Value of Attribute "Class" is Invalid Error TFaire ePub 2 09-23-2011 11:25 AM
Feature Request: configurable space setting for "Insert blank line" in "Look & Feel" therealjoeblow Calibre 15 07-25-2011 03:14 PM
How do you remove class="whitespace"? greenlees Conversion 8 07-03-2011 02:54 AM
Changing or removing <div class="calibrenavbar"> ptsefton Recipes 3 05-28-2011 08:30 AM


All times are GMT -4. The time now is 06:20 PM.


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