![]() |
#1 |
Member
![]() Posts: 10
Karma: 28
Join Date: Aug 2010
Device: kobo
|
Converting a manual in HTML into an epub for the Kobo
Given that an epub is basically just HTML with a Table of Contents (chapters) for navigation, it is interesting to look at how well the Kobo handles HTML elements such as tables, lists, images and code blocks (monospaced text). As an exercise, I converted a programming manual from HTML to epub.
The manual was the Lua 5.1 Reference Manual (www.lua.org, authors R. Ierusalimschy, L. H. de Figueiredo & W. Celes). It has one large table (the index) and some smaller tables, a contents page (a list) and some smaller lists, few images or diagrams, but lots of code samples and specifications (mainly HTML <pre> blocks). calibre (0.7.12, default settings) converted the HTML into an epub with 44 html files, comprising contents, index and the body of the manual. The 41 files for the body matched the main sections in the contents. Viewing the epub on a Kobo was quite illuminating. The main problems were:
Code:
void lua_getfield (lua_State *L, int index, const char *k); [-0, +1, e] co = coroutine.create(function (a,b) print("co-body", a, b) local r = foo(a+1) print("co-body", r) local r, s = coroutine.yield(a+b, a-b) print("co-body", r, s) return b, "end" end) Code:
void lua_getfield (lua_Sta[-0, +1, e] co = coroutine.create(functio print("co-body", a, b) local r = foo(a+1) print("co-body", r) local r, s = coroutine.yiel print("co-body", r, s) return b, "end" end) I eventually settled on a format for code blocks where all lines are aligned left, re-indented, and with any wrap-around further indented. It's quite readable on the Kobo. Code:
void lua_getfield (lua_State *L, int [-0, +1, e] index, const char *k); co = coroutine.create(function (a,b) print("co-body", a, b) local r = foo(a+1) print("co-body", r) local r, s = coroutine.yield( a+b, a-b) print("co-body", r, s) return b, "end" end)
|
![]() |
![]() |
![]() |
#2 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 333
Karma: 1440670
Join Date: Jul 2010
Location: Auckland, New Zealand
Device: Kobo Original, Kobo Glo
|
Thanks, Bob, some useful info there.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
himself
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 576
Karma: 11226
Join Date: May 2010
Device: Kobo
|
Calibre forum has a sticky with tips and tricks. There is a lot of
people looking for the clue and almost all find it sooner or later. It takes time and nerves, or course. For the second issue, I will go after Sigil. There is a chance to remove parts, make new toc. I don't give you the solution, just point to the place where to go. |
![]() |
![]() |
![]() |
#4 |
Member
![]() Posts: 10
Karma: 28
Join Date: Aug 2010
Device: kobo
|
The same technique for handling an indented line that wraps-around, and for applying a right-aligned block to such a line, is applicable to epub files of poetry and verse.
The Gutenberg version of The Waste Land (pg1321) is a case in point. There are short lines, indented lines and long lines, and the layout matters. On the Kobo (medium font), quite a few lines wrap-around to the left-margin regardless of the indent and the layout. It quite ruins the effect. In addition, the decadal line numbers are not aligned to the right-margin as they should be. |
![]() |
![]() |
![]() |
#5 |
Member
![]() Posts: 21
Karma: 22
Join Date: Jun 2009
Device: kobo, OLPC XO
|
thanks for the info. i had issues with calibre conversions and didn't feel like diving too deeply into them.
i am now using jutoh instead, which works brilliantly for my purposes, and has already proven itself worth the U$22 price tag (there is a free trial). |
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
MemoryError converting PHP manual (html->mobi) | jalperin | Calibre | 1 | 09-21-2010 11:40 AM |
Calibre Indent Issue When Removing Blank Lines (Converting From HTML to MOBI or EPUB) | David Derrico | Calibre | 5 | 08-04-2010 12:13 AM |
Converting Merged HTML file to Epub/PDF Not Working | MV64 | Calibre | 1 | 06-07-2010 07:48 PM |
bookmark issues converting HTML to EPUB | isabellkirsten | Calibre | 0 | 04-09-2010 11:47 PM |
Any way to force page breaks when converting HTML to EPUB | Bierkonig | Calibre | 23 | 10-31-2009 01:51 PM |