Skip to content

Commit 0e07e47

Browse files
authored
Create README.md
1 parent a374c9a commit 0e07e47

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# LHTMLR
2+
A fast Lua HTML Parsing/Searching library written in Rust for Lotus Project
3+
4+
5+
6+
7+
### TODO
8+
- [x] HTML Parsing
9+
- [x] Generate CSS Selector
10+
- [x] Element
11+
- [ ] Text
12+
- [ ] Comment
13+
- [ ] Document
14+
15+
### Example
16+
```lua
17+
local lhtmlr = require("lhtmlr")
18+
19+
local HTML = [[
20+
<!DOCTYPE html>
21+
<html>
22+
<head>
23+
<title>My HTML Page</title>
24+
</head>
25+
<body>
26+
<img src="profile.png">
27+
<h1>Welcome to my HTML page</h1>
28+
</body>
29+
</html>
30+
]]
31+
32+
-- Generate a CSS selector pattern for **custom** Element in the HTML input that has attributes.
33+
local pattern = lhtmlr.css_selector("<img src=\"profile.png\">") -- Type: String
34+
local results = lhtmlr.html_search(HTML, pattern) -- Type: Table
35+
36+
for _,value in pairs(results) do
37+
print(value)
38+
end
39+
40+
-- <img src="profile.png">
41+
42+
```
43+
44+
### Installation
45+
46+
```bash
47+
$ luarocks install lua-lhtmlr --local
48+
```

0 commit comments

Comments
 (0)