docx: Links in endnotes get mangled when converting to Markdown #2258
I'll take a look -- @gohai, would it be possible to get the problematic docx file, or a minimal example deminstrating the problem? Either uploaded to dropbox, or sent to my email address in the docx reader source? (I'm linux-only for the holiday weekend, so can't reliably generate the files myself.) Also, is this only with endnotes, or do footnotes display the same problem?
Well, I diagnosed the problem, anyway. The issue is that there is a separate relationships file for footnotes and endnotes (and presumably for every .xml file). So we have to look in word/_rels/{foot,end}notnotes.xml.rels
instead of the document-level one. We can't just merge them either because there are overlapping relationship numbers. (that's where the "styles.xml" link came from).
I made a sort of braindead fix that works, but I'd been hoping to polish it a bit with time that never came. I'll post it one way or another later today.
It turned out to be too braindead.
I'm really sorry -- my book is overdue with my publishers, and I've been forsaking all else to get those last few changes in. It should be off within the week, and then I can turn to this. Of course, if anyone else wants to take a crack at it, I'd be happy to offer any insight I can. The problem is pretty simple (see above) but the solution seems fairly tough to get right without adding a bunch of spaghetti.
(Essentially, we need to know whether we're parsing from a footnote or main text, which is difficult at the moment, due to the recursive way we deal with parsing. We can always throw more state at the problem, but the attempts I made spun out of control pretty quickly.)
In any case, if no one else has a go at it, I should be able to turn my attention back to it pretty soon.
Sorry again,
Jesse
Converting endnotes that (solely?) contain a hyperlink produce an unexpected output in Markdown. Tested against 1.15.0.1. A link to "http://wikipedia.org/" would e.g. be converted to
(Notice the styles.xml.) Any idea what is going on? I am using Word for Mac 2011.
The relevant part of the document.xml looks like this:
and endnotes.xml