ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Improving Pandoc Support for ConTeXt
@ 2015-10-20  1:47 Andrew Dunning
  2015-10-24 19:11 ` Aditya Mahajan
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Dunning @ 2015-10-20  1:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

Pandoc, if you have not heard of it before, is a rather brilliant program for converting text between different markup languages: it allows, in essence, for technology-independent writing. It has been mentioned a few times on this list, with Pablo Rodríguez recently developing a set of templates for typesetting its XHTML output (at https://github.com/ousia/from-pandoc-to-context). One of its aims is to ease the process of producing a high-quality PDF; it has the strongest support for LaTeX at the moment, but it seems to me that ConTeXt would ultimately provide a more reliable and lightweight solution. The basic support is already in place; it only needs to be more thoroughly updated to take advantage of MkIV.

I am working on improving Pandoc's generic ConTeXt template, at <https://github.com/jgm/pandoc-templates/blob/master/default.context>; the initial proposal is at <https://github.com/jgm/pandoc-templates/pull/138>, which aims to show more of ConTeXt’s potential to the user through making variables available that configure its options. I am still new to ConTeXt (having used LaTeX for several years), and could not find a recent starter document. The example at <http://wiki.contextgarden.net/Detailed_Example> is from 2006, and clearly does not exhibit the system’s full potential. I would be grateful to know of any potential areas for improvement.

If you feel even more inclined to develop the Pandoc support for ConTeXt, its writer can be found at <https://github.com/jgm/pandoc/blob/master/src/Text/Pandoc/Writers/ConTeXt.hs>. In my experience, ConTeXt is much easier to use than LaTeX, but it is more difficult to get started with initially due to the lack of resources for new users; it is my hope that full support for it in Pandoc will provide one way of delving into it more deeply.

All best,

Andrew Dunning
PhD Candidate
Centre for Medieval Studies
University of Toronto
http://andrewdunning.ca

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Improving Pandoc Support for ConTeXt
  2015-10-20  1:47 Improving Pandoc Support for ConTeXt Andrew Dunning
@ 2015-10-24 19:11 ` Aditya Mahajan
  2015-10-26 11:32   ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Aditya Mahajan @ 2015-10-24 19:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3794 bytes --]

On Mon, 19 Oct 2015, Andrew Dunning wrote:

> Dear list,
>
> Pandoc, if you have not heard of it before, is a rather brilliant 
> program for converting text between different markup languages: it 
> allows, in essence, for technology-independent writing.

I used pandoc to generate class notes for a course (I needed to generate 
both HTML output and PDF output). I used the system for three years (I no 
longer teach that course), and I found pandoc to be very limiting, I ended 
up using a lot of preprocessing macros 
(https://randomdeterminism.wordpress.com/2012/06/01/how-i-stopped-worring-and-started-using-markdown-like-tex/)

> It has been mentioned a few times on this list, with Pablo Rodríguez 
> recently developing a set of templates for typesetting its XHTML output 
> (at https://github.com/ousia/from-pandoc-to-context). One of its aims is 
> to ease the process of producing a high-quality PDF; it has the 
> strongest support for LaTeX at the moment, but it seems to me that 
> ConTeXt would ultimately provide a more reliable and lightweight 
> solution. The basic support is already in place; it only needs to be 
> more thoroughly updated to take advantage of MkIV.

This translation is not written in a ConTeXtish way. A lot of

\startmode[*en,*uk] \chapter{...} \stopmode
\startmode[*es] \chapter {...} \stopmode

etc could be written using \labeltext. For example:

\chapter{\labeltext{notes}]

\setuplabeltext[en][notes={Notes}]
\setuplabeltext[es][notes={Notas}]
etc.

I think that it will be easier if the pandoc-to-context code converts XML 
environments to ConTeXt environments and provides a default implementation 
of those environments.

For example, <strong>...</strong>, etc. can be translated to ConTeXt 
macros (such as \pandocstrong{...}) rather than direct formatting 
commands. Then \pandocstrong could be defined as

\definehighlight[pandocstrong][style=bold]

Simplicarly, h2, h3, can be translated to \startpandocsection etc., 
allowing the user to change the level of the sections. Have a look at 
m-markdown in the source for such an implementation.

This makes it much easier for a user to change the style.

> If you feel even more inclined to develop the Pandoc support for 
> ConTeXt, its writer can be found at 
> <https://github.com/jgm/pandoc/blob/master/src/Text/Pandoc/Writers/ConTeXt.hs>. 
> In my experience, ConTeXt is much easier to use than LaTeX, but it is 
> more difficult to get started with initially due to the lack of 
> resources for new users; it is my hope that full support for it in 
> Pandoc will provide one way of delving into it more deeply.

I think that parsing pandoc's XHTML output is a more robust solution than 
changing the ConTeXt writer.

> I am working on improving Pandoc's generic ConTeXt template, at 
> <https://github.com/jgm/pandoc-templates/blob/master/default.context>; 
> the initial proposal is at 
> <https://github.com/jgm/pandoc-templates/pull/138>, which aims to show 
> more of ConTeXt’s potential to the user through making variables 
> available that configure its options. I am still new to ConTeXt (having 
> used LaTeX for several years), and could not find a recent starter 
> document. The example at 
> <http://wiki.contextgarden.net/Detailed_Example> is from 2006, and 
> clearly does not exhibit the system’s full potential. I would be 
> grateful to know of any potential areas for improvement.

I find that it is easier to write a new template according to my needs 
rather than make the default template flexible enough that it fits 
everyone's needs. One of the big advatanges of ConTeXt, as compared to 
LaTeX, is that it is relatively easy to write a new style starting from 
scratch.

Aditya

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Improving Pandoc Support for ConTeXt
  2015-10-24 19:11 ` Aditya Mahajan
@ 2015-10-26 11:32   ` Wolfgang Schuster
  2015-10-26 16:51     ` Aditya Mahajan
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2015-10-26 11:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1075 bytes --]

> Aditya Mahajan <mailto:adityam@umich.edu>
> 24. Oktober 2015 um 21:11
> On Mon, 19 Oct 2015, Andrew Dunning wrote:
>> It has been mentioned a few times on this list, with Pablo Rodríguez 
>> recently developing a set of templates for typesetting its XHTML 
>> output (at https://github.com/ousia/from-pandoc-to-context). One of 
>> its aims is to ease the process of producing a high-quality PDF; it 
>> has the strongest support for LaTeX at the moment, but it seems to me 
>> that ConTeXt would ultimately provide a more reliable and lightweight 
>> solution. The basic support is already in place; it only needs to be 
>> more thoroughly updated to take advantage of MkIV.
>
> This translation is not written in a ConTeXtish way. A lot of
>
> \startmode[*en,*uk] \chapter{...} \stopmode
> \startmode[*es] \chapter {...} \stopmode
>
> etc could be written using \labeltext. For example:
>
> \chapter{\labeltext{notes}]
>
> \setuplabeltext[en][notes={Notes}]
> \setuplabeltext[es][notes={Notas}]
> etc.
Why don’t you use \headtext?

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 2218 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Improving Pandoc Support for ConTeXt
  2015-10-26 11:32   ` Wolfgang Schuster
@ 2015-10-26 16:51     ` Aditya Mahajan
  0 siblings, 0 replies; 4+ messages in thread
From: Aditya Mahajan @ 2015-10-26 16:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]

On Mon, 26 Oct 2015, Wolfgang Schuster wrote:

>>  Aditya Mahajan <mailto:adityam@umich.edu>
>>  24. Oktober 2015 um 21:11
>>  On Mon, 19 Oct 2015, Andrew Dunning wrote:
>> >  It has been mentioned a few times on this list, with Pablo Rodríguez 
>> >  recently developing a set of templates for typesetting its XHTML output 
>> >  (at https://github.com/ousia/from-pandoc-to-context). One of its aims is 
>> >  to ease the process of producing a high-quality PDF; it has the 
>> >  strongest support for LaTeX at the moment, but it seems to me that 
>> >  ConTeXt would ultimately provide a more reliable and lightweight 
>> >  solution. The basic support is already in place; it only needs to be 
>> >  more thoroughly updated to take advantage of MkIV.
>>
>>  This translation is not written in a ConTeXtish way. A lot of
>>
>>  \startmode[*en,*uk] \chapter{...} \stopmode
>>  \startmode[*es] \chapter {...} \stopmode
>>
>>  etc could be written using \labeltext. For example:
>>
>>  \chapter{\labeltext{notes}]
>>
>>  \setuplabeltext[en][notes={Notes}]
>>  \setuplabeltext[es][notes={Notas}]
>>  etc.
> Why don’t you use \headtext?

Because I did not know about it :-)

Aditya

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-26 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-20  1:47 Improving Pandoc Support for ConTeXt Andrew Dunning
2015-10-24 19:11 ` Aditya Mahajan
2015-10-26 11:32   ` Wolfgang Schuster
2015-10-26 16:51     ` Aditya Mahajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).