11-10-2014, 09:19 PM | #1 |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
[Plugin] ePub3-itizer - epub3 output plugin for Sigil
Hi All,
Updated: January 19, 2023 Current Version: "0.5.8" See the attached: ePub3-itizer_v058.zip Official Github site: https://github.com/kevinhendricks/ePub3-itizer 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:
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:
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 - converts "big" tag to "span" with inline style equivalent - 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 Last edited by KevinH; 01-19-2023 at 01:42 PM. Reason: updating for new release |
11-11-2014, 04:29 AM | #2 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
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. |
Advert | |
|
11-11-2014, 09:52 AM | #3 |
Sigil Developer
Posts: 8,156
Karma: 5450818
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 |
11-11-2014, 11:15 AM | #4 | |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
Only Chromium did it correctly IIRC, but there the MathML does not resize together with the font resize. |
|
11-11-2014, 01:06 PM | #5 |
Sigil Developer
Posts: 8,156
Karma: 5450818
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 |
Advert | |
|
11-11-2014, 02:57 PM | #6 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
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. |
11-11-2014, 06:05 PM | #7 |
Sigil & calibre developer
Posts: 2,487
Karma: 1063785
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.
|
11-11-2014, 07:47 PM | #8 | |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Hi All,
Quote:
I should have a much improved version with gui for save-as ready by the end of the week. Take care, KevinH |
|
11-12-2014, 01:06 PM | #9 |
Sigil Developer
Posts: 8,156
Karma: 5450818
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 |
11-12-2014, 08:25 PM | #10 |
Sigil Developer
Posts: 8,156
Karma: 5450818
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. |
11-13-2014, 12:53 AM | #11 | |
Enthusiast
Posts: 48
Karma: 10000
Join Date: Apr 2011
Device: iPad
|
Quote:
|
|
11-13-2014, 05:20 AM | #12 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
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. |
11-14-2014, 09:05 AM | #13 | |
Grand Sorcerer
Posts: 28,038
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Code:
if len(etypes) > 0: epub_types[mid] = " ".join(etypes) Suggest just storing the list of tuples in the epub_types dict until future implementation. |
|
11-14-2014, 10:41 AM | #14 |
Sigil Developer
Posts: 8,156
Karma: 5450818
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 |
11-14-2014, 10:57 AM | #15 |
Sigil Developer
Posts: 8,156
Karma: 5450818
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 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Conversion Output] KePub Output Plugin | jgoguen | Plugins | 567 | 10-19-2024 06:20 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 |