View Single Post
Old 08-24-2015, 06:05 PM   #43
mattmc
Connoisseur
mattmc can program the VCR without an owner's manual.mattmc can program the VCR without an owner's manual.mattmc can program the VCR without an owner's manual.mattmc can program the VCR without an owner's manual.mattmc can program the VCR without an owner's manual.mattmc can program the VCR without an owner's manual.mattmc can program the VCR without an owner's manual.mattmc can program the VCR without an owner's manual.mattmc can program the VCR without an owner's manual.mattmc can program the VCR without an owner's manual.mattmc can program the VCR without an owner's manual.
 
Posts: 89
Karma: 185923
Join Date: May 2015
Device: iPad 1/2/Air, K3/PW2/Fire1, Kobo Touch, Samsung Tab, Nook Color/Touch
Quote:
Originally Posted by dgatwood View Post
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 )
mattmc is offline   Reply With Quote