module html
import os
import strings
struct LexicalAttributes {
mut:
current_tag &Tag = unsafe { nil }
open_tag bool
open_code bool
open_string int
open_comment bool
is_attribute bool
opened_code_type string
line_count int
outside_tag bool
lexeme_builder strings.Builder = strings.new_builder(100)
code_tags map[string]bool = {
'script': true
'style': true
}
}
// Parser is responsible for reading the HTML strings and converting them into a `DocumentObjectModel`.
pub struct Parser {
mut:
dom DocumentObjectModel
lexical_attributes LexicalAttributes = LexicalAttributes{
current_tag: &Tag{}
}
filename string = 'direct-parse'
initialized bool
tags []&Tag
debug_file os.File
}
// This function is used to add a tag for the parser ignore it's content.
// For example, if you have an html or XML with a custom tag, like `