ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan via ntg-context <ntg-context@ntg.nl>
To: "Idris Samawi Hamid ادريس سماوي حامد via ntg-context"
	<ntg-context@ntg.nl>
Cc: Aditya Mahajan <adityam@umich.edu>
Subject: Re: Can modes be used for content control?
Date: Wed, 17 Nov 2021 12:56:46 -0500 (EST)	[thread overview]
Message-ID: <nycvar.YAK.7.77.849.2111171253070.1986512@ervasbepr.pvz.zptvyy.pn> (raw)
In-Reply-To: <op.1czew7caejo439@desktop-mt1m160>

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

On Tue, 16 Nov 2021, Idris Samawi Hamid ادريس سماوي حامد wrote:

> Hi Aditya,
> 
> Many thanks; see below:
> 
> On Tue, 16 Nov 2021 17:23:59 -0700, Aditya Mahajan via ntg-context
> <ntg-context@ntg.nl> wrote:
> 
> > On Tue, 16 Nov 2021, Idris Samawi Hamid ادريس سماوي حامد via ntg-context
> > wrote:
> > 
> > > Dear gang,
> > > 
> > > For creating/authoring content in ConTeXt: Can modes or the like be used
> > > for content control? For example, someone wants to write at least two
> > > versions of a book managed from a single file. So, e.g., we may have
> > > 
> > > a) abridged content
> > > b) unabridged content - includes a)
> > > c) abridged content + translation
> > > d) unabridged content + translation
> > > [:]
> > > 
> > > One can author and organize this in XML - pre-ConteXt - but perhaps one
> > > prefers to write in ConTeXt (take advantage of shortcuts etc.). So maybe
> > > 
> > > \defineparagraphs[unabridged]
> > > \defineparagraphs[abridged]
> > > \defineparagraphs[translation]
> > > 
> > > Then one authors the complete work in a single project, but you can
> > > produce a variety of versions, depending on the mode chosen:
> > > 
> > > \definemode[unabridged]
> > > etc.
> > > 
> > > Can one do this in context?
> > 
> > Yes!
> > 
> > This is what I do (for solutions in homework assignments):
> > 
> > \definebuffer[solution][local=yes,nested=yes]
> > 
> > \startmode[solution]
> > \defineenumeration[solution][....fancy setup...]
> > \stopmode
> > 
> > Then, in the main tex file:
> > 
> > ....
> > \startsolution
> > ...
> > \stopsolution
> > ....
> > 
> > By default, gives the version without solution. Compile with --mode=solution
> > to get the version with solution. The same thing should work in your case by
> > defining two modes: unabridged and translation. And then use
> > --mode=unabridged,translate etc to get multiple modes.
> 
> Here's a working sample:
> 
> =======
> % \definebuffer[unabridged]
> % \definebuffer[abridged]
> 
> \setupwhitespace[big]
> 
> \starttext
> \startmode[unabridged]
> \input knuth
> 
> \startblockquote
> \input ward
> \stopblockquote
> 
> % \startmode[abridged]
> % \input knuth
> % \stopmode
> \stopmode
> 
> \startmode[abridged]
> \input knuth
> \stopmode
> 
> % \startmode[abridged]
> % \input zapf
> % \stopmode
> \stoptext
> =======
> 
> Unfortunately - as pointed out on the wiki - modes cannot be nested.

But you don't have to directly use the modes. The following will work:

\definestartstop[abridged]

% By default, don't show the unabridged text
\definebuffer[unabridged][local=yes, nested=yes]

\startmode[unabridged]
% In the unabridged mode, show the abridged text
\definestartstop[unabridged]
\stopmode

\starttext
\startabridged
\input knuth

\startunabridged
\startblockquote
\input ward
\stopblockquote
\stopunabridged

\input zapf
\stopabridged

Blocks are a better mechanism, but I still prefer modes here because I find the \beginblock ... \endblock syntax to be a bit awkward in a context document.

Aditya

[-- 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
___________________________________________________________________________________

  parent reply	other threads:[~2021-11-17 17:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 23:25 Idris Samawi Hamid ادريس سماوي حامد via ntg-context
2021-11-17  0:23 ` Aditya Mahajan via ntg-context
2021-11-17  3:06   ` Idris Samawi Hamid ادريس سماوي حامد via ntg-context
2021-11-17 11:32     ` Henning Hraban Ramm via ntg-context
2021-11-17 15:08       ` Idris Samawi Hamid ادريس سماوي حامد via ntg-context
2021-11-17 15:51         ` Henning Hraban Ramm via ntg-context
2021-11-17 19:52           ` Idris Samawi Hamid ادريس سماوي حامد via ntg-context
2021-11-17 15:57         ` Taco Hoekwater via ntg-context
2021-11-17 17:56     ` Aditya Mahajan via ntg-context [this message]
2021-11-17 18:54       ` Hans Hagen via ntg-context
2021-11-17 19:45         ` Idris Samawi Hamid ادريس سماوي حامد via ntg-context
2021-11-17 19:36       ` Idris Samawi Hamid ادريس سماوي حامد via ntg-context
2021-11-17  7:59 ` Hans Hagen via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=nycvar.YAK.7.77.849.2111171253070.1986512@ervasbepr.pvz.zptvyy.pn \
    --to=ntg-context@ntg.nl \
    --cc=adityam@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).