![]() |
#1 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13
Karma: 1000
Join Date: Oct 2014
Device: bq cervantes
|
smoothRemove_v010 plugin for Sigil
Hi to everybody!!
I have the pleasure of introduce to you this simple plugin: smoothRemove in its version 0.1.0. This plugin is designed to help you when you need a complete remove formatting with the exception of that the code will keep some tags. So if you do a copy/paste from a WYSIWYG to Sigil then you could run this plugin and make remove formatting but maintaining bold, italic, underline texts and headings, paragraphs and lists. Disclaimer: I hope it will be usefull but it isn't a perfect code, it's a beta version. So save all your ePub in Sigil before running this plugin. Credits: By kbanelas. But I want to thank to everybody who supported me, overall, because, they never thought being wasting time to talk to me. They just trusted me. Thanks again. System requirements Before installing this plugin, please make sure that the system requirements are met. To be able to use this plugin, you'll need Python 2.7.x To find out whether Python 2.7.x is installed, enter the following command in a terminal/command prompt window: python -V (should display Python 2.7.x) Installation 1. Select Manage Plugins from the Plugins menu. If the Python 2.7 text box is empty, click Auto to detect the path or Set to manually select the Python folder. 2. Click Add Plugin and select smoothRemove_v010.zip. This will install the plugin, which you can select via Plugins > edit> smoothRemove> Start. How to use smoothRemove 1. Select the method: a) All : for all file in the eBook Then press Apply. You will look the changes when press Quit.b) Some files: mark the files corresponding ATTENTION: Don't use this plugin with the cover, so if you have one, don't select a complete smoothRemove, only select the files in that you are interested. That's all. Thanks. Cheers!! |
![]() |
![]() |
![]() |
#2 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,434
Karma: 5702578
Join Date: Nov 2009
Device: many
|
Hi,
If there is a moderator around, would you please add this thread to the sticky Sigil Plugin Index so that it can be found by everyone. Thanks, |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Nov 2016
Device: none
|
can someone upgrade this plugin so that it can be use in the last version of Sigil?
|
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,335
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
I can look to see what kind of effort it would take to port it, but I would prefer to wait for the original contributor to chime in first. If the plugin appears to be abandoned, we will, of course, accept updates from contributors. |
|
![]() |
![]() |
![]() |
#5 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,679
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
@Crick: You might find the following plugins helpful: TagMechanic (allows you to modify or delete attributes/tags ) RemoveInLineStyles (converts inline styles to CSS selectors) cssRemoveUnusedSelectors (removes unused CSS selectors) IMHO, TagMechanic will give you much more control over the tags that'll be deleted or modified. SmoothRemove is more like a sledgehammer. @DiapDealer: Instead of updating the smoothRemove plugin It might make more sense to add a "nuclear option" to the TagMechanic plugin that'll remove all attributes that can be safely removed without making the HTML file invalid. (For example, it shouldn't remove the html xmlns attribute.) Last edited by Doitsu; 11-29-2016 at 04:48 AM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,335
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
@Doitsu Thanks! I'll take a look. This plugin is not one I'm remotely familiar with. I'll see what makes the most sense (when I get some time).
|
![]() |
![]() |
![]() |
#7 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,434
Karma: 5702578
Join Date: Nov 2009
Device: many
|
I looked at the plugin.py file. The Tk stuff will have to be updated but most of the real work is done in Remove which uses regular expressions to simply strip off all attributes from a specified set of tags inside a body tag.
If you don't have time, I would be happy to try to make a version that will work with both python2.7 and 3.4 so that the new version will still work for people using older Sigil versions that still support python 2.7. Just let me know. KevinH |
![]() |
![]() |
![]() |
#8 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,335
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
If you want to take a stab at it, then yes ... go ahead. If I did it, I'd probably wind up ignoring the 2.7 compatibility. I don't think I have a version of Sigil installed anywhere that I could even test 2.7 compatibility with anymore.
![]() I do know there's a lot of imports that go unused in the plugin. I assume the creator had future plans they never got around to implementing. |
![]() |
![]() |
![]() |
#9 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13
Karma: 1000
Join Date: Oct 2014
Device: bq cervantes
|
If someone wants to update the plugin, there is no problem for me. I would do it myself but I do not have time.
I send you a nice greeting. |
![]() |
![]() |
![]() |
#10 | |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 119
Karma: 64428
Join Date: Aug 2011
Device: none
|
Quote:
|
|
![]() |
![]() |
![]() |
#11 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,679
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Code:
self.OPENTAG = ['<p','<b','<i','<u','<h1','<h2','<h3','<h4','<h5','<h6','<ol','<ul','<li','<body']
Code:
self.CLOSETAG = ['</p>','</b>','</i>','</u>','</h1>','</h2>','</h3>','</h4>','</h5>','</h6>','</ol>','</ul>','</li>','</body>','</html>']
IMHO, pretty much everything that this plugin does, can be achieved by a simple regex search: Find:<(p|b|i|u|h[1-6]|ol|ul|li|body) [^>]+> Replace:<\1> (My regex search string isn't perfect either, but it's slightly more robust than the one used in the plugin code.) |
|
![]() |
![]() |
![]() |
#12 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,623
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Quote:
Why do you spare spans of that pruning treatment? (and divs BTW) ![]() |
|
![]() |
![]() |
![]() |
#13 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,679
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Find:<(div|span|p|b|i|u|h[1-6]|ol|ul|li|body) [^>]+> If you ever consider using this regex, might want to create a backup copy and run KevinH's RemoveInLineStyles plugin first. This will add the original inline styles to the main stylesheet and allows you to add them back via class attributes if you find out that some of them were actually needed. Last edited by Doitsu; 12-11-2016 at 03:21 AM. |
|
![]() |
![]() |
![]() |
#14 | |||
Enthusiast
![]() Posts: 26
Karma: 10
Join Date: Dec 2012
Device: nook
|
Quote:
Quote:
replace: <\1> I end up with a bunch of <span> & </span> left over as seen below: Quote:
SmoothRemove used to remove the extras, but leave italics and bolds. SmoothRemove will not install on my Windows 10 x64 computer - it says it is not compatible with the OS. Any further ideas? (please note that I know the basics, but am not an expert at Sigil/CSS coding) Thanks for your help. Last edited by ebookreadr; 01-27-2017 at 02:50 AM. |
|||
![]() |
![]() |
![]() |
#15 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,679
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Code:
<(div|p|b|i|u|h[1-6]|ol|ul|li|body) [^>]+> |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
epubcheck plugin for Sigil | Doitsu | Plugins | 539 | 04-19-2025 08:45 AM |
kindlegen plugin for Sigil | Doitsu | Plugins | 173 | 10-15-2024 02:51 AM |
[Plugin] PunctuationSmarten Sigil plugin | DiapDealer | Plugins | 138 | 07-11-2023 11:22 AM |
[Plugin] KindleImport Sigil plugin | DiapDealer | Plugins | 187 | 07-04-2022 10:11 AM |
Sigil Plugin Index | Thasaidon | Plugins | 0 | 10-04-2014 07:41 AM |