View Single Post
Old 08-15-2013, 08:54 AM   #14
Man Eating Duck
Addict
Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.
 
Posts: 254
Karma: 69786
Join Date: May 2006
Location: Oslo, Norway
Device: Kobo Aura, Sony PRS-650
Quote:
Originally Posted by Jellby View Post
Cleaning up CSS automatically may be considerably difficult if the stylesheet includes "advanced" selectors or rules like children, adjacent siblings, precedende, multiple classes, etc.

But there could be an option like the "flatten CSS" used by calibre, where every defined selector or combination is converted into a class (I believe that's what it does), then it's easier to "simplify", but you lose much of the charm of CSS. Nevertheless, the coding of most books needing a cleanup has no charm at all, so there's not much to lose.
Yes, it's more complicated than I thought at first, but I don't see a lot of it in actual use (IIRC I've seen multiple classes in one attribute in one of your books, but they don't need cleanup). As long as I don't actually change the definitions in any classes, and always leave (or add) a class in place of style="" attributes, it should be functionally identical. Advanced selectors are better left alone to start with. The first task will be to gather all definitions in one place, but I'll also have a look at how calibre flattens css.
Man Eating Duck is offline   Reply With Quote