Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 11-10-2014, 09:19 PM   #1
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 780906
Join Date: Nov 2009
Device: many
[Plugin] ePub3-itizer - epub3 output plugin for Sigil

Hi All,

Updated: August 23, 2017
Current Version: "0.3.8"

See the attached: ePub3-itizer_v038.zip

License/Copying: GNU LGPL Version 2 or Version 3 your choice. Any other license terms are only available directly from the author in writing.

Change Log
Spoiler:


Changes since v037:
1) restrict fix that forced focus to only Mac systems to prevent problems on other platforms
2) remove display:none css from parts of the nav since they are redudant given the hidden attribute
3) remove empty dc: metadata since for epub3 epubcheck barfs on it
4) Add LGPL V2 or LGPL V3 license info to plugin.py

Changes since v036:
1) Force the FileDialog to the front with focus so people know plugin is running

Changes since v035:
1) bug fix to prevent xml headers from interfering with smil processing

Changes since v034:
1) added autostart tag to plugin.xml

2) modified code to allow only epub2 as input to the plugin

3) Removed code needlessly duplicated from plugin launcher codebase


Changes since v033:
1) bug fix to prevent empty guide element from being passed to epub3 opf

2) bug fix to actually use the fixed media types for fonts


Changes since v032:
1) integrated in support for SMIL Media Overalay metadata (Thank you Alpe!)

2) allowed guide to pass through to epub3 opf to maintain backwards compatibility

3) added hidden attribute to nav page-list and landmarks

4) properly added inline styles display:none for landmarks and page-lists (Thank you Doitsu)

5) map epub2 font x-font-ttf and x-font-opentype media-types to vnd.ms-opentype
(will be "font-sfnt when EPUB 3.1 is final)

6) create a github repo for ePub3-itizer code at:
https://github.com/kevinhendricks/ePub3-itizer


Changes since v031:
1) Fixed typo bug in opf_converter that caused problem with spine properties
(Thanks DiapDealer for the fix! And thanks Olivier_g for the bug report!)

2) added lang= and xml:lang= to specify language from opf dc:language for nav.xhtml

Changes since v030:
1) Fixed nasty bug I introduced in v030 that downcased all ncx tags and removed navPoints
Thanks for Dotisu for catching this error

Changes since v022:
1) nav changes to add style in head to prevent display of landmarks
and to use ol list-style-none

2) remove "linear = "yes" from nav entry in spine

3) remove DOCTYPE from toc.ncx (not sure if this is correct or not)

4) remove guide from content.opf since now optional

5) should now properly identify and add manifest properties "scripted"


Very Important Note

Support for this plugin is only provided for Sigil 0.8.6 or later. This plugin requires Sigil 0.8.2 or later to even operate.

Before Conversion

1. Make sure your epub2 validates under FlightCrew and/or EpubCheck
2. If your epub uses ".htm" or ".html" file extensions, you should first change them to use ".xhtml" file extensions as follows:
  • In Sigil's BookBrowser window select all of your .htm or .html files
  • Right click on your selection and select Rename from the context menu
  • in the "Rename Files Starting At" dialog box, remove everything there and replace it with ".xhtml" (no quotes), then hit "OK"


How it Converts from valid epub2 to epub3

This program walks all xhtml files doing the following:

- converting DOCTYPE to <!DOCTYPE html>
- adds epub: namespace to html tag
- converts meta charset info to be: <meta charset="utf-8">
- converts all html named character entities to numeric entities
- collects any fixed layout metadata in the head tag for opf3 spine page properties
- notes any use of svg, epub:switch, mathml, and script for opf3 manifest properties
- collects any epub:type attributes to help extend nav (landmarks) in the future

Then it reads the current opf and converts it on the fly to meet package 3 requirements

- converts package tag and adds rendition prefix information
- converting metadata it can , adding refines if need be
- passes any unknown meta tags with name/content pairs through unchanged
- adds the required dcterms modified metadata information
- adds manifest page properties where needed including use of mathml, svg, switch, scripted and cover
- adds spine page properties where needed
- extracts the guide for use in creating the nav landmarks and removes it from opf
- adds an entry in the manifest for the new nav document
- adds the new nav document to the end of spine

Then it parses the current toc.ncx extracting doctitle, toc, and any pagelist information and removes its DOCTYPE

It then merges this with the original guide information from the opf2 to create a new nav.xhtml file.
It will now nicely handle multi-level tocs.

Finally it adds the mimetype file and zips it all up and then launches a gui to ask the user what to name the file and where to save it.

---

Thanks to Doitsu, DiapDealer, and JonathanMagus and others for reporting back bugs. I think this code is now stable and usable. Bug reports and feature requests welcomed.

If you are at all interested ... load up your favorite epub2 ebook, then go to output plugins and run the ePub3-itizer.

Take care,

KevinH
Attached Files
File Type: zip ePub3-itizer_v038.zip (25.6 KB, 342 views)

Last edited by KevinH; 08-23-2017 at 12:36 PM. Reason: updated to support both python 2.7 and 3.4, and more bug fixes
KevinH is offline   Reply With Quote
Advert
Old 11-11-2014, 04:29 AM   #2
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,405
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
You might want to take a look at this. It contains a stylesheet called ncx2end.xsl which can be used to transform a NCX to a nav TOC. It does support multiple levels of TOC.

I basically looked at the same thing yesterday to enable ePUB3 support in my add-in. However, I tried one document with MathML with fallback for ePUB2 and the results were dramatic. Even most ePUB3 readers made a mess of it. Only Chromium handled it correctly. I decided it was not worth the effort for me at the time.
Toxaris is offline   Reply With Quote
Old 11-11-2014, 09:52 AM   #3
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 780906
Join Date: Nov 2009
Device: many
Hi Toxaris,

Thanks for that link. I am not a fan of using xslt, and to tell you the truth getting the nav to support multiple levels is quite easy. Also, that version does not parse the guide elements in the opf to create the landmarks so I'll stick with what I have now and just improve on it.

Yes, support for inline mathml (even if it is just the presentation subset of mathml) is hard. Assuming you added all of the correct namespaces, it should have worked. I will try playing round with that next just to see how it appears in preview mode and bookview.

Take care,

KevinH
KevinH is offline   Reply With Quote
Old 11-11-2014, 11:15 AM   #4
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,405
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
Quote:
Originally Posted by KevinH View Post
Hi Toxaris,

Thanks for that link. I am not a fan of using xslt, and to tell you the truth getting the nav to support multiple levels is quite easy. Also, that version does not parse the guide elements in the opf to create the landmarks so I'll stick with what I have now and just improve on it.

Yes, support for inline mathml (even if it is just the presentation subset of mathml) is hard. Assuming you added all of the correct namespaces, it should have worked. I will try playing round with that next just to see how it appears in preview mode and bookview.

Take care,

KevinH
No problem, it was an option. I agree that it is not that complex (at least that part...). The issue with MathML was not so much the support (although it is abysmal), but the failure in honoring the epub:switch. You need that to be able to handle a fallback, but the reading systems either did both the MathML and the image or just the image. It is a bit ironic that the systems that do support MathML do not seem to support epub:switch...
Only Chromium did it correctly IIRC, but there the MathML does not resize together with the font resize.
Toxaris is offline   Reply With Quote
Old 11-11-2014, 01:06 PM   #5
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 780906
Join Date: Nov 2009
Device: many
Hi Toxaris,

Yes, I have never actually seen an example of epub:switch working. Technically, my plugin should look for all instances of epub:switch and add "switch" to the manifest properties for that file since "switch" is one of those things that must be noted in the opf3.

I think some readers are using some javascript to actually implement the epub:switch functionality by effectively only presenting one case. Those readers that do not support any background scripting will have to wait for their display engine to learn how to handle "switch" which in turns make it useless for doing what it was designed for: fallback!

Another part of the problem is that epub3 has become so very very bloated and is constantly changing. The epub3 specs seem to be driven by textbook publishers and much of what they add is truly not needed for normal ebooks. And I personally think pdf would be a better choice for textbooks anyway.

For example: I tried to more fully add support for the epub:type vocabulary and it was changed yet again about a month or so ago (September). The recognized vocabulary is now huge and the documentation of where each word is allowed to be used has been written by someone who must have been a bad lawyer in an earlier life!

The epub3 creators seem to have forgotten the very meaning of KISS in engineering their spec.

BTW: If you have a simple example of using epub:switch that you think should work, I would love to have it for testing and improving Sigil down the road with it. I looked at some of the official epub3 samples and many of them at not consistent with their own specs!

Take care,

KevinH
KevinH is offline   Reply With Quote
Advert
Old 11-11-2014, 02:57 PM   #6
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,405
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
True, and then to think that epub:switch was already in the specs for ePUB2. They would have been better of fixing ePUB2 instead of the bloated thing that is ePUB3. It should have been independent and they should not have listened to Apple specifically.
On one hand I like the fact that there are more possiblities for semantics and structure, on the other hand that is what Latex is for and it makes the ePUB much more complex. ePUB is a result, not an intermediate format.
I think they can better take their loss and create an ePUB4 standard without all the hassle and that just works for books.
Toxaris is offline   Reply With Quote
Old 11-11-2014, 06:05 PM   #7
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1054509
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
I should mention that this plugin is a experimental test best. Eventually epub3 will be integrated directly into Sigil.
user_none is offline   Reply With Quote
Old 11-11-2014, 07:47 PM   #8
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 780906
Join Date: Nov 2009
Device: many
Hi All,
Quote:
Originally Posted by user_none View Post
I should mention that this plugin is a experimental test best. Eventually epub3 will be integrated directly into Sigil.
Yes, as user-none said, this is just a stopgap measure until we get Sigil to support epub3.

I should have a much improved version with gui for save-as ready by the end of the week.

Take care,

KevinH
KevinH is offline   Reply With Quote
Old 11-12-2014, 01:06 PM   #9
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 780906
Join Date: Nov 2009
Device: many
Hi All,

An ePub3-itizer_v010beta.zip is now available in the first post. Changes include, a gui file dialog for selecting where to save it and what to name it, support for conversion of multi-level tocs to multi-level nav, a refactoring to make the code easier to support, and lots of bug fixes.

Please let me know if you run into any problems with it.

Hope this helps,

KevinH
KevinH is offline   Reply With Quote
Old 11-12-2014, 08:25 PM   #10
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 780906
Join Date: Nov 2009
Device: many
Hi All,

A bug fix release ePub3-itizer_v015beta.zip with an updated plugin for Sigil and an even newer bug fixed version of quickparser.py.

See the first post for all of the links.

Special thanks to Doitsu for all of his hard work testing and finding bugs!

Thanks.

KevinH

Last edited by KevinH; 11-12-2014 at 09:23 PM.
KevinH is offline   Reply With Quote
Old 11-13-2014, 12:53 AM   #11
David Kudler
Enthusiast
David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'
 
David Kudler's Avatar
 
Posts: 32
Karma: 10000
Join Date: Apr 2011
Device: iPad
Quote:
Originally Posted by KevinH View Post
Hi All,

A bug fix release ePub3-itizer_v015beta.zip with an updated plugin for Sigil and an even newer bug fixed version of quickparser.py.

See the first post for all of the links.

Special thanks to Doitsu for all of his hard work testing and finding bugs!

Thanks.

KevinH
Bless you all. To be honest, this has been my biggest grumble with Sigil for a while.
David Kudler is offline   Reply With Quote
Old 11-13-2014, 05:20 AM   #12
Doitsu
Wizard
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: 3,954
Karma: 12058512
Join Date: Dec 2010
Device: Kindle PW2
If you're a Windows user and would like to give this plugin a try, here's how you update quickparser.py:

1. Press +R to display the Run dialog.

2. Copy and paste %ProgramFiles%\Sigil\plugin_launchers\python into the input box and press Enter. This will open the Plugin Launchers Python folder in Windows Explorer.

3. Copy the new version of quickparser.py into this folder.
Doitsu is offline   Reply With Quote
Old 11-14-2014, 09:05 AM   #13
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: 17,481
Karma: 90388224
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by KevinH View Post
- collects any epub:type attributes to help extend nav (landmarks) in the future
Code:
if len(etypes) > 0:
            epub_types[mid] = " ".join(etypes)
That join is failing (line 99-ish: plugin.py) whenever epub:types are encountered because etypes is a list of tuples that is created on line 229 of the same file.

Suggest just storing the list of tuples in the epub_types dict until future implementation.
DiapDealer is online now   Reply With Quote
Old 11-14-2014, 10:41 AM   #14
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 780906
Join Date: Nov 2009
Device: many
Hi DiapDealer,

Thanks for the bug report. I will take a look at it and also fix your other bug report.

Thanks!

KevinH
KevinH is offline   Reply With Quote
Old 11-14-2014, 10:57 AM   #15
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 780906
Join Date: Nov 2009
Device: many
Hi,

Just released ePub3-itizer_v016.zip. This is a bug-fix release (Thank you DiapDealer for your bug reports!) . See the links in the first post for the downloads.

Take care,

KevinH
KevinH is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Conversion Output] KePub Output Plugin jgoguen Plugins 286 11-19-2017 08:58 PM
Create a javascript quizz for Epub3 in Sigil BertrandThibaut Sigil 3 01-26-2014 10:04 AM
An epub3 version of Sigil ? apulia03 Sigil 9 11-28-2012 02:07 AM
Plugin not customizable: Plugin: HTML Output does not need customization flyingfoxlee Conversion 2 02-24-2012 03:24 AM
epub3 Sigil Poetry(fixed layout) Giggleton Sigil 7 04-04-2011 01:58 PM


All times are GMT -4. The time now is 08:36 PM.


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