node_html_parser/parser/
types.rs1use crate::dom::void_tag::VoidTagOptions;
4use std::collections::HashMap;
5
6#[derive(Debug, Clone)]
8pub struct ZeroCopyTagMatch<'a> {
9 pub start: usize,
10 pub end: usize,
11 pub is_comment: bool,
12 pub is_closing: bool,
13 pub tag_name: &'a str,
14 pub attrs: &'a str,
15 pub self_closing: bool,
16}
17
18#[derive(Debug, Clone)]
19pub struct Options {
20 pub lower_case_tag_name: bool,
21 pub comment: bool,
22 pub fix_nested_a_tags: bool,
24 pub parse_none_closed_tags: bool,
26 pub preserve_tag_nesting: bool,
29 pub block_text_elements: HashMap<String, bool>, pub suppress_script_style_text: bool,
33 pub void_tag: VoidTagOptions,
34}
35
36impl Default for Options {
37 fn default() -> Self {
38 let mut block = HashMap::new();
39 block.insert("script".into(), true);
41 block.insert("style".into(), true);
42 block.insert("noscript".into(), true);
43 block.insert("pre".into(), true);
44 Self {
45 lower_case_tag_name: false,
46 comment: false,
47 fix_nested_a_tags: false,
48 parse_none_closed_tags: false,
49 preserve_tag_nesting: false,
50 block_text_elements: block,
51 suppress_script_style_text: false,
52 void_tag: Default::default(),
53 }
54 }
55}
56
57#[derive(Clone)]
58pub(crate) struct StackEntry {
59 pub elem: Box<crate::dom::element::HTMLElement>,
60}