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 08-14-2017, 05:40 PM   #1
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,582
Karma: 22735033
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
}
delete_epub_type: Change this value to true, if you want the plugin to delete epub:type attributes. (By default, they'll be changed to class attributes.)

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)
Attached Files
File Type: zip ePub2_v0.2.7.zip (12.3 KB, 1736 views)

Last edited by Doitsu; 12-05-2019 at 04:22 AM. Reason: New version with better Sigil 1.0 support
Doitsu is offline   Reply With Quote
Old 08-15-2017, 10:08 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: 27,463
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Thanks! I'll get it added to the plugin index later today.
DiapDealer is offline   Reply With Quote
Old 12-01-2019, 03:59 AM   #3
Heuswaar
Junior Member
Heuswaar began at the beginning.
 
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'
Heuswaar is offline   Reply With Quote
Old 12-01-2019, 04:19 AM   #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,582
Karma: 22735033
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>
To fix this issue, add and delete a space in an HTML file and save the epub with Sigil. This'll add the missing time stamp.
Doitsu is offline   Reply With Quote
Old 12-05-2019, 04:28 AM   #5
Heuswaar
Junior Member
Heuswaar began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Feb 2016
Device: Sony T2
Thank You, it now works if i add de date.
Heuswaar is offline   Reply With Quote
Old 05-28-2020, 10:19 AM   #6
Heuswaar
Junior Member
Heuswaar began at the beginning.
 
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.
Heuswaar is offline   Reply With Quote
Old 05-28-2020, 12:07 PM   #7
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,582
Karma: 22735033
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':
to

Code:
        if dc_property == 'role' and dc_id is not None:
If it still doesn't work, do an epub to epub conversion with Calibre. This should convert your epub3 book to an epub2 book.
Doitsu is offline   Reply With Quote
Old 05-29-2020, 05:59 AM   #8
Heuswaar
Junior Member
Heuswaar began at the beginning.
 
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
Heuswaar is offline   Reply With Quote
Old 12-01-2021, 01:04 PM   #9
Camelot
Connoisseur
Camelot began at the beginning.
 
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">
After:
Code:
<div class="fussnotenzaehler" style="display: none;">
I don't know why the publisher set the footnotes as hidden.

The second problem is the missing counters in a list (nav).
Before:
Code:
<ol>
After:
Code:
<ol style="list-style-type: none;">
Can they fix that, or add an option (false/true) in the ePub2.json?
Example epup3 is attached
Attached Files
File Type: epub example.epub (10.7 KB, 221 views)
Camelot is offline   Reply With Quote
Old 12-01-2021, 02:13 PM   #10
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,582
Karma: 22735033
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;'
Doitsu is offline   Reply With Quote
Old 12-01-2021, 03:16 PM   #11
Camelot
Connoisseur
Camelot began at the beginning.
 
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.
Attached Thumbnails
Click image for larger version

Name:	counters.png
Views:	143
Size:	11.6 KB
ID:	190586  
Camelot is offline   Reply With Quote
Old 12-01-2021, 04:17 PM   #12
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,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Camelot View Post
Thank you Doitsu, but when deleting or comment out the nav section, the footnotes has double counters.
In that case, you'll have to manually edit the epub2 book to fix this problem.
Doitsu 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 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


All times are GMT -4. The time now is 05:32 AM.


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