From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/103529 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: Modes and conditional part of the source Date: Thu, 28 Feb 2019 06:54:06 -0500 (EST) Message-ID: References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-2105923288-1551354848=:5154" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="209008"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Alpine 2.21.99 (LNX 239 2017-12-04) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Feb 28 12:54:31 2019 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gzKGk-000sFW-4P for gctc-ntg-context-518@m.gmane.org; Thu, 28 Feb 2019 12:54:30 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 9B8A1F63C9; Thu, 28 Feb 2019 12:54:14 +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 0NqeFJgPXL4b; Thu, 28 Feb 2019 12:54:13 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 0862BF63CF; Thu, 28 Feb 2019 12:54:13 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id A55F6F63CF for ; Thu, 28 Feb 2019 12:54:11 +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 HPKIjzPq44x5 for ; Thu, 28 Feb 2019 12:54:10 +0100 (CET) Original-Received: from tombraider.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.12.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 66867F63C9 for ; Thu, 28 Feb 2019 12:54:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu; s=relay-2016-05-12; t=1551354848; bh=skZ7B3oNpS3fKC+WttY2w2btshBTTKwVSe9QgJ/mdm8=; h=Date:From:To:Subject:In-Reply-To:References; b=UCdlnbUStBdE02BCTL6OPdoyDpu2rJOOc6AbX0hc8DJrKTbPtiLtg9dsX7bpRZDqU pyjjgVGtg9gkBFa3K8DMH5rT6qecZj0zZezgK1LcPronifqx0hkZeaGLOH4tnK5X4f wDKng10j6hrkVaAVG3H7QQpUgNq0d7446gWIr9g4mGSiN9EGRrcLTfj9VXV2WGv0KM O3yJQE9ODsdum60nfrPGSNmkSSCA3ca9E/UBxRAYK+eUJmQq9SH+iQZOd/hHRMju2e 0tIRjqzyAfjC3cLiCiEDqTU4Wd382dh6tApiAFnn2D5BZbC0WeFPHcY/DpPl7TZ1UY /yjDb7IqaRqxA== Authentication-Results: tombraider.mr.itd.umich.edu; iprev=pass policy.iprev=198.84.249.206 (198-84-249-206.cpe.teksavvy.com); auth=pass smtp.auth=adityam Original-Received: FROM adi-thinkpad.local (198-84-249-206.cpe.teksavvy.com [198.84.249.206]) By tombraider.mr.itd.umich.edu ID 5C77CBE0.4DAD6.13467; Authuser adityam; Thu, 28 Feb 2019 06:54:08 -0500 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.org gmane.comp.tex.context:103529 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. --8323329-2105923288-1551354848=:5154 Content-Type: text/plain; charset=iso-8859-2; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 28 Feb 2019, Proch=E1zka Luk=E1=B9 Ing. wrote: > Hello, > > I'm struggling with using modes to make a part of the text conditional. > > Here is my code: > > ---- > \def\b#1{\startmode[#1]} > \def\e{\stopmode} > > % \enablemode[100] % For optional usage > > \starttext > A > \b{100} % Should be start of some conditional text from here ... > B > \e % ... to here > \stoptext Modes don't work that way. You can do something like this: \define[1]\bbb {\doifnotmode{#1} {\grabbufferdata[dummy][bbb][eee]}} \let\eee\relax \enablemode[100] \starttext A \bbb{100} Inside mode 100 \eee \bbb{101} Inside mode 101 \eee \stoptext Depending on the actual use case, there might be simpler ways. Aditya --8323329-2105923288-1551354848=:5154 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== --8323329-2105923288-1551354848=:5154--