1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

net.html: polish module, update docs (#7193)

This commit is contained in:
Ned Palacios
2020-12-10 03:08:15 +08:00
committed by GitHub
parent 5fa1e403ec
commit b952bf2e6b
9 changed files with 302 additions and 446 deletions

18
vlib/net/html/html.v Normal file
View File

@ -0,0 +1,18 @@
module html
import os
// parse parses and returns the DOM from the given text.
pub fn parse(text string) DocumentObjectModel {
mut parser := Parser{}
parser.parse_html(text)
return parser.get_dom()
}
// parse_file parses and returns the DOM from the contents of a file.
pub fn parse_file(filename string) DocumentObjectModel {
content := os.read_file(filename) or { return DocumentObjectModel{
root: &Tag{}
} }
return parse(content)
}