Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
-- diagbox.lua:
-- This file:
--   http://angg.twu.net/dednat5/diagbox.lua.html
--   http://angg.twu.net/dednat5/diagbox.lua
--                    (find-dn5 "diagbox.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
-- Version: 2013feb01
-- License: GPL3

-- (find-dn4 "experimental.lua" "BOX")
-- (find-dn5 "diagforth.lua" "enddiagram")


mybox_names = {
  "\\myboxa",
  "\\myboxb",
  "\\myboxc",
  "\\myboxd",
  "\\myboxe",
  "\\myboxf",
  "\\myboxg",
  "\\myboxh"
}
mybox_prep1 = function (boxname, body)
    -- PP("1", boxname, body)
    return format("  \\savebox{%s}{$%s$}\n", boxname, body)
  end
mybox_preps = function ()
    prep = ""
    for i,body in ipairs(mybox_bodies) do
      prep = prep .. mybox_prep1(mybox_names[i], body)
    end
    return prep
  end
mybox_prep = function (diagname, hyperlink)
    return format("\\defdiagprep{%s}{%s\n%s}\n", diagname, (hyperlink or ""),
		  mybox_preps())
  end
mybox_bodies = {}
forths["BOX"] = function ()
    tinsert(mybox_bodies, node_to_TeX(ds[1]))
    ds[1].tex = format("\\usebox{%s}", mybox_names[#mybox_bodies])
  end
-- forths["OUTBOXES"] = function ()
--     dntprint(mybox_prep(diagramname))
--     mybox_bodies = {}
--   end

-- (find-dn4 "dednat4.lua" "tree-lib")
-- (find-dn4 "dednat4.lua" "tree-lib" "optionalhyperlink =")
optionalhyperlink  = optionalhyperlink  or function () return "" end
remembertoundefine = remembertoundefine or function () end
-- (find-dn5 "dednat5.lua" "arrows_to_defdiag")
-- (find-dn4 "dednat4.lua" "enddiagram")

-- (find-dn5 "dednat5.lua" "enddiagram")
-- forths["enddiagram"] = function ()
--     output(arrows_to_defdiag(diagramname, " % no hyperlink yet"))
--   end

-- arrows_to_defdiag = function (name, hyperlink)
--     return format("\\defdiag{%s}{%s\n%s}",
--                   name, (hyperlink or ""),
--                   arrows_to_TeX("  "))
--   end

enddiagram = function ()
    local diagramdef
    if #mybox_bodies > 0 then
      diagramdef = format("\\defprepareddiag{%s}{%s\n%s  }{\n%s}",
          diagramname, optionalhyperlink("    % ", diagramstartlinen, ""),
          mybox_preps(),
          arrows_to_TeX())
      mybox_bodies = {}
    else
      diagramdef = format("\\defdiag{%s}{%s\n%s}",
          diagramname, optionalhyperlink("    % ", diagramstartlinen, ""),
          arrows_to_TeX())
    end
    output(diagramdef)
    remembertoundefine("diag", diagramname)
  end
forths["enddiagram"] = enddiagram
forths["OUTBOXES"] = function () end


-- dump-to: tests
--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
require "diagbox"

--]==]



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