Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
-- treehead.lua:
-- This file:
--   http://angg.twu.net/dednat5/treehead.lua.html
--   http://angg.twu.net/dednat5/treehead.lua
--                    (find-dn5 "treehead.lua")
-- Author: Eduardo Ochs <[email protected]>
-- Version: 2013feb01 / 2015may09
-- License: GPL3
--

-- «.tree-head»	(to "tree-head")

-- require "segments"   -- (find-dn5 "segments.lua")
require "treesegs"      -- (find-dn5 "treesegs.lua")
require "treetex"       -- (find-dn5 "treetex.lua")
require "process"       -- (find-dn5 "process.lua")

output = output or print

-- (find-dn5 "segments.lua")
-- This should be enough for the moment.
segtotreenode = function (seg)
    local bar = seg:firstsegabove()
    if bar then
      local bart = bar.t
      local barchars = bart:match("-+") or
                       bart:match("=+") or
                       bart:match(":+")
      if not barchars then Error("Bad bar: "..bart) end
      local barchar = bart:sub(1, 1)
      local label = bart:sub(1 + #barchars)
      local hyps = bar:segsabove()
      local T = map(segtotreenode, hyps)
      T[0] = seg.t
      T.bar = barchar
      T.label = label
      return TreeNode(T)
    end
    return TreeNode {[0]=seg.t}
  end
-- Add new methods to an existing class
Segment.__index.totreenode = segtotreenode

-- «tree-head» (to ".tree-head")
-- (find-dn5 "trees.lua")
-- (find-dn5 "segments.lua")
registerhead "%:" {
  action = function ()
      allsegments[nline] = tosegments(linestr, nline)
      for _,seg in ipairs(allsegments[nline]) do
        local name = seg.t:match("^%^(.*)")
        if name then
          output(seg:rootnode():totreenode():TeX_deftree(name))
        end
      end
    end,
}





-- dump-to: tests
--[==[
--]==]

-- Local Variables:
-- coding:             raw-text-unix
-- ee-anchor-format:   "«%s»"
-- End: