use lazy_static::lazy_static;
use onig::*;
lazy_static! {
pub static ref HTML_STYLE_ELEMENT: Regex = Regex::new(
r##"(?x)
(?<tag_open>
<style[^>]*>
)
(?<styles>
(?:.|\n|\r)*?
)
(?<tag_close>
<\/style>
)
"##
).unwrap();
pub static ref HTML_SCRIPT_ELEMENT: Regex = Regex::new(
r##"(?x)
(?<tag_open>
<script[^>]*>
)
(?<script>
(?:.|\n|\r)*?
)
(?<tag_close>
<\/script>
)
"##
).unwrap();
pub static ref HTML_ATTRIBUTES: Regex = Regex::new(
r##"(?x)
<!--.*?-->
| <head[>\s](?:.|\s)*?<\/head>
| <style[>\s](?:.|\s)*?<\/style>
| <code[>\s](?:.|\s)*?<\/code>
| <script[>\s](?:.|\s)*?<\/script>
| (?<attribute>
[^\s\x00\/>"'=]+
)
(?<join>
\s*=\s*
)
(?<quote>
(?:\\?["'])?
)
(?<value>
(?:
(?<=")
(?:[^"\\] | \\[^"'])+
)
| (?:
(?<=')
(?:[^'\\] | \\[^"'])+
)
| [^\s\\<>"'=]+
)
"##
).unwrap();
pub static ref ESCAPED_HTML_CHARS: Regex = Regex::new(
r##"(?x)
(?<hexdecimal_char_ref>
&\#x[0-9A-Fa-f]{1,4};
)
| (?<decimal_char_ref>
&\#[0-9]{1,6};
)
| (?<named_char_ref>
&[A-Za-z]*+;?
)
"##
).unwrap();
}