From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Node for startbuffer.
Date: Wed, 09 Jan 2013 16:30:19 +0100 [thread overview]
Message-ID: <50ED8D0B.8030708@wxs.nl> (raw)
In-Reply-To: <CADVh14XiXS1mO7vSriHntvosOyCY_LLOut2s0JtiKqRYjQ_C2A@mail.gmail.com>
On 1/9/2013 2:54 PM, Andre Caldas wrote:
> Hello!
>
> Given some
>
> \startbuffer
> Blah, blah, blah...
> \stopbuffer
>
> I'd like to get a "node tree" corresponding to how the buffer would be
> processed at a given point. Using luatex, I'd like to identify certain
> sub-nodes and change their attributes (to be specific: transparency).
>
> Any hint on how to do it?
here's an example (I'll add it to the cld manual):
\starttext
\definecolor[mytransparency][a=1,t=.5]
\startluacode
local enabled = false
local count = 0
function userdata.processmystuff(head)
if enabled then
count = count + 1
for n in node.traverse(head) do
logs.report("node","run %s: %s",count,n)
if count % 2 == 0 then
nodes.tracers.transparencies.set(n,"mytransparency")
end
end
return head, true
end
return head, false
end
function userdata.enablemystuff()
enabled = true
end
function userdata.disablemystuff()
enabled = false
end
nodes.tasks.appendaction("processors", "normalizers",
"userdata.processmystuff")
\stopluacode
\startbuffer
whatever \hbox{you} want
\stopbuffer
\ctxlua{userdata.enablemystuff()}
\par \getbuffer \par
\ctxlua{userdata.disablemystuff()}
\stoptext
> Also, are there any good examples on how to use "nodes"?
all over context ...
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| 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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2013-01-09 15:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-09 13:54 Andre Caldas
2013-01-09 15:30 ` Hans Hagen [this message]
2013-01-09 15:59 ` Andre Caldas
2013-01-09 20:57 ` Andre Caldas
2013-01-10 0:19 ` Hans Hagen
2013-01-10 12:18 ` Andre Caldas
2013-01-10 13:00 ` Hans Hagen
2013-01-12 14:49 ` Andre Caldas
2013-01-13 17:51 ` Hans Hagen
2013-01-29 20:57 ` Andre Caldas
2013-01-31 10:42 ` Sietse Brouwer
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=50ED8D0B.8030708@wxs.nl \
--to=pragma@wxs.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).