01-06-2023, 05:42 PM | #1 |
Guru
Posts: 745
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
|
Calibre 6.11: "Remove CSS Rules" and "Check Book" Conflicts
I'm not sure what to do with this. With the new Calibre 6.11, things have changed with either the Remove CSS Rules or the Check Book tools and they're conflicting a bit.
With a book earlier today, after doing a Remove CSS Rules with all 4 boxes checked (Remove Unused Class Attributes, Merge CSS Rules with Identical Selectors, Merge CSS Rules with Identical Properties and Remove Unreferenced Style Sheets), Check Book complained that my standard paragraph rule should have been BEFORE some composite rules using it (h2 + p, etc.). No problem, I moved p up a bit in my stylesheet. But, just now, I did the same thing and Check Book is now complaining that "div.letter p" should be AFTER some composite rules. The problem is that in my original layout, "div.letter p" WAS after those rules. But, since "p" and "div.letter p" are the same, Remove CSS Rules merged them and put the result BEFORE those rules. Unfortunately, "p" has to be BEFORE those rules and "div.letter p" has to be AFTER them. So, they conflict. I can (probably) work around this by turning off those Merge rules in Remove CSS Rules. But, Calibre 6.10 and earlier didn't complain about this. It'd be nice if Calibre could check positioning rules before merging "identicals." But, I'm thinking the processing required might be too much. Anyway, I'm going to turn off the Merge options since that's merely stylesheet cosmetics. But, I thought I'd report it. Last edited by enuddleyarbl; 01-06-2023 at 05:44 PM. |
01-06-2023, 08:01 PM | #2 |
Not Quite Dead
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
|
Release: 6.11
New features Edit book: Check book: Allow automatic fixing of various simple CSS errors What is a simple CSS error? I have not met one since 1997. "Automatic fixing" sounds like something most of us would avoid. Positioning of a rule is part of the cascade and should remain in the hands of the coder, no matter how incompetent. Last edited by Brett Merkey; 01-06-2023 at 08:19 PM. |
Advert | |
|
01-06-2023, 09:45 PM | #3 | |
Guru
Posts: 745
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
|
I was also thinking it was related to this:
Quote:
|
|
01-07-2023, 03:35 AM | #4 |
creator of calibre
Posts: 44,377
Karma: 23764838
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The new check rule encourages you to put the css rules in the order of increasing specificity. This is because when there are two mechanisms at play for the order in which CSS rules are applied. The specificity of the selector, and when that is the same, the position of the rule in the source. By re-ordering the rules so that these match you can tell at a glance which rule is more significant without having to compute its specificity in your head.
I could have Remove CSS rules/Beautify CSS also re-order them by their specificity to avoid seeing this warning, it shouldnt be much work to implement. |
01-07-2023, 03:55 AM | #5 |
creator of calibre
Posts: 44,377
Karma: 23764838
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
On second thoughts, automatically sorting them is a bit problematic because it means that any top level comments may no longer be in the right place after sorting.
|
Advert | |
|
01-07-2023, 10:59 AM | #6 |
Guru
Posts: 745
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
|
Well, merging has always caused issues with comments (they get left behind). So, I'm not sure if sorting would be any different. Well, I take that back. I suppose if you sorted the whole rule, then any comments within the rule would come along with it when it moved. So, that's actually better than what happens with merging.
For me, as just a dabbler, all of this is just fine. But, for professionals, I'm not sure what they would want/expect. |
01-07-2023, 11:45 AM | #7 |
creator of calibre
Posts: 44,377
Karma: 23764838
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I am talking about comments at the top level between rules, not comments inside rules. Sorting can potentially re-order *everything* it's much more disruptive than merging.
|
01-07-2023, 08:08 PM | #8 |
Evangelist
Posts: 487
Karma: 32554
Join Date: May 2014
Location: Canada
Device: Kobo Libra Colour
|
This made me realize that even though inventing my own tags worked, it wasn't "right". It took me quite a while to change everything to "proper" html/css. I was certainly shocked when I ran Check Book on an epub I had just checked a bit before updating and saw so many errors!
|
01-07-2023, 09:31 PM | #9 |
Guru
Posts: 745
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
|
Running Check Book on my (yesterday's) standard set of styles basically gave me just two errors:
1) Unexpected Empty Comment: I had sectioned off some areas with multiple, single-line comments (including those empty ones). I converted them to multiline comments. 2) My standard "p" selector should have come before nine other compound selectors which included the "p" (i.e., "h1 + p", etc.). Again, no problem moving that up a bit. So, in general, I'm happy with the new functionality and I learned a bit. |
01-07-2023, 09:46 PM | #10 |
creator of calibre
Posts: 44,377
Karma: 23764838
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The other nice thing about the new library is it auto-fixes some simple things saving you the bother. For example, two consecutive semi-colons or duplicate property definitions within a rule. These can be fixed by other means as well of course, but it is convenient to have them easily fixed from within check book.
|
01-08-2023, 08:33 AM | #11 |
Not Quite Dead
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
|
"two consecutive semi-colons"
Ok, well that answers my question about what is a simple CSS error. <g> |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pressing "Restore Defaults" under "Book Details" wipes all "Look & Feel" settings. | MarjaE | Library Management | 1 | 03-30-2021 11:46 AM |
Calibre 3.22: Missing "Remove unused CSS rules" | DrChiper | Editor | 4 | 04-20-2018 03:39 AM |
Bugs "Sanity Check epub" and "Failed Release date" on V 0.91 | qkiazd | Sigil | 5 | 12-03-2015 04:01 AM |
How to convert "Book A" using css, formatting, fonts 1:1 -> "Book B"? | Mr.Husky | Calibre | 1 | 11-24-2015 05:22 PM |