02-27-2011, 08:03 AM | #1 |
Junior Member
Posts: 9
Karma: 10
Join Date: Feb 2011
Device: none
|
Adding page breaks in Calibre breaks ePubcheck validation
Hi,
I have an ePub which I have exported from InDesign (without page breaks). This ePub passes the ePubcheck validation (except for the date, which is fixed if I run Calibre's epub-fix commandline tool). Next, I add page breaks in calibre by converting from ePub to ePub, and adding page breaks before chapter openings. This works fine, and I'm able to view the ePub with the correct page breaks in ADE and calibre's viewer. However, the ePub no longer passes the ePubcheck validation. Each page break (there are 150 of them) produces this error: Error: test.epub/OEBPS/Test_split_125 [any number between 1 and 150].xhtml<16>: element "a" from namespace "http://www.w3.org/1999/xhtml" not allowed in this context running calibre's epub-fix does not help in this case. If anyone has an idea what's wrong and what I can do to fix this, that would be very kind. Thanks, Ariel |
02-27-2011, 09:32 AM | #2 |
creator of calibre
Posts: 44,356
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Wrap the <a> element in a <div>
|
Advert | |
|
02-27-2011, 11:44 AM | #3 |
Junior Member
Posts: 9
Karma: 10
Join Date: Feb 2011
Device: none
|
Many thanks. You mean: <div><a></a></div>, right?
Any way of doing this automatically? That is, the ePub has 150 chapters and each has an anchor. Can calibre search and replace throughout the ePub? If not, any ideas what program could do this simply and easily? By the way, is this a problem with calibre or with epubcheck? If it's a problem with epubcheck, any chance of getting the epub-fix to fix this as well? Many thanks for an amazing piece of software! Ariel |
02-27-2011, 12:00 PM | #4 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
There's a search and replace option available in the conversion settings. I'm not sure of the order in which the different options are called in the conversion pipeline, though, it may be that you need to do two passes, the first one for adding the pagebreaks, the second for wrapping the tag.
|
02-27-2011, 12:25 PM | #5 |
creator of calibre
Posts: 44,356
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Change the chapter detection to detect a top level element instead of an <a> tag and you wont have the problem in the first place.
|
Advert | |
|
02-27-2011, 12:38 PM | #6 |
Junior Member
Posts: 9
Karma: 10
Join Date: Feb 2011
Device: none
|
Thank you both.
I've got the following find: (<a.+/a>) for the replace, I'm not sure how to indicate the find field. In InDesign you'd use $1, $2 etc. but it's not working here. I'm looking for something like: <div>$1</div> Any help welcome. @kovidgoyal: The way I'm guaranteeing page breaks in the right place is by applying a character style to some text, and, in calibre, adding a page break before that character style. The <a> tages are link destinations for the table of contents that's part of the ebook. Is that not the best way to do it? Thanks, Ariel |
02-27-2011, 12:44 PM | #7 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
My advice re search and replace: Forget what I said earlier, go with Kovid's idea. (Just for the record, though, backreferences in Python style regexes are made with backslashes, so you probably want to use something like <div>\1</div>)
|
02-27-2011, 12:46 PM | #8 |
creator of calibre
Posts: 44,356
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I don't know about what indesign is capable of, but generally speaking, you should have chapter breaks on a block level element like a heading or a pragraph, not on an inline element like an anchor.
|
02-27-2011, 01:19 PM | #9 |
Junior Member
Posts: 9
Karma: 10
Join Date: Feb 2011
Device: none
|
I see. A character style is presumably also an inline element. So I'll try and base it on a paragraph style (or several).
Thanks, and thanks Manichean for your help. Ariel |
02-27-2011, 01:34 PM | #10 |
Junior Member
Posts: 9
Karma: 10
Join Date: Feb 2011
Device: none
|
Adding div tags doesn't help. Epubcheck simply gives the same warning as before:
Error: test.epub/OEBPS/Test_split_125 [any number between 1 and 150].xhtml<16>: element "div" from namespace "http://www.w3.org/1999/xhtml" not allowed in this context Here's the code from the beginning of one of the 150 files: Code:
<?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Psalms ePub Georgia</title> <link href="../Styles/stylesheet1.css" rel="stylesheet" type="text/css" /> <style type="text/css"> @page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; } @font-face { font-family: "Georgia"; font-style: normal; font-weight: normal; src: local(Georgia) } </style> </head> <body class="calibre"> <p class="awpsalmheader" id="calibre_toc_8"><span class="awpagebreak" id="calibre_pb_8">PSA</span><span>LM SIX</span></p> <div class="calibre1"> <a class="calibre2" id="psalm-six-anchor"></a> </div> <p class="awnormal17ptafter"><span>A composition for chorus and strings, a psalm of David:</span></p> hmm... |
02-27-2011, 01:43 PM | #11 |
creator of calibre
Posts: 44,356
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
div tags are most definitely allowed as children of body, so your error is complaining about something else.
I suggest using flightcrew instead of epubcheck, it tends to have more helpful error messages. |
02-27-2011, 01:47 PM | #12 |
Junior Member
Posts: 9
Karma: 10
Join Date: Feb 2011
Device: none
|
Thanks again. I'll try flightcrew.
|
02-27-2011, 05:22 PM | #13 |
Junior Member
Posts: 9
Karma: 10
Join Date: Feb 2011
Device: none
|
Flightcrew didn't help.
I used calibre to split the file before a designated paragraph style rather than a character style and that also didn't help. On the other hand, I've just used Sigil to do the same thing, inserting a chapter break before each paragraph, and this works. So it seems that calibre isn't working well with embedded anchors for some reason. Thanks, Ariel |
02-27-2011, 06:35 PM | #14 |
Resident Curmudgeon
Posts: 75,901
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Since you are making an ePub eBook, why do you need anchors for the chapter titles? Are these to link back to some internal ToC? It's ePub. ePub doesn't need that. It has an external ToC. So you can do away with the anchors and any internal ToC.
|
02-27-2011, 09:02 PM | #15 | |
US Navy, Retired
Posts: 9,865
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
Quote:
Calibre is not a ePub creation / publishing tool. It is a ebook management tool and it also does a great job of converting books from one format to another format. This conversion process promises to create a readable book for our use. Most likely further questions about refining your books to pass flightcrew or ePubcheck should be asked in the ePub forum. That said, if you think something you run into in the future is a bug or you need help doing or understanding something don't hesitate to bring it up in this forum. You can also request enhancements or report bugs through calibre's site, learn how here. Good Luck with your projects. Last edited by DoctorOhh; 02-27-2011 at 09:06 PM. |
|
Tags |
epubcheck, error, page breaks, validation |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mobi page breaks in Calibre viewer | DaleDe | Calibre | 3 | 04-04-2011 01:58 AM |
Force Calibre not to add Page Breaks on H1 and H2 Tags | jloakes | Calibre | 2 | 11-18-2010 04:08 PM |
Adding chapter breaks by number of pages/lines | raptir | Calibre | 8 | 10-22-2009 12:11 PM |
Page breaks not working | EnsignRicki | Calibre | 0 | 06-26-2009 11:47 AM |
Page breaks | enarchay | Calibre | 18 | 05-31-2009 06:57 PM |