02-21-2014, 07:38 AM | #1 |
Zealot
Posts: 108
Karma: 810
Join Date: Jul 2012
Device: Kobo
|
xpath to insert chapter breaks - but chapter name cut off ?
This is the first time I've tried using xpath as an ePub-to-ePub Calibre conversion option to insert a page break at the start of each chapter in some books I downloaded.
The problem is that when I Calibre-view the ePub, the first line of each chapter (i.e. the chapter title) cannot be read because the top ~80% of it seems to be cut off. The approach I used was: Convert ePUB to ePUB - Structure Detection - then wizard generated regular expression to insert a page break each time the word "Chapter" appears: //*[re:test(., "Chapter", "i")] The ePub code prior to the change: <p class="calibre2">Chapter 3</p> The ePub code after the change: <?xml version='1.0' encoding='utf-8'?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="generator" content="http://calibre-ebook.com"/> <meta name="creation-time" content="2010-11-18"/> <meta name="revision-time" content="2010-11-18"/> <p> </p> <p> </p> <title>BOOK TITLE (1963)</title> <meta name="author" content="AUTHORS NAME"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <link href="stylesheet.css" rel="stylesheet" type="text/css"/> <link href="page_styles.css" rel="stylesheet" type="text/css"/> </head> <body class="calibre2"> <div class="s1" id="calibre_pb_1"> <p class="calibre3" id="calibre_pb_6">Chapter 3</p> Nothing special in the stylesheet for calibre3 and S1 which are both {border-bottom: 0; border-top: 0; display: block; margin-bottom: 0; margin-top: 0; text-align: left; text-indent: 1.5em; padding: 0}. I noted that the conversion process also inserts a page style sheet with a 5pt top and bottom margin but setting that to zero using Edit Book did not change the readability of the chapter titles. The only solution that I've found so far to not being able to read the chapter title (in this case "Chapter 3") is that if I open the ePub in Sigil (test validation shows no problem) and just re-save the ePub using Sigil, the problem goes away and I can now read the Chapter title (although for some reason the font size for all the content changes too). Thanks for any help on this. |
03-05-2014, 01:36 PM | #2 |
Guru
Posts: 691
Karma: 3026110
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
|
Have you tried using "Inspect" in Calibre's book viewer to discover just what css rules are being applied. I find it is often helpful in showing up conflicts in css rules.
If for instance you have a line-height set as 1em and your chapter's font-size is 1.2em this could cause cut-off. BobC |
Advert | |
|
03-06-2014, 06:59 AM | #3 |
Zealot
Posts: 108
Karma: 810
Join Date: Jul 2012
Device: Kobo
|
accessing Inspect feature in Calibre book viewer
BobC, thank you for mentioning the "Inspect" feature when viewing the ePub. I wasn't aware of the feature, partly because it does not appear as one of the optional menu icons on the left, but I now see that the feature is accessible for a particular page, by right-clicking when viewing the page. That will come in handy in future.
So far, the problem I described seems to have been a one-off problem and I guess it was due to the sort of CSS conflict that you describe but which Sigil automatically resolved when loading the code and then re-saving the ePub. Thanks for the tip! |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
can't insert chapter break | Holden | Sigil | 7 | 04-13-2012 06:38 AM |
xpath exp for just roman unumerals as Chapter headings | p3aul | Conversion | 8 | 04-08-2012 04:30 PM |
Chapter Breaks | Mike Ramberg | Sigil | 2 | 01-09-2011 06:20 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 |