Quote:
Originally Posted by dgatwood
I think my first comment was erroneous, and I think that comma-delimited selectors are okay, but I'm not 100% certain. It has been many months since I analyzed what was going on with kindlegen.
|
Hm, okay cool. I'll assume for now that this is fine. Thanks!
It actually makes it a little easier, because instead of cloning rules for the class-combination selectors, I can just add the combo selector to any rule that has one of the component selectors. So:
Code:
<span class="apple banana">Hello World!</span>
span.apple {
color: red;
}
Becomes:
Code:
<span class="apple-banana">Hello World!</span>
span.apple,
.apple-banana {
color: red;
}
Just, easier than copying rules and declarations around wholesale...
Anyway, I was sick for a couple of days, but I have it working now. At least all of my unit tests are passing. Assuming you have
gorilla.epub you can do:
Code:
var allscribe = require('allscribe');
var gorilla = allscribe.openEpub('gorilla.epub');
gorilla.process(function(unpacked){
unpacked.simplifyCssAndMarkup(); // handles multi-element and such complex selectors
unpacked.mergeMarkupClasses(); // handles multiple classes on an element
return 'silverback';
});
That'll get you
silverback.epub with the various modifications done. Whew.
Anyway, I'll be incorporating all this into my current workflow, start testing how my book looks on K1, etc. But it's a good start, I think. Too bad it's probably not all that accessible to non-scripters.
(I would ask you to give it a shot, seeing that you
are a scripter, but all your stuff is custom anyway

)