Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#!/usr/bin/env lua5.1
-- This file:
-- http://angg.twu.net/dednat5/dednat6.lua
-- http://angg.twu.net/dednat5/dednat6.lua.html
--  (find-angg        "dednat5/dednat6.lua")
-- By Eduardo Ochs <eduardoochs@gmail.com>
-- Version: 2015jun15

-- «.package.path»		(to "package.path")
-- «.luatex-require»		(to "luatex-require")
-- «.requires»			(to "requires")
-- «.utf8»			(to "utf8")
-- «.dooptions»			(to "dooptions")
-- «.run-tests-in-test-dir»	(to "run-tests-in-test-dir")



-- «package.path» (to ".package.path")
-- Add this path to package.path
-- (find-dn4 "dednat4.lua" "dednat4dir")
fnamedirectory    = function (fname) return fname:match"^(.*/)[^/]*$"  end
fnamenondirectory = function (fname) return fname:match     "([^/]*)$" end
dednat6dir        = dednat6dir or (arg and fnamedirectory(arg[0])) or ""
if dednat6dir ~= "" then package.path = dednat6dir.."?.lua;"..package.path end


-- «luatex-require» (to ".luatex-require")
-- If we're in Lua(La)TeX then make sure that require behaves luaish-ly enough
if tex then
  local require = function (stem)
      local fname = dednat6dir..stem..".lua"
      package.loaded[stem] = package.loaded[stem] or dofile(fname) or fname
    end
  --
  require "lualoader"  -- (find-dn5 "lualoader.lua")
  require "binloader"  -- (find-dn5 "binloader.lua")
end


-- «requires» (to ".requires")
-- (find-dn5file "build.lua" "stems = {")
if true then require "edrxlib" end

-- The four lowest-level modules (all independent):
require "common"       -- (find-dn5 "common.lua")
require "eoo"          -- (find-dn5 "eoo.lua")
require "prefixes"     -- (find-dn5 "prefixes.lua")
require "parse"        -- (find-dn5 "parse.lua")

-- General functions to read and process ".tex" files
-- and write out a ".dnt" file:
require "preamble6"    -- (find-dn5 "preamble6.lua")
require "process"      -- (find-dn5 "process.lua")

-- Code for generating derivation trees from "%:" lines:
require "treetex"      -- (find-dn5 "treetex.lua")
require "treesegs"     -- (find-dn5 "treesegs.lua")
require "treehead"     -- (find-dn5 "treehead.lua")

-- Code for generating diagxy diagrams from "%D" lines:
require "diagstacks"   -- (find-dn5 "diagstacks.lua")
require "diagtex"      -- (find-dn5 "diagtex.lua")
require "diagforth"    -- (find-dn5 "diagforth.lua")
require   "errors"     -- (find-dn5 "errors.lua")
require "diagmiddle"   -- (find-dn5 "diagmiddle.lua")

-- New things (may 2015):
require "wrap"         -- (find-dn5 "wrap.lua")
require "picture"      -- (find-dn5 "picture.lua")
require "zrect"        -- (find-dn5 "zrect.lua")
require "zha"          -- (find-dn5 "zha.lua")
require   "heads6"     -- (find-dn5 "heads6.lua")
require "texfile"      -- (find-dn5 "texfile.lua")
-- require "rect"      -- (find-dn5 "rect.lua")
require "stacks"       -- (find-dn5 "stacks.lua")
-- New (jul 2015). Note that this overrides the ZHA class!
require "newrect"      -- (find-dn5 "newrect.lua")

-- The Begriffsschrift extension (experimental):
-- require "begriff"   -- (find-dn5 "begriff.lua")
-- The REPL, for interaction (experimental):
-- require "repl"      -- (find-dn5 "repl.lua")

-- Interpret command-line options and run everything:
require "options6"     -- (find-dn5 "options6.lua")

-- «utf8» (to ".utf8")
-- (find-es "lua5" "utf8")
-- (find-angg "LUA/lua50init.lua" "strlen8")
-- (find-dn5 "parse.lua" "getword =")
-- Usage: getword = getword_utf8
getword_utf8 = function ()
    local spaces, word_, newpos = subj:match("( *)([^ ]+)()", pos)
    if spaces then
      startcol = endcol + #spaces
      endcol   = endcol + #spaces + word_:len8()   -- UTF-8
      word     = word_
      pos      = newpos
      return word
    end
  end

-- «dooptions» (to ".dooptions")
PP("options:", {...})
-- PP("package.path:", package.path:sub(1, 50).." ...")
dooptions(...)




--[[
** «run-tests-in-test-dir» (to ".run-tests-in-test-dir")
** Copy the essential files from dednat6 to a test dir (/tmp/d6/)
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/dednat5/
cat dednat6.lua | grep ^require | tr -d '"()'
cat dednat6.lua | grep ^require | tr -d '"()' | awk '{print $5}'
cat dednat6.lua | grep ^require | tr -d '"()' | awk '{print $5}' | tee /tmp/o
cat dednat6.lua | grep "^ *require" | tr -d '"()' | awk '{print $5}' | tee /tmp/o
rm -Rv /tmp/d6/
mkdir  /tmp/d6/
mkdir  /tmp/d6/tests/
cp -v $(cat /tmp/o) dednat6.lua /tmp/d6/
cp -v tests/*.tex tests/*.lua   /tmp/d6/tests/

** Run dednat6 in the test dir
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd    /tmp/d6/tests/
../dednat6.lua
../dednat6.lua -t test1.tex
../dednat6.lua -t test2.tex
../dednat6.lua -t test3.tex
../dednat6.lua -t testbegr.tex
# (find-dn5 "tests/Makefile" "test1")
# (find-dn5 "tests/Makefile" "test2")
# (find-dn5 "tests/Makefile" "test3")
# (find-fline "/tmp/d6/tests/")
# mkdir /tmp/d6/tests/tests2/

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/dednat5/
cat dednat6.lua | grep "^ *require" | tr -d '"()' | awk '{print $5}' | tee /tmp/o
rm -Rv   /tmp/d6/
mkdir -p /tmp/d6/dednat6/
cp -v $(cat /tmp/o) dednat6.lua /tmp/d6/dednat6/
cp -v ~/LUA/lua50init.lua       /tmp/d6/dednat6/edrxlib.lua

cd ~/LATEX/
cp -v \
  istanbul-july.tex istanbulall.lua istanbuldefs.tex \
  2015logicandcats.lua \
  edrx15.sty edrx15chars.tex edrx15defs.tex edrxdnt.tex \
  proof.sty diagxy.tex \
   /tmp/d6/
cd /tmp/d6/
(TZ=GMT date; date) | tee VERSION
rm -v     /tmp/dednat6-test*
tar -cvzf /tmp/dednat6-test.tgz *
zip -r    /tmp/dednat6-test.zip *

lualatex istanbul-july.tex
export LUA_INIT=
lualatex istanbul-july.tex

cd /tmp/
Scp-np -v dednat6-test.tgz dednat6-test.zip edrx@angg.twu.net:/home/edrx/slow_html/dednat5/
Scp-np -v dednat6-test.tgz dednat6-test.zip edrx@angg.twu.net:/home/edrx/public_html/dednat5/

# (find-fline "/tmp/" "dednat6-test")
# (find-fline "/tmp/dednat6-test.tgz")
# (find-fline "/tmp/dednat6-test.zip")

--]]


--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "dednat6.lua"

-- (find-dn5 "options.lua")
-- (find-dn5 "dednat5.lua")
-- (find-dn5grep "grep -nH -e '_O = _O or {}' *")

--]]


-- Local Variables:
-- coding: raw-text-unix
-- End: