MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Plugins (https://www.mobileread.com/forums/forumdisplay.php?f=268)
-   -   [Plugin] StyleBender (https://www.mobileread.com/forums/showthread.php?t=288373)

slowsmile 07-07-2017 05:40 AM

[Plugin] StyleBender
 
2 Attachment(s)
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

roger64 07-07-2017 05:35 PM

1 Attachment(s)
Hi

Thank you for your nice efforts. Unhappily I could not install this plugin (contrary to CustomCleanerPlus) on Sigil 0.9.7. (ArchLinux 64). I have Python 3.6.1.

slowsmile 07-07-2017 07:07 PM

@roger64...I've been having some trouble with Arch Linux in this thread regarding the user dialog display text layout for both the StyleBender and CustomCleanerPlus plugins.

What I've done to remedy your problem is that I have now taken off StyleBender's restrictions on using Linux and OSX(which was in plugin.xml) so you should now be able to use the StyleBender plugin on your Arch Linux computer without any problems.

Just download the new version of StyleBender(v0.1.1) and it shuld work on Arch Linux and OSX.

I put these os restrictions on StyleBender because I could not physically test it on Linux or OSX - even though I've put the appropriate code into StyleBender and CustomCleanerPlus to accomodate OSX and Linux.

I would also be very grateful if you could let me know on this thread if both StyleBender and CustomCleanerPlus are now working OK on Arch Linux(ie no dialog display layout problems). Much thanks.

roger64 07-08-2017 03:26 AM

Hi

Sorry for a late reply due to time zone constraints.

011 version of the plugin is installed correctly and is working now for me. I tried it on a correct enough Epub. Out of the six possible choices, the first three were greyed out. I suppose that this is normal due to the fact that I did not use any inline styling?

CustomCleanerPlus is displayed and works correctly on my ArchLinux 64. I tried it with two items -setting width for some images and suppressing divs- and the result was OK.

slowsmile 07-08-2017 10:01 AM

@roger64...Thanks very much for that. And since people have recently reported that the plugin works on both Ubuntu and Arch Linux I'll now allow this app for Linux I think.

Regarding the three items that were greyed out -- the first three items will always be greyed out if you are using StyleBender on epubs because there is no html css in epub html(all epub css should be in the Styles directory). So "move all styles..." and "move html styles..." are not allowed to be used with epub input. "Move inline styles..." was also greyed out because it was too complicated to do it for epubs. And anyway, there's already a Sigil plugin for moving inline styles to a css for epubs -- I think its called RemoveInlineStyles. There's no need to re-invent the wheel...

If you use StyleBender with an imported html file, then all chkbuttton options will be available in the dialog display.

Thanks again for helping out.


All times are GMT -4. The time now is 08:51 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.