From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/20579 Path: news.gmane.org!not-for-mail From: Taco Hoekwater Newsgroups: gmane.comp.tex.context Subject: Re: \stopbuffer in macro Date: Mon, 30 May 2005 23:50:56 +0200 Message-ID: <429B8AC0.3020503@elvenkind.com> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1117489978 27936 80.91.229.2 (30 May 2005 21:52:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 30 May 2005 21:52:58 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon May 30 23:52:57 2005 Return-path: Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1DcsAn-00032d-EN for gctc-ntg-context-518@m.gmane.org; Mon, 30 May 2005 23:51:50 +0200 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id C3D06127C0; Mon, 30 May 2005 23:54:29 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 04869-01-3; Mon, 30 May 2005 23:54:26 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 1C89D127A8; Mon, 30 May 2005 23:54:26 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id EB317127A8 for ; Mon, 30 May 2005 23:54:24 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 04869-01-2 for ; Mon, 30 May 2005 23:54:24 +0200 (CEST) Original-Received: from post-24.mail.nl.demon.net (post-24.mail.nl.demon.net [194.159.73.194]) by ronja.ntg.nl (Postfix) with ESMTP id 1DB351279F for ; Mon, 30 May 2005 23:54:23 +0200 (CEST) Original-Received: from boo.demon.nl ([82.161.175.147]:42586 helo=[192.168.1.3]) by post-24.mail.nl.demon.net with esmtp (Exim 4.43) id 1DcsDH-0001n2-Mt for ntg-context@ntg.nl; Mon, 30 May 2005 21:54:23 +0000 User-Agent: Mozilla Thunderbird 1.0 (X11/20050215) X-Accept-Language: en-us, en Original-To: ntg-context@ntg.nl In-Reply-To: X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on smtp.ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:20579 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:20579 Peter M=FCnster wrote: > Hello, >=20 > how could I build some macros, that make usage of \startbuffer and > \stopbuffer? > Example: > \def\startXXX[#1]{\doSomeMagicSetups{#1}% > \startbuffer[...]} > \def\stopXXX{\stopbuffer > \doSomeSpecialWorkHere} > And then: > \startXXX[some options] > some text > \stopXXX I hope this helps: %%%%%%%%%%%%%%%%%% buf.tex % use colors \setupcolors[state=3Dstart] % this defines a new type of buffer called XXX, so that % the commands \startXXX ... \stopXXX, \getXXX and % \typeXXX are now defined \definebuffer[XXX] % two sentinel definitions are placed before and after % the actual buffer content, as fetched by \getXXX \setupbuffer[XXX][before=3D{\beforeXXX},after=3D{\afterXXX}] % Do not call \getXXX directly, but use a special % command to pass options to \beforeXXX and \afterXXX \def\finishXXX{\dosingleempty\dofinishXXX} \def\dofinishXXX[#1]{{\getparameters[XXX][Color=3Dgreen,#1]\getXXX }} % within the next commans, there is now a set if parameters % starting with \XXX, initialized by the \getparameters % call in the macro above. \def\beforeXXX{\startcolor[\XXXColor]} \def\afterXXX{\stopcolor} % below here is an example \starttext \startXXX Here is some text \stopXXX \finishXXX % defaults to using green text. \finishXXX[Color=3Dblue] % same text, but in blue \stoptext %%%%%%%%%%%%%%%%%%% buf.tex