Re: [NTG-context] Typesetting Markdown – Part 5: Interpolation

2019-07-09 Thread Andres Conrado
Thank you. I still don't really understand why can't you have a
"presentational" yaml file and a "content" yaml file (I do it like that...
I have a "variables.yaml" file for content and a "settings.yaml" file for
presentational stuff, and use a "template.context" file with all my mapped
variables within the ConTeXt code, and compile everything using pandoc).
But I guess you want to do it this way. Or maybe I'm not really
understanding your process. It's quite interesting in any case, and I'm
learning a lot. Thanks for sharing.

Andrés Conrado Montoya
http://chiquitico.org
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Typesetting Markdown – Part 5: Interpolation

2019-07-09 Thread Thangalin
That's another intriguing approach, Andrés, thank you.

The approach faces some hurdles. First, the template file (main.tex) is
written in ConTeXt, so it never sees the YAML variables, nor can it be used
to interpret pandoc's conditional expressions. Second, moving the
\completecontent macro out of main.tex and into Markdown (e.g., 01.md,
being the first chapter) so that the conditional expression can be
evaluated using pandoc mixes content with presentation logic.

Modes are a good approach in this case because the "context" command can
take a "mode" command-line argument. This provides presentation controls
that neither the YAML nor the Markdown need consider. Adding presentation
logic to the ConTeXt template (i.e., introducing \startmode and
\startnotmode into main.tex) is acceptable because ConTeXt is wholly
responsible for the appearance of the final document. See:
https://wiki.contextgarden.net/Modes

This then allows development of command-line arguments from shell scripts
to control how the document is presented when built, which is a little bit
more flexible than maintaining YAML variables. Also, ideally, the YAML
variables would be used for controlling only content, not presentation
logic.

Thanks again, Andrés.

On Mon, Jul 8, 2019 at 11:27 AM Andres Conrado 
wrote:

> You can do it on the template... you can use a yaml variable to determine
> if the toc should be printed or not. Like so:
>
> yaml file:
> ---
> toc: true
> ...
>
> template file:
> %%%
> $if(toc)$
> \completecontent
> $endif$
> %%%
>
>
> Andrés Conrado Montoya
> http://chiquitico.org
>
>
> El lun., 8 jul. 2019 a las 2:52,  escribió:
>
>> Send ntg-context mailing list submissions to
>> ntg-context@ntg.nl
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> https://mailman.ntg.nl/mailman/listinfo/ntg-context
>> or, via email, send a message with subject or body 'help' to
>> ntg-context-requ...@ntg.nl
>>
>> You can reach the person managing the list at
>> ntg-context-ow...@ntg.nl
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of ntg-context digest..."
>>
>>
>> Today's Topics:
>>
>>1. Re:  Typesetting Markdown – Part 5: Interpolation
>>   (Aditya Mahajan)
>>2. Re:  Typesetting Markdown – Part 5: Interpolation (Thangalin)
>>3. Re:  Typesetting Markdown – Part 5: Interpolation
>>   (Aditya Mahajan)
>>4. request for \definefontfamily and \definefallbackfamily
>>   (Pablo Rodriguez)
>>5. Re: crappy names in the fontloader (Hans Hagen)
>>6. problems with images, layers and crop marks (Henning Hraban Ramm)
>>7. Re: problems with images, layers and crop marks (Hans Hagen)
>>
>>
>> --
>>
>> Message: 1
>> Date: Sun, 7 Jul 2019 10:17:31 -0400 (EDT)
>> From: Aditya Mahajan 
>> To: mailing list for ConTeXt users 
>> Subject: Re: [NTG-context]  Typesetting Markdown – Part 5:
>> Interpolation
>> Message-ID: 
>> Content-Type: text/plain; charset=US-ASCII; format=flowed
>>
>> On Sat, 6 Jul 2019, Thangalin wrote:
>>
>> > Hello again!
>> >
>> > This part of the series describes how to reference *interpolated*
>> strings
>> > inside Markdown documents.
>> > https://dave.autonoma.ca/blog/2019/07/06/typesetting-markdown-part-5/
>> >
>> > There's a section at the end about eliminating the table of contents
>> from a
>> > reusable document template. I would have preferred using setups, rather
>> > than redefining the \completecontent macro, but didn't see an obvious
>> way
>> > to do so.
>>
>> Why not simply omit \compltecontent from the pandoc template?
>>
>> Aditya
>>
>>
>>
>> --
>>
>> Message: 2
>> Date: Sun, 7 Jul 2019 11:58:12 -0700
>> From: Thangalin 
>> To: mailing list for ConTeXt users 
>> Subject: Re: [NTG-context]  Typesetting Markdown – Part 5:
>> Interpolation
>> Message-ID:
>> > g...@mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Thank you Aditya.
>>
>> The main.tex file is meant to be reusable for different document styles.
>> By
>> removing \completecontent altogether from the main template, it would
>> preclude a different document from reusing the main.tex template with a
>> table of contents. I'd like the template to be "re

Re: [NTG-context] Typesetting Markdown – Part 5: Interpolation

2019-07-08 Thread Andres Conrado
You can do it on the template... you can use a yaml variable to determine
if the toc should be printed or not. Like so:

yaml file:
---
toc: true
...

template file:
%%%
$if(toc)$
\completecontent
$endif$
%%%


Andrés Conrado Montoya
http://chiquitico.org


El lun., 8 jul. 2019 a las 2:52,  escribió:

> Send ntg-context mailing list submissions to
> ntg-context@ntg.nl
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://mailman.ntg.nl/mailman/listinfo/ntg-context
> or, via email, send a message with subject or body 'help' to
> ntg-context-requ...@ntg.nl
>
> You can reach the person managing the list at
> ntg-context-ow...@ntg.nl
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ntg-context digest..."
>
>
> Today's Topics:
>
>1. Re:  Typesetting Markdown – Part 5: Interpolation
>   (Aditya Mahajan)
>2. Re:  Typesetting Markdown – Part 5: Interpolation (Thangalin)
>3. Re:  Typesetting Markdown – Part 5: Interpolation
>   (Aditya Mahajan)
>4. request for \definefontfamily and \definefallbackfamily
>   (Pablo Rodriguez)
>5. Re: crappy names in the fontloader (Hans Hagen)
>6. problems with images, layers and crop marks (Henning Hraban Ramm)
>7. Re: problems with images, layers and crop marks (Hans Hagen)
>
>
> --
>
> Message: 1
> Date: Sun, 7 Jul 2019 10:17:31 -0400 (EDT)
> From: Aditya Mahajan 
> To: mailing list for ConTeXt users 
> Subject: Re: [NTG-context]  Typesetting Markdown – Part 5:
> Interpolation
> Message-ID: 
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> On Sat, 6 Jul 2019, Thangalin wrote:
>
> > Hello again!
> >
> > This part of the series describes how to reference *interpolated* strings
> > inside Markdown documents.
> > https://dave.autonoma.ca/blog/2019/07/06/typesetting-markdown-part-5/
> >
> > There's a section at the end about eliminating the table of contents
> from a
> > reusable document template. I would have preferred using setups, rather
> > than redefining the \completecontent macro, but didn't see an obvious way
> > to do so.
>
> Why not simply omit \compltecontent from the pandoc template?
>
> Aditya
>
>
>
> ------
>
> Message: 2
> Date: Sun, 7 Jul 2019 11:58:12 -0700
> From: Thangalin 
> To: mailing list for ConTeXt users 
> Subject: Re: [NTG-context]  Typesetting Markdown – Part 5:
> Interpolation
> Message-ID:
>  g...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Thank you Aditya.
>
> The main.tex file is meant to be reusable for different document styles. By
> removing \completecontent altogether from the main template, it would
> preclude a different document from reusing the main.tex template with a
> table of contents. I'd like the template to be "reusable"; making
> modifications to "main.tex" --- or creating a copy --- would subvert that
> goal.
>
> On Sun, Jul 7, 2019 at 7:17 AM Aditya Mahajan  wrote:
>
> > On Sat, 6 Jul 2019, Thangalin wrote:
> >
> > > Hello again!
> > >
> > > This part of the series describes how to reference *interpolated*
> strings
> > > inside Markdown documents.
> > > https://dave.autonoma.ca/blog/2019/07/06/typesetting-markdown-part-5/
> > >
> > > There's a section at the end about eliminating the table of contents
> > from a
> > > reusable document template. I would have preferred using setups, rather
> > > than redefining the \completecontent macro, but didn't see an obvious
> way
> > > to do so.
> >
> > Why not simply omit \compltecontent from the pandoc template?
> >
> >
> >
> -- next part --
> An HTML attachment was scrubbed...
> URL: <
> http://mailman.ntg.nl/pipermail/ntg-context/attachments/20190707/25ca6215/attachment-0001.html
> >
>
> --
>
> Message: 3
> Date: Sun, 7 Jul 2019 15:17:50 -0400 (EDT)
> From: Aditya Mahajan 
> To: mailing list for ConTeXt users 
> Subject: Re: [NTG-context]  Typesetting Markdown – Part 5:
> Interpolation
> Message-ID: 
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
>
> On Sun, 7 Jul 2019, Thangalin wrote:
>
> > Thank you Aditya.
> >
> > The main.tex file is meant to be reusable for different document styles.
> By
> > removing \completecontent altogether from the main template, it would

Re: [NTG-context] Typesetting Markdown – Part 5: Interpolation

2019-07-08 Thread Thangalin
Thanks again for the great ideas. The downside is that it comes with a lot
of extra ConTeXt setup code. My understanding is that the toc parameter to
pandoc only works when creating a standalone document. I think
\def\completecontent\empty is a bit more expressive of intent than
\def\completecontent{}. Modes are probably the way to go, though.

Thank you.

On Sun, Jul 7, 2019 at 12:18 PM Aditya Mahajan  wrote:

>
> On Sun, 7 Jul 2019, Thangalin wrote:
>
> > Thank you Aditya.
> >
> > The main.tex file is meant to be reusable for different document styles.
> By
> > removing \completecontent altogether from the main template, it would
> > preclude a different document from reusing the main.tex template with a
> > table of contents. I'd like the template to be "reusable"; making
> > modifications to "main.tex" --- or creating a copy --- would subvert that
> > goal.
>
> Pandoc allows that. For example, see line 140 of the default context
> template:
>
> https://github.com/jgm/pandoc-templates/blob/master/default.context
>
> I don't remember the exact command line parameters for pandoc that set
> the toc flag to true.
>
> An equivalent method will be to control this using a ConTeXt mode.
> Redefining \completecontent to \empty seems too drastic.
>
> Aditya
>
>
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Typesetting Markdown – Part 5: Interpolation

2019-07-07 Thread Aditya Mahajan


On Sun, 7 Jul 2019, Thangalin wrote:


Thank you Aditya.

The main.tex file is meant to be reusable for different document styles. By
removing \completecontent altogether from the main template, it would
preclude a different document from reusing the main.tex template with a
table of contents. I'd like the template to be "reusable"; making
modifications to "main.tex" --- or creating a copy --- would subvert that
goal.


Pandoc allows that. For example, see line 140 of the default context 
template:


https://github.com/jgm/pandoc-templates/blob/master/default.context

I don't remember the exact command line parameters for pandoc that set 
the toc flag to true.


An equivalent method will be to control this using a ConTeXt mode. 
Redefining \completecontent to \empty seems too drastic.


Aditya

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Typesetting Markdown – Part 5: Interpolation

2019-07-07 Thread Thangalin
Thank you Aditya.

The main.tex file is meant to be reusable for different document styles. By
removing \completecontent altogether from the main template, it would
preclude a different document from reusing the main.tex template with a
table of contents. I'd like the template to be "reusable"; making
modifications to "main.tex" --- or creating a copy --- would subvert that
goal.

On Sun, Jul 7, 2019 at 7:17 AM Aditya Mahajan  wrote:

> On Sat, 6 Jul 2019, Thangalin wrote:
>
> > Hello again!
> >
> > This part of the series describes how to reference *interpolated* strings
> > inside Markdown documents.
> > https://dave.autonoma.ca/blog/2019/07/06/typesetting-markdown-part-5/
> >
> > There's a section at the end about eliminating the table of contents
> from a
> > reusable document template. I would have preferred using setups, rather
> > than redefining the \completecontent macro, but didn't see an obvious way
> > to do so.
>
> Why not simply omit \compltecontent from the pandoc template?
>
>
>
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Typesetting Markdown – Part 5: Interpolation

2019-07-07 Thread Aditya Mahajan

On Sat, 6 Jul 2019, Thangalin wrote:


Hello again!

This part of the series describes how to reference *interpolated* strings
inside Markdown documents.
https://dave.autonoma.ca/blog/2019/07/06/typesetting-markdown-part-5/

There's a section at the end about eliminating the table of contents from a
reusable document template. I would have preferred using setups, rather
than redefining the \completecontent macro, but didn't see an obvious way
to do so.


Why not simply omit \compltecontent from the pandoc template?

Aditya

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Typesetting Markdown – Part 5: Interpolation

2019-07-06 Thread Thangalin
Hello again!

This part of the series describes how to reference *interpolated* strings
inside Markdown documents.
https://dave.autonoma.ca/blog/2019/07/06/typesetting-markdown-part-5/

There's a section at the end about eliminating the table of contents from a
reusable document template. I would have preferred using setups, rather
than redefining the \completecontent macro, but didn't see an obvious way
to do so.

Thoughts?
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___