ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: Sanjoy Mahajan <sanjoy@olin.edu>,
	mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: constructing block content partly with lua
Date: Tue, 5 Feb 2019 17:21:50 +0100	[thread overview]
Message-ID: <21f43e43-fb30-b051-8358-60e5911dfe30@xs4all.nl> (raw)
In-Reply-To: <87r2cmgspw.fsf@olin.edu>

On 2/5/2019 4:28 PM, Sanjoy Mahajan wrote:
> On 2019-02-05 16:24, Hans Hagen <j.hagen@xs4all.nl> wrote:
> 
>>> \startluacode
>>>     context.beginanswer()
>>>     context("\\onearg{Test parameter}")
>>
>> does
>>
>> context.onearg("Test parameter")
>>
>> work?
> 
> Sorry, I forgot to say that I had tried that version too but also with
> no luck.  Also, either version of onerg works as expected if I delete
> the context.beginanswer() and the \endanswer lines.
the problem is that you effectively use buffers so you have a different 
catcode regime ... i'm not sure what you want but thsi might give a clue

\starttext

\defineblock[foo]

\beginfoo
     test 1
\endfoo

\startluacode
buffers.assign("temp","test 2")
structures.blocks.save("foo",nil,nil,"temp")
\stopluacode

\useblocks[foo]

\stoptext

there are mechanisms for templates for constructing more meaningful 
content than "test 2" (see test suite)

-----------------------------------------------------------------
                                           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:[~2019-02-05 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-05 15:01 Sanjoy Mahajan
2019-02-05 15:24 ` Hans Hagen
2019-02-05 15:28   ` Sanjoy Mahajan
2019-02-05 16:21     ` Hans Hagen [this message]
2019-02-06 15:25       ` Sanjoy 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=21f43e43-fb30-b051-8358-60e5911dfe30@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    --cc=sanjoy@olin.edu \
    /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).