From: Hans Hagen <j.hagen@xs4all.nl>
To: ntg-context@ntg.nl
Subject: [NTG-context] Re: using an end of line as parameter
Date: Mon, 19 Feb 2024 23:36:58 +0100 [thread overview]
Message-ID: <4f300932-a8a0-49e7-ae28-81ed8f54db54@xs4all.nl> (raw)
In-Reply-To: <CAAxTiRhuBQT5t2okSsT8FVHvAcZk7xg_J5nG8PZNkzFJJB=QgQ@mail.gmail.com>
On 2/19/2024 1:49 PM, Miguel Diaz wrote:
> Dear list,
> I want to format some language tests that different people are
> preparing. Each one uses different software and there are always
> problems in format that i want to solve.
>
> for a a/b/c questions I receive text that I will format to a list
> (comments are mine)
>
> In den Büchereien gibt es auch … %the question
> … Kuchen. %option a
> … Theater. %option b
> … Workshops. %option c
>
> I need to detect \par or whatever sign marks the newline character as an
> argument delimiter so that I dont have to paste hundreds of times braces
> for each argument.
> For the example, I use this macro definition (which does no work!)
>
> \long\def\prueba
> #1\par#2\par#3\par#4ñ{\framed[frame=off,width=0.8\textwidth,corner=round,offset=1em,align=flushleft]%
> {{\bf Beispiel}: #1\\
> \qquad a) #2\\
> \qquad b) {\bf #3}\\
> \qquad c) #4
> }
>
> I get: tex error on line 493 in file ./prueba.tex: The file ended when
> scanning an argument.
>
> the macro seems to read to the end of file not detecting \par; I know
> its the \par that causes the problem; I used ^^M also which I read is a
> sinonym for return but it also does not work.
>
> Help would be appreciated (my computer keyboard would appreciate it too...)
better start thinking something:
\starttext
\def\foo#1{<<<#1>>>>\par}
\startluacode
local s = [[
line 1
line 2
line 3
line 4
]]
-- local s - io.loaddata("yourfile.txt")
local lines = string.splitlines(s)
for i=1,#lines do
if lines[i] ~= "" then
context.foo(lines[i])
end
end
\stopluacode
\stoptext
-----------------------------------------------------------------
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
___________________________________________________________________________________
next prev parent reply other threads:[~2024-02-19 22:40 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 ` Hans Hagen [this message]
2024-02-20 11:26 ` [NTG-context] " madiazm.eoicc
2024-02-20 12:13 ` Hans Hagen
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=4f300932-a8a0-49e7-ae28-81ed8f54db54@xs4all.nl \
--to=j.hagen@xs4all.nl \
--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).