| 
			
			 | 
		#46 | |
| 
			
			
			
			 Running with scissors 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,592 
				Karma: 14328510 
				Join Date: Nov 2019 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Along those lines I've had times when a book has a lot of "crud" html and it would have been nice if Sigil's Report thing would list all of the used html tags.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#47 | |
| 
			
			
			
			 Running with scissors 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,592 
				Karma: 14328510 
				Join Date: Nov 2019 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Along those lines I've had times when a book has a lot of "crud" html and it would have been nice if Sigil's Report thing would list all of the used html tags. Last edited by hobnail; 06-25-2020 at 03:50 PM.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#48 | 
| 
			
			
			
			 Sigil Developer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,072 
				Karma: 6361556 
				Join Date: Nov 2009 
				
				
				
				Device: many 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			FWIW, There is no such thing as "unused" html tags. Under the html5 spec you can actually define your own tags.  These can be processed using javascript as well.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#49 | 
| 
			
			
			
			 Running with scissors 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,592 
				Karma: 14328510 
				Join Date: Nov 2019 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I was thinking along the lines of the book using things like blockquote when it clearly wasn't a quote, or h5 for bolding.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#50 | 
| 
			
			
			
			 Running with scissors 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,592 
				Karma: 14328510 
				Join Date: Nov 2019 
				
				
				
				Device: none 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#51 | 
| 
			
			
			
			 Resident Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,784 
				Karma: 150249619 
				Join Date: Nov 2006 
				Location: Roslindale, Massachusetts 
				
				
				Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thing is, there are a lot of eBooks that have nonexistent classes in the HTML. Some of those classes ae used in place of an ID. The others, I have no idea why they are there or why the CSS is missing those classes.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		
 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#52 | 
| 
			
			
			
			 Connoisseur 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 73 
				Karma: 7130 
				Join Date: Apr 2015 
				
				
				
				Device: PRS-T3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thanks to comments by @DNSB and @hobnail. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	It would be good to have both an information showing the undefined/non-existing classes and an option to remove those of them that a user does not want to keep. A manual removal could be quite complicated, since I've seen constructions like class="class1 class2 ... classN", which makes it difficult to remove a specific class (even with regex) if it has a "conventional" name like "center" or the name of class2 (e.g., heading, author) is also a part of classN (e.g., subheading, co-author). An option for the generation of empty classes for the ones that are kept would be the icing on the cake. I don't know if this already exists in the plugin, but since there's a discussion about code additions. I've seen style sheets contain class definitions two or more times. Therefore, it would be good, if these definitions were merged. I further noticed that sometimes classes contain the same instruction several times but with different values, e.g., "text-align: left" followed later by "text-align: right". Since only the last definition will be applied, it would be advantageous to remove the first.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#53 | |
| 
			
			
			
			 Connoisseur 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 50 
				Karma: 605108 
				Join Date: Apr 2016 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Hi mcdummy, 
		
	
		
		
		
		
		
		
		
		
		
		
	
	I'd rather think about providing a different plugin that could automatically remove unmatched classes in xml/xhtml than modifying this one. That's because this plugin is designed to run as safely as possible on as many epubs out there as possible, and in doing so it changes absolutely nothing outside of css files. Adding this feature would open a whole new set of issues and edge cases to be worried about. If (but that's a big if) I find the time in the next days I'll try to put something together (but if someone else wants to step up, please feel free to do so). About the other suggestions, I find them interesting, and I'll think about them a bit more, although I'm not totally convinced. These are my thoughts for now. Just showing the classes unmatched by a selector is already done by the Reports tool as DNSB pointed out. About merging rulesets, I think that's not impossible, but that's not totally safe either: Code: 
	.classA {}
.classB { color: red }
.classA { color: blue }
Code: 
	.classA { color: blue }
.classB { color: red }
Quote: 
	
 @hobnail: I'm not sure I understood your last posts: do you have a specific proposal or were you simply backing the request of mcdummy?  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#54 | |||
| 
			
			
			
			 Connoisseur 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 73 
				Karma: 7130 
				Join Date: Apr 2015 
				
				
				
				Device: PRS-T3 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Quote: 
	
 Quote: 
	
  | 
|||
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#55 | |
| 
			
			
			
			 Connoisseur 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 50 
				Karma: 605108 
				Join Date: Apr 2016 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 ![]() Meanwhile, I uploaded version 0.3.2 of this plugin with an icon for displaying in Sigil.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#56 | 
| 
			
			
			
			 Belgian Pommes Frites 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 131 
				Karma: 35038 
				Join Date: Jan 2012 
				
				
				
				Device: Pocketbook Touch HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I use this plugin regularly, and it does a very good job. Thank you. 
		
	
		
		
		
		
		
		
		
		
		
		
		
			I have now incorporated it into an automate list in Sigil. Is there a way to run this plugin without user interactions, when using an automate list? Last edited by Capricorn; 09-20-2024 at 11:44 AM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#57 | 
| 
			
			
			
			 Connoisseur 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 50 
				Karma: 605108 
				Join Date: Apr 2016 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I'm glad that this plugin is still useful to someone  
		
	
		
		
		
		
		
		
		
		
		
		
	
	  (Unless you are stuck with an old version of Sigil, the built-in Sigil function should now be just fine to use for all selectors and not just for classes).Right now there isn't a way to bypass the GUI, but it should be fairly easy to add a preference in the json file to tell the plugin to just delete all the unused selectors without asking. I'll look into it.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#58 | 
| 
			
			
			
			 Belgian Pommes Frites 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 131 
				Karma: 35038 
				Join Date: Jan 2012 
				
				
				
				Device: Pocketbook Touch HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Ah....I am using Sigil v2.3.1, but I hadn't realised that the built-in function is now as good as the plugin. I will have a look at it and see if there may still be small differences or not.  
		
	
		
		
		
		
		
		
		
		
		
		
	
	But if I could use this plugin without user interaction within an automate list, that would still be an advantage compared to the built-in function. Thank you very much for looking into it. That would be very nice indeed to have.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#59 | 
| 
			
			
			
			 Connoisseur 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 50 
				Karma: 605108 
				Join Date: Apr 2016 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I uploaded a new version of the plugin that should handle the 'quiet' part. 
		
	
		
		
			In order to activate the new functionality, you need to manually update the preferences file in $SIGIL_PREFS/plugin_prefs/cssRemoveUnusedSelectors/cssRemoveUnusedSelectors.json, adding the line Code: 
	"quiet": true Code: 
	{
  "parseAllXMLFiles": true,
  "indent": "    ",
  "indentClosingBrace": true,
  "keepEmptyRules": true,
  "omitLastSemicolon": true,
  "omitLeadingZero": true,
  "formatUnknownAtRules": false,
  "linesAfterRules": "\n",
  "quiet": true
}
 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#60 | 
| 
			
			
			
			 Belgian Pommes Frites 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 131 
				Karma: 35038 
				Join Date: Jan 2012 
				
				
				
				Device: Pocketbook Touch HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I have now managed to test it on about 20 books. In a number of them I had already removed any unused selectors, and it just continues on to the next plugin in my automate list without giving any messages. In the other cases it did give a message that some selectors needed to be removed.  
		
	
		
		
		
		
		
		
		
		
		
		
	
	So, yes, so far it works. I will continue to use it, and see if something may still trip it up or not. Very, very nice. THANK YOU.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
            
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| [GUI Plugin] KindleUnpack - The Plugin | DiapDealer | Plugins | 527 | 08-15-2025 02:36 PM | 
| [FileType Plugin] YVES Bible Plugin | ClashTheBunny | Plugins | 27 | 01-16-2023 02:25 AM | 
| Plugin not customizable: Plugin: HTML Output does not need customization | flyingfoxlee | Conversion | 2 | 02-24-2012 03:24 AM | 
| [GUI Plugin] Plugin Updater **Deprecated** | kiwidude | Plugins | 159 | 06-19-2011 01:27 PM | 
| New Plugin Type Idea: Library Plugin | cgranade | Plugins | 3 | 09-15-2010 01:11 PM |