On Sun, 6 May 2012, Idris Samawi Hamid ادريس سماوي حامد wrote:
I have a paper done in ConTeXt that I would like to put online. I _could_ manually convert my input to markdown, but I was wondering if the xml/xhtml export options could be used to accomplish the same thing.
Why do you want to introduce markdown as an intermediate format? The exported XML can be used directly.
Although I have done a lot of doc-to-context conversions via pandoc (doc->odt->markdown->context) I have never needed to go the other way till now.
Pandoc has an latex reader, and it should not be too hard to write a context reader (although you end up loosing a lot of information about the structure, so it is not too useful). I had tried a proof of concept context to markdown writer by directly outputting the markdown in the pdf and converting it to text using pdftotext. I found that to be a more easily configurable way to export ConTeXt to markdown than tweaking a parser.
What would you guys suggest? Is there a way to convert context's xml/xhtml to markdown? (Note that I know little about html, css etc).
In one project, I used the ConTeXt export XML+custom CSS to display the results in a web-browser. For the most part it worked fine, although in some cases I had to tweak the lua code that generated the XML (mainly in order to control the conversion of images; Hans did add some support for image conversion after that). If you want more control, the best thing to do is to process the XML using xmlproc or something similar.
One thing (bug?) I have noticed: bibliographic info gets lost in the backend export, so I end up with a lot of Xxxxxxxx (0000) etc in the output. Isn't there a tmp file the export backend can access to pick up this info?
Best create a minimal example to show the bug. It should be relatively simple to fix. Aditya