ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: madiazm.eoicc@gmail.com,
	mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: using an end of line as parameter
Date: Tue, 20 Feb 2024 13:13:22 +0100	[thread overview]
Message-ID: <a296e7b3-40a6-4d03-a92a-13952eb95ef9@xs4all.nl> (raw)
In-Reply-To: <170842836658.3180172.16665093832356331442@cgl.ntg.nl>

On 2/20/2024 12:26 PM, madiazm.eoicc@gmail.com wrote:
> Thanks Hans,
> I supposed that lua would be more suitable, but unfortunately I still did not learn it (I hope in summer I have time to read the manual)
> 
> The problem arises from the fact that for each line i will perform a different action and for \def\foo I need four arguments so that I can correctly format the lines. How can i get the result of string.splitlines (s) separated into four arguments to pass to the macro? then \foo would be \def\foo#1SEPARATOR#2SEPARATOR#3SEPARATOR#4
> 
> I now use:
> 
> 
> \starttext
> %now I use the dirty trick of writing an ñ at the end of line so that the macro detects each argument; but for each question I have to manually add it, which is tedious; therefore I look for a solution to detect lines automatically
> 
> %the definition
> \def\tareaAbc #1ñ#2ñ#3ñ#4ñ{\item #1
>      \startitemgroup[lista1a]
>      \item #2
>      \item #3
>      \item #4
>      \stopitemgroup}
> 
> %in the document
> /startitemgropu[lista1a]           %I manually open the first level of the list so the first argument -the question- gets numbered
> 
> \tareaAbc In den Büchereien gibt es auch …ñ       %the question; an item of first level
> … Kuchen.ñ       %option a gets a new list of second level opened and argument 2 is the first item
> … Theater.ñ       %option b another item
> … Workshops.ñ      %option c last item and closes the second level list
> 
> %some more macros with more questions and options
> 
> /stopitemgroup     %I manually close the first level list
You have to provide more details about these lines. For instance, do you 
want to split on spaces?

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 / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2024-02-20 12:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 12:49 [NTG-context] " Miguel Diaz
2024-02-19 22:36 ` [NTG-context] " Hans Hagen
2024-02-20 11:26   ` madiazm.eoicc
2024-02-20 12:13     ` Hans Hagen [this message]
2024-02-20 12:59       ` madiazm.eoicc
2024-02-20 19:10         ` Bruce Horrocks
2024-02-21  8:17           ` madiazm.eoicc
2024-02-21 14:27             ` Bruce Horrocks
2024-02-22 10:17               ` madiazm.eoicc

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=a296e7b3-40a6-4d03-a92a-13952eb95ef9@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=madiazm.eoicc@gmail.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).