#! lua
local div, table, tr, td in TAG
local navbox = \ (left, up, right)
 => table "" (tr "" {
     td (align) (left);
     td (align) (up);
     td (align) (right);
       })
end -- function
local trg = "%s.html"
=> {
paradiv = div [[class="parastyle"]];
titleheader = div [[class="title"]];
header = div [[class="header"]];
frame = div [[class="content"]];
nav = \ (n, ch)
  local N, y = #ch, [[contents]]
  local x = (n>1) and ch[n-1] or y
  local z = (n<N) and ch[n+1] or y
  local left = link (trg:format(x)) (n>1 and [[back]] or y)
  local up = link (trg:format(y)) (n>1 and n<N and y or "")
  local right = link (trg:format(z)) (n<N and [[next]] or y)
  => div [[class="nav"]] (navbox (left, up, right))
  end;
}