Hiking ebook finished!

kindle logoI finished the ebook project! When I started with this, I just got all of the files together and pressed “convert” in Calibre (an ebook manager). That crashed my PRS-T1 though :s.

After the holidays, despite it being too late to be of use now, I still had an itch to scratch. Well, I scratched it :) Took me a while and it got me back into sed-scripting (this page was a wonderful resource). Why sed-scripting? Well, I wanted to basically do “batch”-vi – that is, use the power of search-and-replace with regular expressions over a group of files. Roughly, there are 3 straightforward options: Perl, sed, and awk. Of these, I picked sed — it allows you to just type your regexps just as you would in vi :) Of course, they got a little more complicated after a while:

# row for total distance
/Total distance:<.td>$/ {
	N
	N
	N
	s/\n/ /g
	s#\s*\(Tot.*tance:</td>\) \(.*\)#<tr><td>\1<td>\&nbsp;</td><td>\2</tr>#
}

Not much, just a little. Near the end, several times I figured to be done when the lay-out on the devices themselves would be rather bad. But: no more crashing — definitely an improvement. And then, finally, the last tweaks were made, the last sed-script was run, and it was over! Hooray! To celebrate, I made two versions: one for my Kindle DX version (mobi) and one for my Sony Reader version (epub). (No clue if there’s any specific tweaks Calibre adds based on the device, but you can select specific devices for the “output profile”, and I did.)

If you’re interested in a copy of the book, drop me a line.
And, as a bonus, here’s the cover of the book: a photo of La Palma from the International Space Station.

cover

Comments are closed.