View Single Post
Old 07-07-2017, 04:40 AM   #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] StyleBender

Manipulates, moves or removes styling at block level in both epubs and imported html docs

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

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 StyleBender_vXXX.zip. This will load and install the plugin into Sigil, which you can then select and run using Plugins > Edit > StyleBender

Description
This is an edit plugin that gives you various options to move or remove html styles, inline styling and create stylesheets at block level. This plugin can also be used for for both epubs and imported html docs. If you use html docs with this plugin please ensure that they are derived only from the following doctypes: Word doc and docx(html filtered only), ODF(OO and LO docs only), GoogleDoc(as html, zipped) or AbiWord.

To load an html doc into Sigil, first open Sigil and go to Edit > Preferences > General Settings > Mend XHTML Source Code On: and set this to Open and then save it(you only have to do this once). Now you can load the html file in the normal way using File > Open(ensure File Types is set to html).

User Options(via dialog)
  • Move the html <style> section & all inline styling to new stylesheets (imported html only)
  • Move only the html <style> section to a new stylesheet (imported html only)
  • Move only the inline styling to a new stylesheet (imported html only)
  • Remove all html styles(classes) from the html
  • Remove all inline styling from the html
  • Remove all tag attributes from the html(removes all styling and leaves just the html tags)
Plugin Run
First load your epub or html doc into Sigil and then just run this plugin.

Comment
For best results and to avoid problems I would also advise that you should always run the CustomCleanerPlus plugin before running the StyleBender plugin. Using the CustomCleanerPlus plugin will ensure that the html code is both epub 2 compliant and clean which will also help to greatly reduce validation errors further on down the line when you run Epubcheck. I specifically created these two plugins to help save some cleanup and formatting time for those folks who prefer creating their epub ebooks in raw html using Sigil.

Changes

Spoiler:

v0.1.4
-- Added MIT SW Licence
v0.1.3
-- Increased dialog window font size for better readability on Macs.
v0.1.2
-- Added file type status notification in user dialog window.
v0.1.1
-- Removed OSX and Linux restrictions in plugin.xml.
v0.1.0
-- Initial release
Attached Files
File Type: zip StyleBender_v014.zip (949.4 KB, 1623 views)

Last edited by slowsmile; 11-06-2017 at 09:17 PM.
slowsmile is offline   Reply With Quote