
paul flo said:
I'm suggesting doing some pre-processing to the HTML that you give to Kindlegen ... Here's a concrete example:
thanks for the example. it makes it much simpler for me to make my point. for convenience, i will label these three sections... *** this is "version 'a', the ascii version"...
The first line of my poem The second line of my poem A longer line comes next, and goes on a bit but still does not rhyme The last line ends with a flourish!
*** this is "version 'h', the .html version"...
I've decided that a flexible way of marking this up in HTML is this:
[html] [head] [style] .poem { margin-left: 2em } .line, .iline { display: block; text-indent: -2em } .line { } .iline { margin-left: 1em } [/style] [body] [div class="poem"] [p class="verse"] [span class="line"] The first line of my poem[/span] [span class="iline"] The second line of my poem[/span] [span class="line"] A longer line comes next, and goes on a bit but still does not rhyme[/span] [span class="iline"] The last line ends with a flourish![/span] [/p] [p class="verse"] [span class="line"] The first line of my poem[/span] [span class="iline"] The second line of my poem[/span] [span class="line"] A longer line comes next, and goes on a bit, but still does not rhyme[/span] [span class="iline"] The last line ends with a flourish![/span] [/p] [/div] [/body] [/html]
You'll note that this needs CSS to show up as I intended, but the display in a modern browser works well. However, kindlegen does an awful job at converting this.
So I decide to preprocess the HTML that I feed to kindlegen. I can strip the CSS entirely and use the classes to do some substitutions, so that I feed kindlegen this:
*** and this is "version 'k', the kindlegen version"...
[html] [head] [/head] [body] [p height="1em"] The first line of my poem[/p] [p height="0" width="-2em"] The second line of my poem[/p] [p height="0"] A longer line comes next, and goes on a bit, but still does not rhyme[/p] [p height="0" width="-2em"] The last line ends with a flourish![/p] [p height="1em"] The first line of my poem[/p] [p height="0" width="-2em"] The second line of my poem[/p] [p height="0"] A longer line comes next, and goes on a bit, but still does not rhyme[/p] [p height="0" width="-2em"] The last line ends with a flourish![/p] [/body] [/html]
*** ok, so if i understand you correctly, paul, you take version "a" and (somehow-or-other, i'll call it "a2h"), you turn it into version "h". then you run a script ("h2k") which massages version "h" into version "k". then you zip version "h" into .epub "e" -- "h2e". (how do you create the required auxiliary files?) and of course you then use kindlegen to turn version "k" into .mobi file "m" ("k2m")... (again, how do you create the auxiliary files?) am i correct? *** ok, that's a fairly good workflow... any changes in the "somehow-or-other" "a2h" conversion _could_ impact the later "h2k" one. and a typo-edit to version "a" would require either rerunning the entire cycle, _or_ mirror changes made to "h" and "k", and to the auxiliary files if necessary, followed by rerunning "h2e" and "k2m"... which is a bit bulky. but other than that, it's a fairly solid chain... *** just for the edification of everyone, here is the workflow which i propose. 1. start with .zml text "z". 2a. script converts "z" into "h" .html e-book(s). 2b. script converts "z" into "e" .epub e-book. 2c. script converts "z" into "m" .mobi e-book. 2d. script converts "z" into "p" .pdf e-book. 2e. script converts "z" into "o" offline e-book. 2f. script converts "z" into "w" web-app e-book. 2g. script converts "z" into "g" gutenberg e-text. the click of a button does 2a-2g simultaneously. so a typo-edit to #1 means another button-click. simple. fast. efficient. clean. one input-file and many outputs (all of them disposable as they can be easily regenerated at any time with one click)... -bowerbird p.s. does the following look a bit strange to you? The first line of my poem The second line of my poem A longer line comes next, and goes on a bit but still does not rhyme The last line ends with a flourish! The first line of my poem The second line of my poem A longer line comes next, and goes on a bit but still does not rhyme The last line ends with a flourish! it should. what i have done is duplicated the verse. it's pretty easy to tell that that's what i've done when the text is in a nice clean unobstructed zen format. but it's not quite as obvious when you have all that .html gobbledygook surrounding the text, which is probably why you didn't notice that you seem to have accidentally duplicated the verse in your .html versions.