![](https://secure.gravatar.com/avatar/565476157eb3895a9c928ffce26d988d.jpg?s=120&d=mm&r=g)
Peter Münster wrote:
Hello,
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=start] % 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={\beforeXXX},after={\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=green,#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=blue] % same text, but in blue \stoptext %%%%%%%%%%%%%%%%%%% buf.tex