* Typing efficiency
@ 2020-09-04 12:02 Jan Willem Flamma
2020-09-04 13:51 ` Taco Hoekwater
0 siblings, 1 reply; 4+ messages in thread
From: Jan Willem Flamma @ 2020-09-04 12:02 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1: Type: text/html, Size: 5065 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Typing efficiency
2020-09-04 12:02 Typing efficiency Jan Willem Flamma
@ 2020-09-04 13:51 ` Taco Hoekwater
2020-09-04 14:26 ` Wolfgang Schuster
0 siblings, 1 reply; 4+ messages in thread
From: Taco Hoekwater @ 2020-09-04 13:51 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
Sounds like a job for the blocks mechanism more so than buffers:
\defineblock[entext]
\defineblock[nltext]
\defineselector [language] [max=2,n=1]
\startmode[en]
\setupselector[language][n=1]
\keepblocks[entext]
\stopmode
\startmode[nl]
\setupselector[language][n=2]
\keepblocks[nltext]
\stopmode
\starttext
\startsection[title=\select{language}{English title}{Dutch title}]
\beginentext
This is English text.
\endentext
\beginnltext
This is Dutch text.
\endnltext
\stopsection
\stoptext
Best wishes,
Taco
> On 4 Sep 2020, at 14:02, Jan Willem Flamma <register12c@gmail.com> wrote:
>
> Dear list member,
>
> Following up from:
> https://www.mail-archive.com/ntg-context@ntg.nl/msg94719.html
>
> The below MWE works but how can I avoid having to type
> \startmode[en]
> \getbuffer[en]
> \stopmode
> \startmode[nl]
> \getbuffer[nl]
> \stopmode
>
> after every block of text?
>
> I tried to define a new start/stop pair as follows:
> \definestartstop[Bufen][
> before={\startmode[en]
> \startbuffer[en]},
> after={\stopbuffer
> \getbuffer[en]
> \stopmode}]
>
> but that fails.
>
> No doubt a clever solution exists that minimizes the typing.
>
> Kind regards,
> Jan Willem
>
>
> ===
> \setupinteraction[state=start]
>
> %\enablemode[nl]
> \enablemode[en]
>
> \defineselector [language] [max=2,n=1]
> \startmode[en]
> \setupselector[language][n=1]
> \stopmode
> \startmode[nl]
> \setupselector[language][n=2]
> \stopmode
>
> \starttext
>
> \startsection[title=\select{language}{English title}{Dutch title}]
>
> \startbuffer[en]
> This is English text.
> \stopmode
> \stopbuffer
> \startbuffer[nl]
> This is Dutch text.
> \stopbuffer
>
> \startmode[en]
> \getbuffer[en]
> \stopmode
> \startmode[nl]
> \getbuffer[nl]
> \stopmode
>
> \stopsection
>
> \stoptext
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
Taco Hoekwater
Elvenkind BV
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Typing efficiency
2020-09-04 13:51 ` Taco Hoekwater
@ 2020-09-04 14:26 ` Wolfgang Schuster
2020-09-06 11:28 ` Jan Willem Flamma
0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2020-09-04 14:26 UTC (permalink / raw)
To: mailing list for ConTeXt users
Taco Hoekwater schrieb am 04.09.2020 um 15:51:
>
> Hi,
>
> Sounds like a job for the blocks mechanism more so than buffers:
>
>
> \defineblock[entext]
> \defineblock[nltext]
>
> \defineselector [language] [max=2,n=1]
> \startmode[en]
> \setupselector[language][n=1]
> \keepblocks[entext]
> \stopmode
> \startmode[nl]
> \setupselector[language][n=2]
> \keepblocks[nltext]
> \stopmode
>
> \starttext
>
> \startsection[title=\select{language}{English title}{Dutch title}]
>
> \beginentext
> This is English text.
> \endentext
> \beginnltext
> This is Dutch text.
> \endnltext
>
> \stopsection
>
> \stoptext
It can also be done with buffers.
\definebuffer [entext]
\definebuffer [nltext]
\defineselector [language] [max=2,n=1]
\startmode[en]
\setupselector[language][n=1]
\def\stopentext{\getentext}
\stopmode
\startmode[nl]
\setupselector[language][n=2]
\def\stopnltext{\getnltext}
\stopmode
\starttext
\startsection[title=\select{language}{English title}{Dutch title}]
\startentext
This is English text.
\stopentext
\startnltext
This is Dutch text.
\stopnltext
\stopsection
\stoptext
Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-06 11:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 12:02 Typing efficiency Jan Willem Flamma
2020-09-04 13:51 ` Taco Hoekwater
2020-09-04 14:26 ` Wolfgang Schuster
2020-09-06 11:28 ` Jan Willem Flamma
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).