/htmllua

Lua with HTML parser and renderer baked-in.

Primary LanguageLuaMIT LicenseMIT

HTML Lua

This project builds a version of Lua with tools that parse HTML5 and render it from Markdown. The modules that implement this functionality are preloaded into Lua. This embedding eliminates the need to maintain external modules and search paths.

Dependencies

This project depends on installed versions of the following software.

Additionally, the following software is included in this repository.

Building HTML Lua uses the following tool.

Building

The following symbolic links need to be made.

src
   links
      lua -> /path/to/lua-repo
      gumbo -> /path/to/lua-gumbo-repo
      discount -> /path/to/discount-repo

The projects that the links point to should be already successfully built but do not need to be installed.

The strliteral utility should be somehwere on the PATH.

GNU make should be used (gmake on some systems) to handle stem rules in the Makefile.

cd htmllua/src
make

The resulting binary can be used as an augmented version of standalone Lua.

Sample usage

The following example can be used to generate a website from Google Drive.

local err, prm
prm = util.args(arg)

if prm.template and prm.site and prm.url and prm.cache then
  err = drive.websitegenerate(prm.template, prm.site, prm.url, prm.cache)
else
  err = 'expecting --template, --site, --url, and --cache arguments'
end

if err then
  io.stderr:write(err)
end