View Single Post
Old 08-03-2015, 12:12 AM   #34
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 Turtle91 View Post
Awesome! Thank You!!
No problem

Quote:
Originally Posted by dgatwood View Post
For KF7, Kindlegen converts the CSS into HTML markup, but does it very badly, with a CSS parser that doesn't properly handle selectors containing multiple elements, multiple class names on single elements, lists of selectors applied to a single rule set, etc., resulting in all sorts of joy for those of us who routinely use nontrivial CSS.
Do you have this precisely documented in any way? Do I really need to do this:

Code:
// Before
p.blah, p.foo, p.bar { ... }

// After
p.blah { ... }
p.foo { ... }
p.bar { ... }
And this:
Code:
// Before
<p class="blah foo">Words</p>
p.blah.foo { ... }

// After
<p class="blah-foo">Words</p>
p.blah-foo { ... }
And this:
Code:
// Before
<p><span>Words</span></p>
p span { ... }

// After
<p><span class="p-span">Words</span></p>
span.p-span { ... }
What about this, is this necessary?
Code:
// Before
<p class="blah foo">Words</p>
p.blah { color:red }
p.foo {size:1.2em }

// After
<p class="blah-foo">Words</p>
p.blah-foo { color:red;size:1.2em }
Hungry for details, if they're available.

Quote:
Originally Posted by dgatwood View Post
Of course, if I were producing a general-purpose solution, I'd use a different approach, using a WebKit WebView to render the content, walk the DOM tree, and blow in tags based on the computed styles for each node. It would probably take only double-digit lines of code in total, and it would put Kindlegen to shame by being 100% correct in its interpretation of the CSS every freaking time.
Although you did point out that my iBooks problem with the popovers was probably a specificity issue, I'm still wondering if it would be worth using Juice to do this to my Kindle file. (It'd obviously affect KF8 as well as KF7 since you can't split source files.)

I could probably get this going using NodeJS in a few hours, make the script available, maybe even set up an NPM package. Any thoughts?
mattmc is offline   Reply With Quote