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 10-31-2017, 10:23 PM   #1
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
[Plugin] NormalizeScrivEpub

Reformats and normalizes Scrivener epubs

Requirements
Plugin Type: Edit
Minimum Sigil requirement: v0.9.3 or higher
Python Requirements: Python 3.4+ (Bundled or External)
OS Requirements: Windows, Linux or OSX
*** Tested on Windows 7, 8 & 10 only ***
Current Version: "0.1.3"

Installation
* Select Manage Plugins from the Plugins menu. In the dialog box, select either the Bundled Python or the External Python(Python 3.4+ should be installed on your computer to run this plugin externally).

* Click Add Plugin and select NormalizeScrivEpub_vXXX.zip. This will load and install the plugin into Sigil, which you can then select and run the plugin by selecting Plugins > Edit > NormalizeScrivEpub.

Description
This simple edit plugin addresses some of the niggles I've had in the past with my own Scrivener conversions to epub. This plugin should only be used with Scrivener-generated epubs and does the following:

* Optionally converts the styling of all main headings(which are all formatted with <p> tags in Scrivener epubs) to <h1> tags.

* The user can also directly format the new <h1> tags from plugin prefs to more easily pre-style the new headings in the epub before running the plugin.

* The plugin will also automatically remove Scrivener's TOC file(contents.xhtml) and replace it with another more stylish standard TOC(Level 1 only).

* Reformats all ebook image dimensions as percentages of screen height/width. This will ensure correct display of smaller images across all epub ereaders and KF8 devices(added in v0.1.2). If specifically uploading to Kindle then the AddKindleMediaQueries plugin should also be run on the epub(for Kindle uploads only) to ensure that all smaller ebook images are correctly dual formatted for proper display across all KF8 and older KF7(mobi7) Kindle devices.

* A new toc css file will also be created in the epub.

* Converts all epub text and headings to default serif throughout.

* Formats all epub links in standard blue with underline.

* Adds globals and presets to stylesheet.css to help avoid Look Inside issues on KDP upload.

Adjusting Heading 1 Style
If required, you can pre-style and change the default set_h1_style properties in plugin prefs before you run the plugin. Or you can simply re-style h1 in the main stylesheet after you run the plugin. The default prefs for this plugin looks like this:
{
"set_h1_style": "h1 {\nfont-size: 1.167em;\nfont-weight: bold;\ntext-align: center;\ntext-indent: 0em;\n}\n",
"add_h1_tags": true
}

The add_h1_tags option allows the user to completely control heading 1 formatting. If set to true, heading p tags will be converted to h1 tags and the appropriate h1 styling will be added to the css. If set to false by the plugin user then the p tag to h1 tag transformation will be prevented. The default setting for this property is true.(added in v0.1.1)

Caveat
* Make sure that you run this plugin directly after conversion to epub from Scrivener otherwise you may have problems i.e do any manual formatting/changes to your epub in Sigil after running this plugin.

* Please also ensure that all internal links are appropriately formatted in your epub before you run this plugin, otherwise heading duplications or other problems might occur in the new epub after you run this plugin.

* All table styling will be removed from the epub stylesheet. It's perhaps better and easier(less probematic for vendor upload conversions) if you convert your tables to compressed jpeg images first and then add them as images to your scriv doc before conversion to epub.

Plugin Run
First load your epub into Sigil, set the h1 styling that you want in plugin prefs, then just run the plugin.

I'm not really sure how useful this plugin will be to Scrivener epubbers. It does two main tasks. First, I use this plugin to more quickly reformat and properly finish-off the epub as described above. Second, this plugin can optionally transform all major headings formatted with p tags to h1 tags and will also create a better TOC. The real purpose of doing this is to allow scriv epubbers to use more Sigil plugins that depend on h1 headings for proper operation(like some of my other plugins).

Changes:
Spoiler:

v0.1.3
-- Fixed a bug caused by an incorrect css id in the opf file.
v0.1.2
-- Added functionality. Now reformats all ebook image dimensions as percentages of screen width/height. See Description for more details.
v0.1.1
-- Added functionality. The user now has a prefs option to completely control the transformation of p tag headings to h1 styled headings. See release notes -- Adjusting Heading 1 Style -- for details
v0.1.0
-- Initial release
Attached Files
File Type: zip NormalizeScrivEpub_v013.zip (50.0 KB, 858 views)

Last edited by slowsmile; 08-07-2018 at 04:22 AM.
slowsmile is offline   Reply With Quote
Old 11-01-2017, 09:41 PM   #2
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
Update: The plugin has new functionality(v0.1.1):

* The new plugin prefs add_h1_tags option now allows the user to completely control heading 1 formatting. If set to true, heading p tags will be converted to h1 tags and the appropriate h1 styling will be added to the css. If set to false then the p tag to h1 tag transformation will be prevented. The default setting for this property is true. See release notes -- Adjusting Heading 1 Style -- for more details.

Also be aware that if your version of this plugin has been updated then all previously added user formatting for the set_h1_style pref will be lost(set to default) and will have to be added again after the update.

Last edited by slowsmile; 11-01-2017 at 11:11 PM.
slowsmile is offline   Reply With Quote
Advert
Old 11-03-2017, 06:47 PM   #3
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
Update: Added new functionality(v0.1.2):

* Now automatically reformats all ebook image dimensions as percentages of screen height/width. This will ensure correct display of smaller images across all epub ereaders and KF8 devices(added in v0.1.2).

If you are uploading your epub to KDP, then you should also run the AddKindleMediaQueries plugin on your epub to ensure proper smaller image displays on all Kindle KF8 and KF7(mobi7) devices only. AddKindleMediaQueries will dual format all ebook images(for KDP uploads only) to ensure and normalize smaller ebook image displays(that are less than 100% screen width) across all Kindle devices.

Last edited by slowsmile; 11-09-2017 at 07:39 PM.
slowsmile is offline   Reply With Quote
Old 11-03-2017, 11:00 PM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,661
Karma: 127838198
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by slowsmile View Post
* All table styling will be removed from the epub stylesheet. It's perhaps better and easier(less probemtic for vendor upload conversions) if you convert your tables to compressed jpeg images first and then add them as images to your scriv doc before conversion to epub.
That is a really bad idea. The problem is that you either have a graphic that's too small to be clearly read on a hi-res eInk screen or you have a graphic that's too large for a low-res eInk screen. And then there's the problem of matching the text size of the graphic with the text size of the real text. So as long as the table works in the ePub, don't mess with it.
JSWolf is offline   Reply With Quote
Old 11-04-2017, 12:15 AM   #5
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
@JSWolf...Generally, displaying tables as gif or jpg images is the way most people do it in epubs. I've also done it in some of my generic epubs quite successfully. But there are certain rules that you must follow when you format tables as images. For instance Kindle image compression will make all image lines and fonts thinner. To avoid this problem of "stringy" or thin image fonts all you have to do is either use a thicker font like arial or just make the font bold. And I've never had a problem sizing fonts for image displays. This really shouldn't be a problem if you test it properly and adjust font size appropriately. And whenever I have created tables in ebooks I always usually use cell fonts that are slightly bigger than the body text anyway. This makes the table easier to read on smaller devices and also helps to reduce font "stringiness" issues.

Last edited by slowsmile; 11-04-2017 at 07:49 AM.
slowsmile is offline   Reply With Quote
Advert
Old 08-07-2018, 04:06 AM   #6
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
Update Plugin: Fixed a bug caused by an incorrect css id in the opf file(v0.1.3)
slowsmile 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
[FileType Plugin] YVES Bible Plugin ClashTheBunny Plugins 27 01-16-2023 01:25 AM
Goodread Perception Expander plugin not shown on plugin list (kobo h2o) www KOReader 4 09-28-2017 10:34 AM
Problem with my ScrambleEbook plugin and the Plugin Updater tool jackie_w Development 14 01-19-2017 10:49 PM
Plugin not customizable: Plugin: HTML Output does not need customization flyingfoxlee Conversion 2 02-24-2012 02:24 AM
New Plugin Type Idea: Library Plugin cgranade Plugins 3 09-15-2010 12:11 PM


All times are GMT -4. The time now is 09:19 AM.


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