Skip to content
/ lhtmlr Public

A fast Lua HTML Parsing/Searching library written in Rust for Lotus Project

License

Notifications You must be signed in to change notification settings

CyAxe/lhtmlr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LHTMLR

A fast Lua HTML Parsing/Searching library written in Rust for Lotus Project

TODO

  • HTML Parsing
  • Generate CSS Selector
    • Element
    • Text
    • Comment
    • Document

Example

local lhtmlr = require("lhtmlr")

local HTML = [[
<!DOCTYPE html>
<html>
  <head>
    <title>My HTML Page</title>
  </head>
  <body>
    <img src="profile.png">
    <h1>Welcome to my HTML page</h1>
  </body>
</html>
]]

-- Generate a CSS selector pattern for **custom** Element in the HTML input that has attributes.
local pattern = lhtmlr.css_selector("<img src=\"profile.png\">") -- Type: String
local results = lhtmlr.html_search(HTML, pattern) -- Type: Table

for _,value in pairs(results) do
    print(value)
end

-- <img src="profile.png">

Installation

$ luarocks install lua-lhtmlr --local

About

A fast Lua HTML Parsing/Searching library written in Rust for Lotus Project

Resources

License

Stars

Watchers

Forks

Packages

No packages published