From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/78402 Path: news.gmane.org!not-for-mail From: Philipp Gesang Newsgroups: gmane.comp.tex.context Subject: need help with macro Date: Sun, 23 Sep 2012 15:33:54 +0200 Message-ID: <20120923133354.GA29608@phlegethon.router_intern> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1899334231==" X-Trace: ger.gmane.org 1348407249 17206 80.91.229.3 (23 Sep 2012 13:34:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 23 Sep 2012 13:34:09 +0000 (UTC) To: ConTeXt ML Original-X-From: ntg-context-bounces@ntg.nl Sun Sep 23 15:34:10 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TFmK2-0005RF-5U for gctc-ntg-context-518@m.gmane.org; Sun, 23 Sep 2012 15:34:10 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 986BD101E2; Sun, 23 Sep 2012 15:34:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ojwlRl-3WGt6; Sun, 23 Sep 2012 15:34:02 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 8853A101E8; Sun, 23 Sep 2012 15:34:02 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 69B63101E8 for ; Sun, 23 Sep 2012 15:34:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Pg6zJBord720 for ; Sun, 23 Sep 2012 15:34:00 +0200 (CEST) Original-Received: from filter5-til.mf.surf.net (filter5-til.mf.surf.net [194.171.167.221]) by balder.ntg.nl (Postfix) with ESMTP id 4F6D0101E2 for ; Sun, 23 Sep 2012 15:34:00 +0200 (CEST) Original-Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by filter5-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id q8NDVS0J032441 for ; Sun, 23 Sep 2012 15:31:28 +0200 Original-Received: from ix.urz.uni-heidelberg.de (cyrus-portal.urz.uni-heidelberg.de [129.206.100.176]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id q8NDXwPd023581 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 23 Sep 2012 15:33:58 +0200 Original-Received: from extmail.urz.uni-heidelberg.de (extmail.urz.uni-heidelberg.de [129.206.100.140]) by ix.urz.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id q8NDXuud012817 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 23 Sep 2012 15:33:58 +0200 Original-Received: from localhost (p5084723F.dip.t-dialin.net [80.132.114.63]) (authenticated bits=0) by extmail.urz.uni-heidelberg.de (8.13.4/8.13.1) with ESMTP id q8NDXtm3009602 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Sun, 23 Sep 2012 15:33:56 +0200 Mail-Followup-To: ConTeXt ML X-Operating-System: Linux phlegethon 3.5.3-1-ARCH X-License: "CC-BY-SA 3.0" User-Agent: Mutt/1.5.21 (2010-09-15) X-Bayes-Prob: 0.5 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=129.206.100.212; country=DE; region=01; city=Heidelberg; latitude=49.4167; longitude=8.7000; http://maps.google.com/maps?q=49.4167,8.7000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.221 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 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-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:78402 Archived-At: --===============1899334231== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="d6Gm4EdcadzBjdND" Content-Disposition: inline --d6Gm4EdcadzBjdND Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi all, I have a macro =E2=80=9Cmogrify=E2=80=9D that eats three tokens of a string= and treats them differently from the rest of the string. I can=E2=80=99t however use it inside more complex macros. Is there a way out or an alternative using macros? (No Lua.) Other formatting macros work fine in the same place. Any help will be greatly appreciated Philipp =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2= =B7 Example Code =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2= =B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7= =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2= =B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7 % macros=3Dmkvi \unprotect \def\mogrify#content{% \begingroup \let\stopper\relax \def\get_first_three##1##2##3##4\stopper{% \def\first_three{##1##2##3}% \def\rest{##4}% }% \get_first_three#content\stopper% \colored[red]{\first_three}% \colored[green]{\rest}% \endgraf \endgroup% } \installnamespace {ww} \installcommandhandler \????ww {ww} \????ww \appendtoks \setuevalue{\currentww}{\wont_work[\currentww]} \to \everydefineww \unexpanded\def\wont_work[#id]{% \edef\current_wont_work{#id}% \dosingleempty\wont_work_indeed% } \def\wont_work_indeed[#setups]#content{% \iffirstargument\setupcurrentww[#setups]\fi %% here is the problem: \doifsomething{\wwparameter{param}}{\mogrify{\wwparameter{param}}}% \endgraf \framed{#content}% } \defineww[wontwork] \protect \starttext \mogrify{foobar}\par%% the macro does work in isolation \wontwork[param=3Dwhatever]{will it work?} \wontwork[param=3D] {this, however, does work} \stoptext =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2= =B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7= =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2= =B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7= =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2= =B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7 --=20 () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments --d6Gm4EdcadzBjdND Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEUEARECAAYFAlBfD8IACgkQ02lYlJYWs9JmuwCcDg1qf9fMfbgfOMaIffgMrVTD zLIAmOCkIQnaWz+SyAZ3ZgXLwkBDyNU= =q3eO -----END PGP SIGNATURE----- --d6Gm4EdcadzBjdND-- --===============1899334231== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============1899334231==--