Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 01-28-2020, 04:13 PM   #1
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 283
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
alphabetizing stylesheet, check book, and remove unused styles

I alphabetize the stylesheet using 'dummy' commands. Here are some examples. I would appreciate comments. Best regards, Pop
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2020-01-28 15-09-02.png
Views:	171
Size:	322.7 KB
ID:	176717   Click image for larger version

Name:	Screenshot from 2020-01-28 15-09-32.png
Views:	164
Size:	406.8 KB
ID:	176718   Click image for larger version

Name:	Screenshot from 2020-01-28 15-09-42.png
Views:	154
Size:	306.0 KB
ID:	176719   Click image for larger version

Name:	Screenshot from 2020-01-28 15-10-55.png
Views:	156
Size:	267.5 KB
ID:	176720  
rjwse@aol.com is offline   Reply With Quote
Old 01-28-2020, 04:33 PM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,037
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
In English please.
JSWolf is offline   Reply With Quote
Advert
Old 01-28-2020, 05:04 PM   #3
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
Seems like a bad idea if I understand correctly. See also this thread:

https://www.mobileread.com/forums/sh...d.php?t=326852
hobnail is offline   Reply With Quote
Old 01-29-2020, 01:14 PM   #4
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 283
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
clarification of A-Z stylesheet.css in editor

Quote:
Originally Posted by JSWolf View Post
In English please.
Sorry for not being clear. Here are two screenshots with further explanation. Best regards, Pop
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2020-01-29 12-06-26.png
Views:	131
Size:	337.4 KB
ID:	176738   Click image for larger version

Name:	Screenshot from 2020-01-29 12-09-27.png
Views:	129
Size:	334.9 KB
ID:	176739  
rjwse@aol.com is offline   Reply With Quote
Old 01-29-2020, 01:22 PM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,037
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by hobnail View Post
Seems like a bad idea if I understand correctly. See also this thread:

https://www.mobileread.com/forums/sh...d.php?t=326852
Once you remove the unused CSS and are left with a much smaller CSS, sorting is usually OK. I've sorted CSS where I then needed to fix a few things. That was easy to do. Most publisher CSS is not doing anything fancy enough where sorting would be an issue.
JSWolf is offline   Reply With Quote
Advert
Old 01-29-2020, 02:17 PM   #6
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 283
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
"once you remove..."

Quote:
Originally Posted by JSWolf View Post
Once you remove the unused CSS and are left with a much smaller CSS, sorting is usually OK. I've sorted CSS where I then needed to fix a few things. That was easy to do. Most publisher CSS is not doing anything fancy enough where sorting would be an issue.
You are right. Most CSS in books is simple and minimum. I am pushing the extremes of fanciness, as much as I can, but it comes at a price of garishness.
When you ask calibre to remove unused code, I think it leaves alone any line with multiple items, so long as at least one of them is being used:

div, ol, p, ul, .class1, .class2 {whatever}

So far as I can tell, it will not remove any of the above so long as one of them is in the book. It would be great if it could remove the dead-wood items from a list.

Best regards, Pop
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2020-01-29 13-14-47.png
Views:	113
Size:	457.7 KB
ID:	176741   Click image for larger version

Name:	Screenshot from 2020-01-29 13-15-26.png
Views:	116
Size:	537.4 KB
ID:	176742  
rjwse@aol.com is offline   Reply With Quote
Old 01-29-2020, 02:41 PM   #7
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Quote:
When you ask calibre to remove unused code, I think it leaves alone any line with multiple items, so long as at least one of them is being used:

div, ol, p, ul, .class1, .class2 {whatever}
So far as I can tell, it will not remove any of the above so long as one of them is in the book. It would be great if it could remove the dead-wood items from a list.
I think I may have already posted this, but you can unstack those selectors in the CSS with a regular expression:

--unstack selectors so Calibre "Remove unused rules" tool can be used:
Search: ([.]?[^ ]+),\s([^{]+)(\{[^}]+\})
Replace: \1 \3\n\n\2\3

'Replace All' until 0 returns.
Brett Merkey is offline   Reply With Quote
Old 01-29-2020, 02:45 PM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,037
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by rjwse@aol.com View Post
You are right. Most CSS in books is simple and minimum. I am pushing the extremes of fanciness, as much as I can, but it comes at a price of garishness.
When you ask calibre to remove unused code, I think it leaves alone any line with multiple items, so long as at least one of them is being used:

div, ol, p, ul, .class1, .class2 {whatever}

So far as I can tell, it will not remove any of the above so long as one of them is in the book. It would be great if it could remove the dead-wood items from a list.

Best regards, Pop
That is one reason why I don't like listed classes. never have and I don't create listed classes. I have taken some listed styles and separated them so the ones not used could be dumped.

Some publisher CSS is not simple. It can be a bit of a mess. Bit it's not setup to need a specific order most of the time.
JSWolf is offline   Reply With Quote
Old 01-29-2020, 06:05 PM   #9
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 283
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
"Remove unused rules"

Quote:
Originally Posted by Brett Merkey View Post
I think I may have already posted this, but you can unstack those selectors in the CSS with a regular expression:

--unstack selectors so Calibre "Remove unused rules" tool can be used:
Search: ([.]?[^ ]+),\s([^{]+)(\{[^}]+\})
Replace: \1 \3\n\n\2\3

'Replace All' until 0 returns.
That is slick! I will copy and save to calibre's snipets. After the dead-wood is deleted, can you again regroup the ones which are identical? Best regards, Pop
rjwse@aol.com is offline   Reply With Quote
Old 01-29-2020, 06:48 PM   #10
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Quote:
That is slick!
It is, kind of. When I set out to make that expression a couple of years ago, I figured it was impossible (for me) but I wanted to give it a try. I was surprised at how quickly it came together.

Quote:
can you again regroup the ones which are identical?
I never bothered to work the other end because usually most of the stacked rules get swept to the great Bitbucket in the Sky. The only likely path to developing such a regex that I can think of is to have a regex that works on marked text only, within the CSS file. That is, a person wishing to "re-stack" identical rules would have to manually select the identical rules first. This really would not save much labor over doing the restacking manually, so I didn't bother to go into it.

Last edited by Brett Merkey; 01-29-2020 at 06:52 PM.
Brett Merkey is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
remove unused CSS rules rjwse@aol.com Editor 13 09-18-2019 09:39 AM
Move incode-styles to css-stylesheet with a tool? patrik Workshop 3 03-18-2017 02:14 PM
2.67 - Unused image file not detected by check book DrChiper Editor 3 09-08-2016 12:06 PM
Remove unused class attributes phossler Editor 15 01-26-2016 01:06 PM
Cleaning a stylesheet of unused styles roger64 Sigil 49 06-13-2012 05:23 AM


All times are GMT -4. The time now is 05:20 PM.


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