View Full Version : Best way to go about this?

08-12-2010, 05:17 AM
I have around 85 customized LRF ebooks I made through BookDesigner, with TOCs and such I'd like kept intact. I noticed that doing a straight LRF to EPUB through Calibre always produced problems, like chapter links going to wrong pages and such (any way to fix this?). The only way I've been able to keep the links working perfectly was to do LRF to MOBI to EPUB. Problem with that is paragraph spacing - either you get spaces between all or none at all when you convert from LRF.

I also have the books in HTML which were output with Bookdesigner, so they could be used as a source too. But the problem with that is I seem to have to run them through Word to set all the chapter headers to a style so Calibre recognizes page breaks. Then to make that worse, the chapter links can't jump back to the TOC like the LRFs do, unless I were to manually create hyperlinks which is incredibly tedious.

So I'm wondering what the best option would be to get all of these custom made books into EPUB while keeping the original formatting and chapter links working properly? I'm doing so because sooner or later I'll be getting a new reader, and LRF will be useless then. What would be really nice would be if BookDesigner simply had an EPUB output. I find Sigil a bit of a pain to use having to always mess around with stylesheet codes and all.

08-12-2010, 06:27 AM
The back-links for the chapters are probably being messed-up by Word (MS Word is probably the worst choice when it comes to editing html). Post an example of the actual html code used for the chapter headers and it should be possible to work out the right XPath expression you need for Calibre to recognise them without any other processing.

08-12-2010, 06:46 AM
Even when when the HTML files are opened in a browser though, they seem to not have working back-links. Maybe when BookDesigner does the output, back-links aren't saved for HTML files. I really don't know much about the coding side of things, so you'll have to excuse my ignorance on all of this.

This is how a header appears in Sigil in code view, for a book that has chapters simply titled as "Part 1, Part 2, etc.". Hope this is what you meant:

<p class="MsoNormal sgc-4"><a class="sgc-13" id="BdToc_1"><span class="sgc-5" id="title">Part 1</span></a></p>

08-12-2010, 07:45 AM
Okay, just messed around with xpath for a while. If I set attribute to "id" and value to "title" then Calibre creates the proper page breaks for each chapter. Problem is there's still no back-linking so I'm guessing BookDesigner simply does not output them when saving to HTML.

I also noticed that the only way to make the TOC show up on a new page, instead of being displayed on the same page as I have the book title and author, is to go into Word and create a section break before it.

EDIT: Ah, no wonder. The reason why back-links aren't being saved is because I always used BookDesigners "insert TOC" option, which works fine for LRFs. I think the only way for back-links to be saved for other formats is to manually create "Notes and Links", which would be essentially the same as doing hyperlinks in Word. Not fun since I have some books with well over 100 chapters. Ugh, what a pain this is. Why can't other formats be as easy to create as LRFs?

08-12-2010, 08:04 AM
Well, there's certainly no back-link in the code you posted, though it looks as if it's been through MSWord at some point. The way to add them would be to open the html in a plain text editor like Notepad++ and change
<a class="sgc-13" id="BdToc_1">
<a class="sgc-13" id="BdToc_1" href="[location of the ToC]">

Sorry, can't think of a way of doing it without knowing some basic html+css.

08-12-2010, 08:45 AM
It's okay, thanks for the help.

I guess I'm stuck either with having poorly spaced EPUBs or going through the HTML files and making hyperlinks. Doing notes and links in BookDesigner is actually slower I believe. I just wish Calibre would simply convert LRF to EPUB properly.

EDIT: I've figured out why the Calibre conversions are messing up the links, finally after all this time. I opened a converted EPUB in Sigil to check the code and noticed something weird. Calibre is adding an extra number to each link for some reason which was making them jump all over. Here is an example.

<a class="calibre5" href="../Text/53.xhtml#74">Part 1</a>

Notice the "#74" after xhtml? That shouldn't be there. Simply removing that and leaving just "53.xhtml" makes the link function correctly once it's saved as EPUB. Probably should report this to the Calibre creator, might be interested.