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 -----------------------------------------------------------------