Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 12-16-2016, 10: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, 1906 views)

Last edited by djazz; 12-16-2016 at 07:26 PM.
djazz is offline   Reply With Quote
Old 12-16-2016, 10:44 AM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Thanks for the contribution to improve the Sigil experience! I'll see it gets added to the plugin index.
DiapDealer is offline   Reply With Quote
Advert
Old 01-10-2017, 01:22 PM   #3
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,035
Karma: 11227259
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
Each time I run the plugin, I get this error:
Code:
TypeError: sequence item 1: expected a bytes-like object, str found
Error: sequence item 1: expected a bytes-like object, str found
.
Did I misunderstand something?
Sigil v. 0.9.7, Windows 10, 32 bit.
Leonatus is offline   Reply With Quote
Old 01-10-2017, 01:53 PM   #4
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Leonatus View Post
Each time I run the plugin, I get this error:
Code:
TypeError: sequence item 1: expected a bytes-like object, str found
Error: sequence item 1: expected a bytes-like object, str found
.
Did I misunderstand something?
Sigil v. 0.9.7, Windows 10, 32 bit.
I'm getting the same error message for certain commercial epubs. It looks like there's a bug in the plugin code. Until the author releases an official bugfix try the following:

1. Locate the Kepub Plugin folder (Edit > Preferences > Peferences Location).
2. Open kepubify.py and locate the following line:

Code:
root = re.sub(b'<p[^>/]*/>', '<p></p>', root).decode('utf-8')
3. Change it to:

Code:
root = re.sub(b'<p[^>/]*/>', b'<p></p>', root).decode('utf-8')
This should fix the issue.

Last edited by Doitsu; 01-10-2017 at 03:52 PM.
Doitsu is offline   Reply With Quote
Old 01-10-2017, 02:57 PM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,404
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Have a look at the Calibre plugin that converts to kepub and make sure your works the same.
JSWolf is offline   Reply With Quote
Advert
Old 01-10-2017, 03:49 PM   #6
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,035
Karma: 11227259
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
@Doitsu: Works! Great! Thank you!
@JSWolf: What I wanted to have a look at is whether the plugin renders a "real" kepub with the effect that the kepub specialities would be assigned to the book, but this the plugin doesn't seem to afford. Adding it to Calibre renders an epub as input format; substantial changes seem not to take place.
Leonatus is offline   Reply With Quote
Old 01-10-2017, 04:15 PM   #7
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,997
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@Leonatus - JSWolf presumably had this calibre plugin in mind ==>> [Conversion Output] KePub Output Plugin

According to the first post for this plugin, it is based on that calibre plugin, which could mean it inherits from the calibre plugin, or the calibre plugin was hacked to create this plugin. The calibre plugin was last updated on June 26 2016, this plugin went to air in December of 2016 . . .

BR
BetterRed is offline   Reply With Quote
Old 01-11-2017, 03:20 AM   #8
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,035
Karma: 11227259
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
Quote:
Originally Posted by BetterRed View Post
@Leonatus - JSWolf presumably had this calibre plugin in mind ==>> [Conversion Output] KePub Output Plugin
Yes, I know this plugin. The point for my curiosity has been that, converting epub to kepub in calibre, destroys a lot of formatting that I have assigned to the epub, such as ignored fonts, and I only wanted to have a look if the Sgil plugin would behave a bit differently.
Leonatus is offline   Reply With Quote
Old 01-11-2017, 04:10 AM   #9
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Leonatus View Post
Yes, I know this plugin. The point for my curiosity has been that, converting epub to kepub in calibre, destroys a lot of formatting that I have assigned to the epub, such as ignored fonts, and I only wanted to have a look if the Sgil plugin would behave a bit differently.
I don't have a Kobo, but, AFAIK, Kobos have two different rendering engines (RMSDK/ADE and ACCESS NetFront) and books with a .kepup.epub file extension will be rendered with the ACCESS NetFront epub3 rendering engine whose specs are available online.

I coudn't hurt to convert some of your books with KevinH's epub3 output plugin and test them on a Kobo (after changing the file extension to .kepub.epub).

If the rendering is mostly OK, you could do some research to find out what needs to be changed for Kobo readers and report your findings to the Calibre/Sigil Kepub plugin developers.

If it's only minor cosmetic changes that won't invalidate the epub3, KevinH might even be willing to add a Kobo postprocessing option to his epub3 plugin.
Doitsu is offline   Reply With Quote
Old 01-11-2017, 05:27 AM   #10
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,035
Karma: 11227259
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
Thank you for your hints! In fact, I'm not thus keen on rendering my epubs as kepubs. there are advantages of the kepub mode - there are people who don't even like them, though - but there are also some problems that normally leave me to remain at the epub format. For example the hyphenation feature of Kobo doesn't work - at least for me, very reliable, there are many errors, whereas the epub-plugin of SauliusP (Calibre) is very good.
It was mere curiosity that lead me to test the new plugin.
Leonatus is offline   Reply With Quote
Old 01-11-2017, 06:25 AM   #11
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,404
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Leonatus View Post
For example the hyphenation feature of Kobo doesn't work - at least for me, very reliable, there are many errors, whereas the epub-plugin of SauliusP (Calibre) is very good.
It was mere curiosity that lead me to test the new plugin.
Hyphenate This! adds in soft hyphens which do not work well with ADE. If you want better hyphenation, then you need to either edit the settings in the existing hyphenation dictionary or use the one I posted at https://www.mobileread.com/forums/sh...d.php?t=252405.

So if you don't want kepub,why are you in this thread trying out the plugin to convert to kepub?
JSWolf is offline   Reply With Quote
Old 01-11-2017, 06:34 AM   #12
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by Leonatus View Post
Yes, I know this plugin. The point for my curiosity has been that, converting epub to kepub in calibre, destroys a lot of formatting that I have assigned to the epub, such as ignored fonts, and I only wanted to have a look if the Sgil plugin would behave a bit differently.
The Kepub Output plugin shouldn't be destroying anything. The plugin basically just calls the epub output plugin and then does another pass to add tge spans that the kepub format needs. For other things, it should be exactly the same as doing an epub-to-epub conversion.
davidfor is offline   Reply With Quote
Old 01-11-2017, 01:20 PM   #13
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,035
Karma: 11227259
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
Quote:
Originally Posted by JSWolf View Post
So if you don't want kepub,why are you in this thread trying out the plugin to convert to kepub?
as I said, I wanted to look if the plugin shows a different behaviour, and - is it not allowed to be curious?
@Davifor: I made the experience that for example fonts that I had added in the epub (and there showed correctly) did not show on the device after converting the epub to kepub under Calibre. But this was a time ago, and things might have changed meanwhile. I'll give it a try once more, now that all deny my own experience.
Leonatus is offline   Reply With Quote
Old 01-11-2017, 05:26 PM   #14
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,404
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Leonatus View Post
as I said, I wanted to look if the plugin shows a different behaviour, and - is it not allowed to be curious?
@Davifor: I made the experience that for example fonts that I had added in the epub (and there showed correctly) did not show on the device after converting the epub to kepub under Calibre. But this was a time ago, and things might have changed meanwhile. I'll give it a try once more, now that all deny my own experience.
Did you select publisher default as the font in the font list?
JSWolf is offline   Reply With Quote
Old 01-11-2017, 05:48 PM   #15
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,221
Karma: 16536676
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
@Leonatus,

There is another problem you might be running into. By default the Kobo has some internal CSS override code for kepubs which is different from the override used for standard epubs,
Code:
* { font-family: %1 !important; }
which tries to force the book to be displayed in the user-selected font on the Kobo.

The Kobo Patcher does have a 'fix' for this (patch_name = `Un-Force user font-family in KePubs`) for those (I'm one of them) who dislike the heavy-handed default override. There are 3 alternative replacements to choose from.
  • div,p{font-family:%1!important; }
  • body,p{font-family:%1!important;}
  • body{font-family:%1 !important; }
The last one emulates the much less agressive default override the Kobo uses for standard epubs.
jackie_w is offline   Reply With Quote
Reply

Tags
kepub, kobo, sigil plugin


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Conversion Output] KePub Output Plugin jgoguen Plugins 567 10-19-2024 06:20 PM
Kepub Output: get the cover into Table of Contents jiembe Kobo Developer's Corner 0 11-03-2016 11:27 AM
Kepub plugin update not working Chocky Calibre 0 12-10-2015 05:35 AM
Help with KePub plugin MandyMill Plugins 5 01-08-2015 04:14 PM
Plugin not customizable: Plugin: HTML Output does not need customization flyingfoxlee Conversion 2 02-24-2012 03:24 AM


All times are GMT -4. The time now is 12:50 PM.


MobileRead.com is a privately owned, operated and funded community.