ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm <texml@fiee.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Defining command with optional and mandatory arguments
Date: Thu, 24 May 2018 15:17:12 +0200	[thread overview]
Message-ID: <99A17897-EF06-4A8F-9FC2-3AB9F27DC379@fiee.net> (raw)
In-Reply-To: <CAO8LnPFAOohZp3-ZLGDSRhrPQYtC1=OwC9S613jK1sV=G1Cqiw@mail.gmail.com>

Am 2018-05-24 um 11:24 schrieb Christoph Reller <christoph.reller@gmail.com>:

> On Wed, 23 May 2018 17:54:39 +0200, Henning Hraban Ramm <texml@fiee.net> wrote:
>>>> What is the right way to define a command with both mandatory and
>>>> optional arguments, e.g:
>>> i'm not sure wht happens at your end but this is the best way:
>> 
>> Also, there’s documentation at
>> http://wiki.contextgarden.net/Commands_with_optional_arguments
>> If there’s something wrong, please fix it yourself or come back to this list ;)
> 
> Thank you Hraban for pointing me to the wiki. I was aware of this page
> but it contains only the case of mandatory arguments in curly braces
> {} not in brackets [].

Arguments in brackets are always optional (if I don’t misunderstand), depending on your own logic (\if*argument, \ifempty etc.)

see also
http://wiki.contextgarden.net/System_Macros :
http://wiki.contextgarden.net/System_Macros/Handling_Arguments
http://wiki.contextgarden.net/System_Macros/Branches_and_Decisions
etc.
I need to read these more often myself...

Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2018-05-24 13:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24  9:24 Christoph Reller
2018-05-24 13:17 ` Henning Hraban Ramm [this message]
2018-05-24 13:43   ` Taco Hoekwater
2018-05-24 16:07 ` Alan Braslau
  -- strict thread matches above, loose matches on Subject: below --
2018-05-25  5:08 Christoph Reller
2018-05-24  9:21 Christoph Reller
2018-05-24 12:50 ` Hans Hagen
2018-05-23 13:39 Christoph Reller
2018-05-23 14:01 ` Hans Hagen
2018-05-23 15:54   ` Henning Hraban Ramm

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=99A17897-EF06-4A8F-9FC2-3AB9F27DC379@fiee.net \
    --to=texml@fiee.net \
    --cc=ntg-context@ntg.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).