Hi All,
Updated: May 28, 2025
Current Version: "0.6.0"
See the attached: ePub3-itizer_v060.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:
Changes since v058
1) upgraded Tk based gui elements to PySide6
2) fixed a warning about unknown escape sequences
Changes since v056
1) removed basic xml named entities from named to numeric conversion
2) allow named entity conversion of text inside pre tags
Changes since v055
1) add "ePub Nav" as title to newly created nav.xhtml
2) make sure NCX uid always exactly matches OPF uniqueid meta value
Changes since v051
1) make start folder for output much smarter
2) set spine nav attribute to linear="no" if html toc exists in guide
Changes since v050
1) fix missing title tag in head of nav
Changes since v041
1) update it to use the new plugin interface in Sigil 1.0 and
to work with epubs with non-standard layouts
2) should continue to work with Sigil versions before Sigil 0.9.991
3) removes support for SMIL updating as Sigil properly handles that in epub3
Changes since v040
1) fix typo in nav labeling code
2) convert "big" tags that are not in html5 to "span" tags with inline style equivalent
Changes since v039
1) make new opf id generation more robust to prevent id clashes
2) update to my new icon until the vote is complete
3) recognize calibre:title_sort and convert to its epub3 equivalent
Changes since v038
1) remove any charset attributes from link elements
2) recognize calibre:series and calibre:series_index metadata and convert to epub3 equivalent
3) add a plugin.png icon to work with the next version of Sigil
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
ePub3-itizer v058 supports all Sigil versions back to Sigil 0.8.6.
ePub3-itizer v060 supports Sigil 2.0.0 versions and later.
Before Conversion
1. Make sure your epub2 validates under 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
- 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