08-14-2017, 05:40 PM | #1 |
Grand Sorcerer
Posts: 5,626
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
|
[Plugin] epub2 output
Updated: December 5, 2019
Current Version: "0.2.7" This simple plugin will convert most valid commercial epub3 fiction books to valid epub2 books for use with older epub2 apps and readers. (Some post-editing might still be required.) Note that this plugin is not a full-fledged epub3 converter; it handles only the most frequently used epub3 tags and attributes and won't work with enhanced epub3 books that contain JavaScript, MathML, audio, video or SMIL files. This plugin does not support non-standard epubs. Select Tools > Restructure Epub to Sigil Norm before running this plugin with Sigil 1.0 and higher. Installation: 1. Select Manage Plugins from the Plugins menu and select Use Bundled Python, if it isn't already selected. 2. Click Add Plugin and select ePub2_v0.2.7.zip. This will install the epub2 output plugin, which you can select via Plugins > Output > ePub2. Settings: The plugin doesn't come with a GUI, but a couple of settings can be changed via ePub2.json entries: Code:
{ "delete_epub_type": false, "output_dir": "C:\\Users\\User\\Desktop", "ncx_from_nav": false } output_dir: Change this path, if you don't want the plugin to write epub2 files to the Desktop. (Note that on Windows machines, you'll need to use two backslashes in path names.) ncx_from_nav: Change this value to true, if you want the plugin to always generate a new toc.ncx file from the Nav xhtml file. License: GNU General Public License v3 (GPL-3) Last edited by Doitsu; 12-05-2019 at 04:22 AM. Reason: New version with better Sigil 1.0 support |
08-15-2017, 10:08 AM | #2 |
Grand Sorcerer
Posts: 27,698
Karma: 196509000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Thanks! I'll get it added to the plugin index later today.
|
Advert | |
|
12-01-2019, 03:59 AM | #3 |
Junior Member
Posts: 5
Karma: 10
Join Date: Feb 2016
Device: Sony T2
|
It don't work anymore
I get the following warning:
Status: failed Processing content.opf... ibooks: http://vocabulary.itunes.apple.com/r...xtensions-1.0/ package prefix attribute deleted. Package updated. Traceback (most recent call last): File "D:\Program Files\Sigil\plugin_launchers\python\launcher.py", line 135, in launch self.exitcode = target_script.run(container) File "C:\Users\boeke\AppData\Local\sigil-ebook\sigil\plugins\ePub2\plugin.py", line 207, in run timestamp.string = timestamp.string[0:10] AttributeError: 'NoneType' object has no attribute 'string' Error: 'NoneType' object has no attribute 'string' |
12-01-2019, 04:19 AM | #4 |
Grand Sorcerer
Posts: 5,626
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
|
Please check all epub3 books with EpubCheck before running this plugin, because it might fail if the input file is invalid.
The plugin failed because there's no time stamp entry in the .opf file. (Time stamps are mandatory in epub3 files.) Time stamps look like this: Code:
<meta property="dcterms:modified">2019-12-01T10:06:19Z</meta> |
12-05-2019, 04:28 AM | #5 |
Junior Member
Posts: 5
Karma: 10
Join Date: Feb 2016
Device: Sony T2
|
Thank You, it now works if i add de date.
|
Advert | |
|
05-28-2020, 10:19 AM | #6 |
Junior Member
Posts: 5
Karma: 10
Join Date: Feb 2016
Device: Sony T2
|
I get the following warning:
Status: failed Processing content.opf... ibooks: http://vocabulary.itunes.apple.com/r...xtensions-1.0/ calibre: https://calibre-ebook.com package prefix attribute deleted. Package updated. Mapping refines... "Krinar-kronieken 0,5 - De Krinar-onthulling" file:as refines title attribute mapped to calibre:title_sort attribute "main" title-type refines property IGNORED. "Zaires, Anna" file:as refines attribute mapped to opf:file-as attribute "aut" role refines attribute mapped to opf:role attribute "Ivers, Hettie" file:as refines attribute mapped to opf:file-as attribute "aut" role refines attribute mapped to opf:role attribute "series" collection-type refines property IGNORED. "Krinar-kronieken" belongs-to-collection refines attribute mapped to calibre:series attribute "0.5" group-position refines attribute mapped to calibre:series_index attribute Traceback (most recent call last): File "D:\Program Files\Sigil\plugin_launchers\python\launcher.py", line 136, in launch self.exitcode = target_script.run(container) File "C:\Users\boeke\AppData\Local\sigil-ebook\sigil\plugins\ePub2\plugin.py", line 215, in run metadata.find(id=dc_id)['opf:role'] = refine.string TypeError: 'NoneType' object does not support item assignment Error: 'NoneType' object does not support item assignment Date en Time are good. |
05-28-2020, 12:07 PM | #7 |
Grand Sorcerer
Posts: 5,626
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
|
The book metadata section most likely contains invalid refine entries.
Check the book with my EPUBCheck plugin and fix all metadata errors. If you don't get any error messages, try the following: 1. In Sigil, select Edit > Preferences > Open Preferences Location. 2. Go to plugins\ePub2 and open plugin.py with a text editor. 3. Change line 215 from: Code:
if dc_property == 'role': Code:
if dc_property == 'role' and dc_id is not None:
|
05-29-2020, 05:59 AM | #8 |
Junior Member
Posts: 5
Karma: 10
Join Date: Feb 2016
Device: Sony T2
|
I have a on-line conversion done, and then all problems fixt.
Thank you |
12-01-2021, 01:04 PM | #9 |
Connoisseur
Posts: 53
Karma: 10
Join Date: Feb 2015
Device: Sony PRS-T1
|
My friend has a problem with footnotes from original books (epub3 → epup2).
The first - most important - problem is the missing clickable backlinks in the footnotes. Before: Code:
<div class="fussnotenzaehler" hidden="hidden"> Code:
<div class="fussnotenzaehler" style="display: none;"> The second problem is the missing counters in a list (nav). Before: Code:
<ol> Code:
<ol style="list-style-type: none;"> Example epup3 is attached |
12-01-2021, 02:13 PM | #10 |
Grand Sorcerer
Posts: 5,626
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
|
Since style="display: none;" and style="list-style-type: none;" are the closest epub 2 equivalents of most epub 3 hidden attributes, there's no preference setting for suppressing these attributes, and I won't add one.
If your friend doesn't like this behavior, they can simply delete the following lines marked in red from plugin.py or comment them out: Code:
#------------------------------------------
# replace all HIDDEN attributes
#-----------------------------------------
hidden_tags = soup.find_all(re.compile('.*?'), {'hidden' : re.compile('.*?')})
for hidden_tag in hidden_tags:
print('<' + tag_value.replace('_', ':') + '>', 'hidden attribute deleted.')
del hidden_tag['hidden']
hidden_tag['style'] = 'display: none;'
and: Code:
# hide NAV toc list item marker
if tag_value == 'toc':
ordered_lists = tag.find_all('ol')
for ol in ordered_lists:
ol['style'] = 'list-style-type: none;'
|
12-01-2021, 03:16 PM | #11 |
Connoisseur
Posts: 53
Karma: 10
Join Date: Feb 2015
Device: Sony PRS-T1
|
Thank you Doitsu, but when deleting or comment out the nav section, the footnotes has double counters.
|
12-01-2021, 04:17 PM | #12 |
Grand Sorcerer
Posts: 5,626
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Conversion Output] KePub Output Plugin | jgoguen | Plugins | 551 | 07-18-2023 06:22 AM |
[Plugin] ePub3-itizer - epub3 output plugin for Sigil | KevinH | Plugins | 435 | 01-19-2023 09:46 PM |
[Plugin] KePub Output | djazz | Plugins | 35 | 12-22-2019 07:42 PM |
HTMLZ output plugin? | Toxaris | Plugins | 12 | 01-06-2015 07:39 AM |
Plugin not customizable: Plugin: HTML Output does not need customization | flyingfoxlee | Conversion | 2 | 02-24-2012 02:24 AM |