Changes

Jump to navigation Jump to search
m
Text replace - "\[\[cmd:(.*)\|(.*)\]\]" to "{{cmd|$1}}"
The 'key' to the keyval functionality in ConTeXt are two macros called
[[{{cmd:getparameters|\getparameters]] }} and [[{{cmd:processaction|\processaction]]}}.
Here is a 'quickstart', assuming you want to define <tt>\MyZigzag</tt>. The code example is interrupted with explantory running text.
</texcode>
If you want some of the variables to accept keyword values, then you also need to use [[{{cmd:processaction|\processaction]] }} on the ZZ variable in question to map the keywords onto actual values.
Say you want "Dir" to be mandatory and that it accepts 4 directional keywords, as well as a direct angle specification. I've used all mixed case keywords, because otherwise you might run into conflicts with the multilingual interface:
<tt>\s!default</tt> may be triggered because <tt>\ZZDir</tt>'s expansion is empty unless the user supplied something.
The first argument to [[{{cmd:processaction|\processaction]] }} has to be expanded, so you need the [[{{cmd:expandafter|\expandafter]]}}s.
for completeness, here is an example definition of <tt>\checkDir</tt> and <tt>\errorDir</tt>:

Navigation menu