···<date: 2012-09-23, Sunday>···<from: Wolfgang Schuster>···
> It’s a expansion problem, you can either expand the content in the definition > of \mogrify (as seen below) > or you make the \mogrify command unexpanded and you expand the content of the > \wwparameter > (i.e. \doifsomething{…}{\normalexpanded{\mogrify{…}}}) Thanks a lot, I rewrote my macros according to your the first suggestion and it works like a breeze. Best regards Philipp > > \unprotect > > \def\mogrify_scan#first#second#third#rest\relax > {\def\m_mogrify_three{#first#second#third}% > \def\m_mogrify_rest {#rest}} > > \def\mogrify#content% > {\begingroup > \edef\m_mogrify_content{#content}% > \expandafter\mogrify_scan\m_mogrify_content\relax > \colored [red]{\m_mogrify_three}% > \colored[green]{\m_mogrify_rest }% > \endgraf > \endgroup} > > \installnamespace {ww} > \installcommandhandler \????ww {ww} \????ww > > \appendtoks > \setuevalue{\currentww}{\wont_work[\currentww]} > \to \everydefineww > > \unexpanded\def\wont_work[#id]% > {\edef\currentww{#id}% > \dosingleempty\wont_work_indeed} > > \def\wont_work_indeed[#setups]#content% > {\iffirstargument\setupcurrentww[#setups]\fi > \doifsomething{\wwparameter{param}}{\mogrify{\wwparameter{param}}}% > \endgraf > \framed{#content}} > > \defineww[wontwork] > > \protect > > \starttext > > \mogrify{foobar}\par%% the macro does work in isolation > > \wontwork[param=whatever]{will it work?} > \wontwork[param=] {this, however, does work} > > \stoptext > > Wolfgang > > ___________________________________________________________________________________ > 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 > ___________________________________________________________________________________ -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
pgpVn3fl4w27P.pgp
Description: PGP signature
___________________________________________________________________________________ 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 ___________________________________________________________________________________