On 12/30/2013 06:26 PM, Thomas Leitner wrote:
> I have had a quick look through the source code and saw that you create
> a kramdown text file in the parsing code. Just curious: Why did you do
> it this way instead of directly creating a kramdown document tree?
Chiefly because Word's XML is not strictly recursive, it is like a
linear state machine where the first child of a node determines the
format for all the rest of the children. This doesn't mix well with
recursively building a kramdown tree.
However, it mixes well with outputting the kramdown ASCII syntax, which
in itself is like a state machine when parsed from left to right. I've
taken advantage of this circumstance and the code is much simpler this
way. I've still chosen a recursive algorithm, but only to avoid loops
with many .xpath selectors.
I've actually tried generating kramdown nodes but eventually had to give
up -- not because of kramdown but because of the nature of Word's XML
structure.
And, when you parse the generated kramdown syntax with kramdown, you'll
end up with the same kramdown tree :)
> Happy new year!
Thanks, to you too, and keep up the good work :)
Michael