Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 09-04-2019, 12:55 AM   #31
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,599
Karma: 4798866
Join Date: Mar 2015
Device: Kindle, iOS
Greetings!

This wonderful plug-in is failing when I run it in Sigil 0.9.18 :(

Here's the error message:

Code:
Status: failed

Traceback (most recent call last):
File "/Applications/Sigil.app/Contents/plugin_launchers/python/launcher.py", line 135, in launch
self.exitcode = target_script.run(container)
File "/Users/oda/Library/Application Support/sigil-ebook/sigil/plugins/cssRemoveUnusedSelectors/plugin.py", line 600, in run
css_to_change[sel_data[0]] = sel_data[4].cssText
File "site-packages/css_parser/css/cssstylesheet.py", line 139, in _getCssText
File "/Users/oda/Library/Application Support/sigil-ebook/sigil/plugins/cssRemoveUnusedSelectors/customCssutils.py", line 53, in do_CSSStyleSheet
text = self._linenumnbers(self.prefs.lineSeparator.join(out))
AttributeError: 'MyCSSSerializer' object has no attribute '_linenumnbers'
Error: 'MyCSSSerializer' object has no attribute '_linenumnbers'
Any help great appreciated. Thank you!

Last edited by odamizu; 09-04-2019 at 01:51 AM.
odamizu is offline   Reply With Quote
Old 09-04-2019, 01:37 AM   #32
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,611
Karma: 23187563
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by odamizu View Post
This wonderful plug-in is failing when I run it in Sigil 0.9.18 — guessing something to do with the replacement of cssutils module with new css-parser??
Please edit customCssutils.py in the cssRemoveUnusedSelectors plugin folder and change line 53

from

Code:
        text = self._linenumnbers(self.prefs.lineSeparator.join(out))

to:

Code:
        text = self._linenumbers(self.prefs.lineSeparator.join(out))
Doitsu is offline   Reply With Quote
Advert
Old 09-04-2019, 01:50 AM   #33
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,599
Karma: 4798866
Join Date: Mar 2015
Device: Kindle, iOS
Quote:
Originally Posted by Doitsu View Post
Please edit customCssutils.py in the cssRemoveUnusedSelectors plugin folder and change line 53 ...
Awesome! for the speedy and simple fix!

I'm not even going to wonder why that typo hasn't caused a problem before.
odamizu is offline   Reply With Quote
Old 09-04-2019, 04:42 AM   #34
wrCisco
Enthusiast
wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.
 
Posts: 34
Karma: 467802
Join Date: Apr 2016
Device: none
That was a systematic typo in cssutils that some overzealous would-be developer corrected in the upgrade to css-parser...

When I have the time I will add a new version of the plugin that will directly use the new serializer.

In the meantime to Doitsu for the ready handmade patch.
wrCisco is offline   Reply With Quote
Old 09-04-2019, 10:51 PM   #35
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,599
Karma: 4798866
Join Date: Mar 2015
Device: Kindle, iOS
Quote:
Originally Posted by wrCisco View Post
That was a systematic typo in cssutils that some overzealous would-be developer corrected in the upgrade to css-parser...


Quote:
When I have the time I will add a new version of the plugin that will directly use the new serializer.
I love your plugin. I use it often.
odamizu is offline   Reply With Quote
Advert
Old 09-07-2019, 05:47 PM   #36
wrCisco
Enthusiast
wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.
 
Posts: 34
Karma: 467802
Join Date: Apr 2016
Device: none
Just uploaded version 0.3.1 of the plugin, which adds compatibility with css-parser and Sigil 0.9.18 (secondarily, it shows some minor GUI improvements).

Quote:
Originally Posted by odamizu View Post
I love your plugin. I use it often.
I'm glad to hear that.
wrCisco is offline   Reply With Quote
Old 09-07-2019, 06:57 PM   #37
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,621
Karma: 194727102
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Just curious: was there some serious jury-rigging you were doing to get cssutils to work (or were you including your own cssutils) or something? just curious why this typo didn't cause trouble before now. We made sure that all calls to import any part of cssutils were hijacked and silently redirected to the equivalent css_parser pieces when we made the change. That was done specifically so any plugins that used cssutils could still work (giving the dev time to change to css_parser at their leisure). Sorry that didn't seem to work for your plugin.
DiapDealer is online now   Reply With Quote
Old 09-07-2019, 07:08 PM   #38
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,743
Karma: 5446592
Join Date: Nov 2009
Device: many
wrCisco fixed the typo in css-parser when he ported his improvements over for us into css-parser. I had forgotten that typo worked "as is" in cssutils but since it was fixed in css-parser it created this plugin issue which he has now fixed!
KevinH is online now   Reply With Quote
Old 09-07-2019, 07:43 PM   #39
wrCisco
Enthusiast
wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.
 
Posts: 34
Karma: 467802
Join Date: Apr 2016
Device: none
The plugin includes a sublcass of the cssutils's serializer, and in that subclass I had to copy some parent's methods in full along with the typo in order to add some lines of code in between to circumvent some issues with the old serializer.

Since the typo was in a private attribute, it's probably just me that's been hit by myself...
wrCisco is offline   Reply With Quote
Old 09-07-2019, 08:08 PM   #40
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,621
Karma: 194727102
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Ah... I get it now. Thanks! I'd forgotten you were the one who was helping Kevin and Kovid get css-parser up and going.
DiapDealer is online now   Reply With Quote
Old 09-08-2019, 01:26 AM   #41
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,599
Karma: 4798866
Join Date: Mar 2015
Device: Kindle, iOS
Quote:
Originally Posted by wrCisco View Post
Just uploaded version 0.3.1 of the plugin, which adds compatibility with css-parser and Sigil 0.9.18 (secondarily, it shows some minor GUI improvements).
odamizu is offline   Reply With Quote
Old 06-25-2020, 10:37 AM   #42
mcdummy
Connoisseur
mcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the rough
 
mcdummy's Avatar
 
Posts: 56
Karma: 7130
Join Date: Apr 2015
Device: PRS-T3
Hi wrCisco,

Could you also add a feature that does the opposite, i.e. looks in the html/xhtml/xml files for classes that are used in these files, but do not have a corresponding defintion in the css file?

I've downloaded several ebook from gutenberg.org, which did not provide definitions for all classes used in the html/... files. Since I guess that the creator intended to have a special formating of the corresponding text passages, but forgot to add the defintions to the css, it would be good to be informed about the missing defintions to be able to format these passages.

Regards,

McDummy
mcdummy is offline   Reply With Quote
Old 06-25-2020, 12:16 PM   #43
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 36,873
Karma: 147879470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by mcdummy View Post
Hi wrCisco,

Could you also add a feature that does the opposite, i.e. looks in the html/xhtml/xml files for classes that are used in these files, but do not have a corresponding defintion in the css file?

I've downloaded several ebook from gutenberg.org, which did not provide definitions for all classes used in the html/... files. Since I guess that the creator intended to have a special formating of the corresponding text passages, but forgot to add the defintions to the css, it would be good to be informed about the missing defintions to be able to format these passages.

Regards,

McDummy
You could use the Reports tool. The Classes Used report will show undefined classes at the top of the report with no matched selector or found in. See attached image.

And yes, this is a commercial book I'm cleaning up for my wife.. If you want really bad examples, check for ebooks created by Vellum.
Attached Thumbnails
Click image for larger version

Name:	css_classes_used_report.png
Views:	277
Size:	63.9 KB
ID:	180188  
DNSB is offline   Reply With Quote
Old 06-25-2020, 12:39 PM   #44
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by DNSB View Post
You could use the Reports tool. The Classes Used report will show undefined classes at the top of the report with no matched selector or found in.
But you'd still need to go in and manually remove them, one by one. A coworker of mine had a useful phrase about automated things like this; "Never send a man to do a computer's job" (a twist on the old proverb).
hobnail is offline   Reply With Quote
Old 06-25-2020, 01:07 PM   #45
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 36,873
Karma: 147879470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by hobnail View Post
But you'd still need to go in and manually remove them, one by one. A coworker of mine had a useful phrase about automated things like this; "Never send a man to do a computer's job" (a twist on the old proverb).
But @mcdummy did not want the undefined classes removed. He wanted to be informed about them so he could add the required classes. For that, I thought the Report tool was an already implemented solution.

Quote:
Since I guess that the creator intended to have a special formating of the corresponding text passages, but forgot to add the defintions to the css, it would be good to be informed about the missing defintions to be able to format these passages.
I suppose cssRemoveUnusedSelectors plugin could be modified so undefined classes would be added to the stylesheet as a blank selector ( .whatever {} ) but not sure how much easier that would make the job. Are you volunteering to code and test this?
DNSB is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] KindleUnpack - The Plugin DiapDealer Plugins 494 05-18-2024 02:34 AM
[FileType Plugin] YVES Bible Plugin ClashTheBunny Plugins 27 01-16-2023 01:25 AM
Plugin not customizable: Plugin: HTML Output does not need customization flyingfoxlee Conversion 2 02-24-2012 02:24 AM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM
New Plugin Type Idea: Library Plugin cgranade Plugins 3 09-15-2010 12:11 PM


All times are GMT -4. The time now is 10:06 AM.


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