[NTG-context] context -> docx ??

Idris Samawi Hamid ادريس سماوي حامد ishamid at colostate.edu
Wed Jan 14 23:22:39 CET 2015


On Wed, 14 Jan 2015 14:59:01 -0700, Pablo Rodriguez <oinos at gmx.es> wrote:

>> Context produces three relevant files:
>>
>> darwin-xml-div.xhtml
>> darwin-xml-tag.xhtml
>> darwin-xml-raw.xml
>>
>> 1. Which one of these three files is the one we want to convert to docx?
>
> Only *-div.xhtml are (X)HTML files.

That was my guess, thanks.

>> 2. I modified Alan's test file [same preamble]:
>>
>> ====
>> \starttext
>>
>> \startquotation
>> \input darwin
>>
>> \bf \input darwin
>> \stopquotation
>>
>> \stoptext
>> ====
>>
>> darwin-xml-div.xhtml and darwin-xml-tag.xhtml show up in the browser,  
>> but
>> the bold does not.
>
> Well, I cannot see any bold in "<div class="break"><!--empty--></div>".
> It seems to be how ConTeXt handles the blank line and the \bf command.
>
> BTW, the quotation environment is not translated as blockquote and
> paragraphs lack their <p> tags.

Hmm, perhaps a showstopper...

>> In Opera 12.17, darwin-xml-raw.xml gives a syntax error
>>
>> ====
>> XML parsing failed: syntax error (Line: 17, Character: 0)
>> ====
>
> It seems weird to me (that should be the error in Opera), that a <break
> /> element is placed outside the <document> element.
>
>> But the "Reparse document as HTML" does work.
>
> I guess this format won’t be understood by pandoc (unless you write an
> specific reader for it).

Ouch, another showstopper...

> -raw.xml is not what you need.
>
>> In each of the three cases, there is no bold effect at all.
>>
>> What is needed to get the typography info transmitted?
>
> I have no experience with xhtml export in ConTeXt. This is beyond my
> knowledge. Sorry.

Aditya gave some of the answer. But his answer implies that I will have to  
define a whole bunch of

\definehighlight[typography][style=mystyle]

commands and change my entire style of writing... Yet another showstopper

>> 3. My assumption is this: If I can get the xml/xhtml file looking right  
>> in
>> the browser, I should be able to build a working docx file via pandoc.
>
> If it doesn’t look good in the browser, you won’t get it in pandoc. But
> it might be that you get it right in the browser and not in pandoc.
>
> It depends how ConTeXt outputs the XHTML.

But I may be able to save the browser output in an html format that pandoc  
could read, right?
=====

So the conclusion would appear to be: There is as yet no easy solution to  
convert context to docx. Given the bibliographical needs of this article:  
It may be that I'll do it in ConTeXt and then ask the editors to let the  
publisher -- it's a major publisher -- foot the bill for the conversion to  
docx. The ironic thing is that this publisher may very well have the final  
book done in TeX -- many of their books are typeset in TeX --, so we'll  
see what happens.

Thanks to all of you for your help!

Best wishes
Idris
-- 
Idris Samawi Hamid
Professor of Philosophy
Colorado State University
Fort Collins, CO 80523


More information about the ntg-context mailing list