ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \setupframed[...][...=...]
@ 2006-04-12  0:25 Vit Zyka
  2006-04-12  8:56 ` \setupframed[...][...=...] Hans Hagen
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Vit Zyka @ 2006-04-12  0:25 UTC (permalink / raw)


Hi,

I tied to extend \setupframed[...=...] to also \setupframed[...][...=...]:

---------------------------------
\unprotect
\def\setupframed{\dodoubleempty\dosetupframed}
\def\dosetupframed{%
   \ifsecondargument
     \@EA\dodoublesetupframed
   \else
     \@EA\dosinglesetupframed
   \fi
}
\def\dosinglesetupframed[#1][#2]{\getparameters[\??oi][#1]}
\def\dodoublesetupframed[#1][#2]{%
   \bgroup
     \def\dodoubleempty{}%
     \def\doframed[##1]{##1}%
     \xdef\tmp{\getvalue{#1}}%
   \egroup
 
\@EA\setvalue\@EA{\@EA#1\@EA}\@EA{\@EA\dodoubleempty\@EA\doframed\@EA[\tmp,#2]}%
}
\protect

\starttext
\setupframed[framecolor=yellow]          \framed{A}
\defineframed[myframed][framecolor=blue] \myframed{B}
\setupframe[myframe][framecolor=red]     \myframed{C}
\stoptext
-------------------------------------

it works but with fully expansion of options. So it works a bit 
differently in a cases
1)
\def\ONorOFF{off}
\defineframed[myframed][frame=\ONorOFF]
\def\ONorOFF{on}\myframed{A}

2)
\def\ONorOFF{off}
\defineframed[myframed][frame=\ONorOFF]
\setupframed[myframe][framecolor=red]
\def\ONorOFF{on}\myframed{A}

Is there some simple solution? Or it has to be rewritten in a way like 
other \definesomething[...] (storing every parameter/definition-instance 
in a macro)? If sometimes this code would be reviewed I vote for doing 
\setupframed in this 'standard' ConTeXt way.

Vit

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-04-12 16:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-12  0:25 \setupframed[...][...=...] Vit Zyka
2006-04-12  8:56 ` \setupframed[...][...=...] Hans Hagen
2006-04-12  9:11 ` \setupframed[...][...=...] Hans Hagen
2006-04-12  9:39   ` \setupframed[...][...=...] Vit Zyka
2006-04-12  9:14 ` \setupframed[...][...=...] Hans Hagen
2006-04-12 13:29   ` \setupframed[...][...=...] Vit Zyka
2006-04-12 14:26     ` \setupframed[...][...=...] Hans Hagen
2006-04-12 16:04       ` \setupframed[...][...=...] Vit Zyka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).