Lua FFI binding for gumbo-parser, an HTML5 parser written in C. It produces output in LOM format. An alternative is lua-gumbo.
local gumbo = require 'gumbo'
local dom = gumbo.parse '<span id="foo">bar</span>'
..is equivalent to..
local dom =
{ tag = 'html',
attr = {},
{ tag = 'body',
attr = {},
{ tag = 'span',
attr = {
id = 'foo',
[1] = 'id'
},
'bar'
}
}
}
Gumbo will be downloaded and compiled by the Makefile.
luarocks install https://raw.github.com/pguillory/luajit-gumbo/master/rockspec/luajit-gumbo-0.1-2.rockspec
You can also clone this repo and run make install
manually.