ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <pragma@wxs.nl>
Subject: Re: checkparameters and current beta (20120802)
Date: Fri, 3 Aug 2012 22:44:11 +0200	[thread overview]
Message-ID: <120BF52A-B0AB-4656-AF5E-5D2A66CFFF1F@gmail.com> (raw)
In-Reply-To: <501C22AA.4000909@aon.at>


Am 03.08.2012 um 21:12 schrieb Daniel Schopper <daniel.schopper@aon.at>:

> Hi,
> \checkparameters seems broken in the current beta. The following example used to work at least with version 2012.06.13
> 
> ---------------------------------------------------------------------------------
> \def\myCom[#1]{%
> 	\checkparameters[#1]
> 	\ifparameters
> 		\getparameters[do][one=1,two=2,#1]
> 		\doone\ \dotwo
> 	\else
> 		#1
> 	\fi
> }
> \starttext
> \myCom[one]
> 
> \myCom[one=one,two=two]
> \stoptext

You have to change this on syst-aux.mkiv:

\unexpanded\def\checkparameters[#1]%
- {\syst_helpers_get_empty_parameters#1=@@\_e_o_s_}
+ {\syst_helpers_check_parameters#1=@@\_e_o_s_}

You can also use \doifassignmentelse to check the content of your macro.

\def\mycommand[#1]%
  {\doifassignmentelse{#1}
     {\getrawparameters[mycommand][one=1,two=2,#1]%
      \mycommandone\ \mycommandtwo}
     {#1}}

When you want to use \if… \else … \fi in your command you can use this:

\def\mycommand[#1]%
  {\doifassignmentelse{#1}\donetrue\donefalse
   \ifdone
     \getrawparameters[mycommand][one=1,two=2,#1]%
     \mycommandone\ \mycommandtwo
   \else
     #1%
   \fi}

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
___________________________________________________________________________________


  reply	other threads:[~2012-08-03 20:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-03 19:12 Daniel Schopper
2012-08-03 20:44 ` Wolfgang Schuster [this message]
2012-08-04  9:30   ` Daniel Schopper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=120BF52A-B0AB-4656-AF5E-5D2A66CFFF1F@gmail.com \
    --to=wolfgang.schuster@gmail.com \
    --cc=ntg-context@ntg.nl \
    --cc=pragma@wxs.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).