use crate::helpers::re;
use regex::Captures;
fn is_rule(line: &String, value: &str) -> bool {
line.starts_with(value) && line.matches(value).count() >= 3 && line.replace(value, "").is_empty()
}
pub fn default(html: &mut String) {
re::parse(html, re::from(re::HORIZONTAL_RULE), | capture: Captures | {
let line: &String = &capture[0].trim().replace(" ", "");
if line.len() >= 3 && (is_rule(line, "*") || is_rule(line, "-") || is_rule(line, "_")) {
String::from("\n\n<hr />\n\n")
} else {
String::from(&capture[0])
}
});
}