From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/113456 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aditya Mahajan via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Can modes be used for content control? Date: Wed, 17 Nov 2021 12:56:46 -0500 (EST) Message-ID: References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="-830189494-98250447-1637171806=:1986512" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4180"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Alpine 2.22 (LNX 394 2020-01-19) Cc: Aditya Mahajan To: "=?ISO-8859-6?Q?Idris_Samawi_Hamid_=C7=CF=D1=EA=D3_=D3=E5=C7=E8=EA?= =?ISO-8859-6?Q?_=CD=C7=E5=CF_via_ntg-context?=" Original-X-From: ntg-context-bounces@ntg.nl Wed Nov 17 18:58:42 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mnPCk-0000q4-2Q for gctc-ntg-context-518@m.gmane-mx.org; Wed, 17 Nov 2021 18:58:42 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 0B1BD280582; Wed, 17 Nov 2021 18:57:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UJjEBB0xe8PO; Wed, 17 Nov 2021 18:57:48 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id A49F5289391; Wed, 17 Nov 2021 18:57:48 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 45545280582 for ; Wed, 17 Nov 2021 18:57:46 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nnR9eQWRmokb for ; Wed, 17 Nov 2021 18:57:45 +0100 (CET) Received-SPF: Softfail (mailfrom) identity=mailfrom; client-ip=132.206.73.2; helo=orford.cim.mcgill.ca; envelope-from=adityam@umich.edu; receiver= Original-Received: from orford.cim.mcgill.ca (smtp.cim.mcgill.ca [132.206.73.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id BB9F8282FE5 for ; Wed, 17 Nov 2021 18:57:43 +0100 (CET) Original-Received: from reinforce.cim.mcgill.ca (reinforce.cim.mcgill.ca [132.206.74.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: adityam) by orford.cim.mcgill.ca (Postfix) with ESMTPSA id AF0F482601D for ; Wed, 17 Nov 2021 12:57:41 -0500 (EST) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:113456 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---830189494-98250447-1637171806=:1986512 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 16 Nov 2021, Idris Samawi Hamid =D8=A7=D8=AF=D8=B1=D9=8A=D8=B3 =D8= =B3=D9=85=D8=A7=D9=88=D9=8A =D8=AD=D8=A7=D9=85=D8=AF wrote: > Hi Aditya, >=20 > Many thanks; see below: >=20 > On Tue, 16 Nov 2021 17:23:59 -0700, Aditya Mahajan via ntg-context > wrote: >=20 > > On Tue, 16 Nov 2021, Idris Samawi Hamid =D8=A7=D8=AF=D8=B1=D9=8A=D8=B3 = =D8=B3=D9=85=D8=A7=D9=88=D9=8A =D8=AD=D8=A7=D9=85=D8=AF via ntg-context > > wrote: > >=20 > > > Dear gang, > > >=20 > > > For creating/authoring content in ConTeXt: Can modes or the like be u= sed > > > 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 > > >=20 > > > a) abridged content > > > b) unabridged content - includes a) > > > c) abridged content + translation > > > d) unabridged content + translation > > > [:] > > >=20 > > > One can author and organize this in XML - pre-ConteXt - but perhaps o= ne > > > prefers to write in ConTeXt (take advantage of shortcuts etc.). So ma= ybe > > >=20 > > > \defineparagraphs[unabridged] > > > \defineparagraphs[abridged] > > > \defineparagraphs[translation] > > >=20 > > > Then one authors the complete work in a single project, but you can > > > produce a variety of versions, depending on the mode chosen: > > >=20 > > > \definemode[unabridged] > > > etc. > > >=20 > > > Can one do this in context? > >=20 > > Yes! > >=20 > > This is what I do (for solutions in homework assignments): > >=20 > > \definebuffer[solution][local=3Dyes,nested=3Dyes] > >=20 > > \startmode[solution] > > \defineenumeration[solution][....fancy setup...] > > \stopmode > >=20 > > Then, in the main tex file: > >=20 > > .... > > \startsolution > > ... > > \stopsolution > > .... > >=20 > > By default, gives the version without solution. Compile with --mode=3Ds= olution > > to get the version with solution. The same thing should work in your ca= se by > > defining two modes: unabridged and translation. And then use > > --mode=3Dunabridged,translate etc to get multiple modes. >=20 > Here's a working sample: >=20 > =3D=3D=3D=3D=3D=3D=3D > % \definebuffer[unabridged] > % \definebuffer[abridged] >=20 > \setupwhitespace[big] >=20 > \starttext > \startmode[unabridged] > \input knuth >=20 > \startblockquote > \input ward > \stopblockquote >=20 > % \startmode[abridged] > % \input knuth > % \stopmode > \stopmode >=20 > \startmode[abridged] > \input knuth > \stopmode >=20 > % \startmode[abridged] > % \input zapf > % \stopmode > \stoptext > =3D=3D=3D=3D=3D=3D=3D >=20 > 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=3Dyes, nested=3Dyes] \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 docu= ment. Aditya ---830189494-98250447-1637171806=:1986512 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== ---830189494-98250447-1637171806=:1986512--