View Single Post
Old 12-16-2016, 09:35 AM   #1
djazz
Enthusiast
djazz is far, far better than a slap in the face with a wet fish.djazz is far, far better than a slap in the face with a wet fish.djazz is far, far better than a slap in the face with a wet fish.djazz is far, far better than a slap in the face with a wet fish.djazz is far, far better than a slap in the face with a wet fish.djazz is far, far better than a slap in the face with a wet fish.djazz is far, far better than a slap in the face with a wet fish.djazz is far, far better than a slap in the face with a wet fish.djazz is far, far better than a slap in the face with a wet fish.djazz is far, far better than a slap in the face with a wet fish.djazz is far, far better than a slap in the face with a wet fish.
 
djazz's Avatar
 
Posts: 45
Karma: 93476
Join Date: Jun 2016
Location: Sweden
Device: Kobo Glo HD, Kobo Aura One LE
[Plugin] KePub Output

This output plugin adds kobo spans in all xhtml files, to every sentence. This is to make to the Kobo reader remember how far you've read into a chapter and it also enables annotating and bookmarking.

When you've ran the plugin, it asks where you want to save it. Save as .kepub.epub!

It's based code from the Calibre KePub Output Plugin, all credit goes to jgoguen.
I modified it to work in Python 3 since that is what Sigil uses.

I have only tried it with one story (EPUB3) on Linux, so it might not work for all!

Example
Spoiler:
Input
Code:
<p>But why? Nobody really knew what was outside, if there was anything out there at all. Historical books suggested the world outside was blasted, lifeless and poisonous. That was, at least, the common and logical assumption. But a ghost story somepony told at my first (and only) slumber party had given me horrible nightmares and still lurked in the shadows of my head: a tale of a pony who somehow got the Stable door open and stepped outside… only to find out that there <i>was</i> no outside! Just a great nothingness that whisked the pony away, devouring her soul so that she was nothingness too.</p>
Output
Code:
<p><span class="koboSpan" id="kobo.52.1">But why? </span><span class="koboSpan" id="kobo.52.2">Nobody really knew what was outside, if there was anything out there at all. </span><span class="koboSpan" id="kobo.52.3">Historical books suggested the world outside was blasted, lifeless and poisonous. </span><span class="koboSpan" id="kobo.52.4">That was, at least, the common and logical assumption. </span><span class="koboSpan" id="kobo.52.5">But a ghost story somepony told at my first (and only) slumber party had given me horrible nightmares and still lurked in the shadows of my head: </span><span class="koboSpan" id="kobo.52.6">a tale of a pony who somehow got the Stable door open and stepped outside… only to find out that there </span><i><span class="koboSpan" id="kobo.52.7">was</span></i><span class="koboSpan" id="kobo.53.1"> no outside! </span><span class="koboSpan" id="kobo.53.2">Just a great nothingness that whisked the pony away, devouring her soul so that she was nothingness too.</span></p>
(Snippet from first chapter of Fallout: Equestria)


You can also check out my helper tool epubmake, which is a Makefile and includes epubcheck, kindlegen and kepubify support. It lets you keep your books in version control! It can watch your current epub file that you're editing and run epubmake on save.

Version 0.0.2
Source code on github
Attached Files
File Type: zip KEPUB_0.0.2.zip (4.0 KB, 2208 views)

Last edited by djazz; 12-16-2016 at 06:26 PM.
djazz is offline   Reply With Quote