use lazy_static::lazy_static;
use regex::{Regex, bytes::Regex as BytesRegex};
lazy_static! {
pub static ref ATTR_DECL: Regex = Regex::new(r"^:([^\s:]+):\s*([^\s].*)?$").unwrap();
pub static ref ATTR_VAL_REPLACE: Regex = Regex::new(r"\{([^\s}]+)\}").unwrap();
}
lazy_static! {
pub static ref EMAIL_RE: Regex = Regex::new(
r"^([a-z0-9_+]([a-z0-9_+.]*[a-z0-9_+])?)@([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6})"
)
.unwrap();
}
lazy_static! {
pub static ref PASS_DBL_MACRO_ATTR: Regex =
Regex::new(r#"^pass:([a-z]+(?:,[a-z-]+)*)?\[footnote:(.*)\]\]$"#).unwrap();
}
lazy_static! {
pub static ref DIRECTIVE_INCLUDE: Regex =
Regex::new(r#"^include::([^\[]+[^\[\s])\[.*\]$"#).unwrap();
pub static ref DIRECTIVE_IFDEF: Regex =
Regex::new(r#"^ifn?def::([^\[]+[^\[\s])\[(.*)\]$"#).unwrap();
pub static ref DIRECTIVE_ENDIF: Regex = Regex::new(r#"^endif::(\S*)\[\]$"#).unwrap();
}
lazy_static! {
pub static ref DIRECTIVE_IFEVAL: Regex =
Regex::new(r#"^ifeval::(.*?)\[(.+?) *([=!><]=|[><]) *(.+)\]$"#).unwrap();
pub static ref DIRECTIVE_INVALID_IFEVAL: Regex = Regex::new(r#"^ifeval::(\[(.*)\])$"#).unwrap();
}
lazy_static! {
pub static ref REPEAT_STAR_LI_START: Regex = Regex::new(r#"^\s?(\*+)( |\t)+.+"#).unwrap();
}
lazy_static! {
pub static ref KBD_MACRO_KEYS: Regex = Regex::new(r"(?:\s*([^\s,+]+|[,+])\s*)").unwrap();
}
lazy_static! {
pub static ref SVG_TARGET: Regex = Regex::new(r"(?i)\.svg(\[|\?|$)").unwrap();
}
lazy_static! {
pub static ref SVG_PREAMBLE: BytesRegex = BytesRegex::new(r"(?s)^(.*)<svg").unwrap();
pub static ref SVG_START_TAG: BytesRegex = BytesRegex::new(r"<svg").unwrap();
pub static ref SVG_STRIP_ATTRS: BytesRegex =
BytesRegex::new(r#"(?s)\s(?:width|height|style)=("([^"]*)"|'([^']*)')"#).unwrap();
}