ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Rik Kabel <context@rik.users.panix.com>
Subject: Re: \startuserdata syntax questions
Date: Wed, 29 Aug 2018 09:15:40 +0200	[thread overview]
Message-ID: <536e1256-2f37-c9b3-99a1-551f05b97de6@xs4all.nl> (raw)
In-Reply-To: <00d41d63-0ba0-1049-9119-b42835b18df7@rik.users.panix.com>

On 8/28/2018 10:40 PM, Rik Kabel wrote:
> Wolfgang, Hans, et al,
> 
> The new \startuserdata macro looks very promising, and can simplify some 
> work I have in progress.
> 
> The first question: the wiki example and the source use
> 
>     \userparameter{optionkey}
>     \userparameter{anotherkey}
> 
> to retrieve the value of optionkey and anotherkey. Is there a way to 
> provide the key/value pairs in a manner that they can be retrieved with 
> the getparameters mechanism, as:
> 
>     \getrawparameters [XX] [optionkey=,anotherkey=,#1]
> 
> This has the added advantage of allowing the setting of a default value, as
> 
>     \getrawparameters [XX] [optionkey=2em,anotherkey=,#1]
> 
> Or is there a reason not to use getparameters in this setting?

hardly any of the core mechanisms in mkiv uses get(raw)parameters

define a category and then clone it ...

> The second question: Is there the possibility to enhance the syntax so 
> that one can write
> 
>     \startMyStuff [optionalkey=value, anotherkey=value]
>          stuff
>     \stopMyStuff
> 
> instead of
> 
>     \startuserdata [MyStuff] [optionalkey=value, anotherkey=value]
>     stuff
>     \stopuserdata
> 
> Such syntactic sugar makes sweeter reading of the text, and makes 
> clearer what is being done when nesting the macro.
for such Named environments there are probably other alternatives 
(depending on what you need it for), like blocks

also, user dat picks up its content (they're buffers) so that would also 
mean more nested buffers .. it's meant as a simple mechanism

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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-08-29  7:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 20:40 Rik Kabel
2018-08-29  7:15 ` Hans Hagen [this message]
2018-08-29 15:19   ` Wolfgang Schuster
2018-08-29 16:56     ` Rik Kabel
2018-08-29 17:29     ` Aditya Mahajan

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=536e1256-2f37-c9b3-99a1-551f05b97de6@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=context@rik.users.panix.com \
    --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).