On 7/10/2019 12:02 PM, mf wrote:
Hello list,
i'd like having an object representation of a typeset paragraph or even
a page, preferably as a JSON object, but a Lua table is equally good.
My reference is section "4.4 Node lists" of the CLD manual.
Before writing an iterator over the list of nodes of a paragraph,
figuring out all the possible nodes and their fields, i'm wondering if
there's some hidden tool in the ConTeXt coffer to simplify the task.
\starttext
\setbox0\vbox{\input tufte }
\ctxlua{inspect(nodes.totable(tex.box[0]))}
\stoptext
\starttext
\setbox0\vbox{\input tufte }
\ctxlua{
require("util-jsn")
inspect(utilities.json.tojson(nodes.totable(tex.box[0])))
}
\stoptext
(or use the export)
-
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
___