mirror of
https://gitlab.com/news-flash/article_scraper.git
synced 2025-07-07 16:15:32 +02:00
fmt & clippy
This commit is contained in:
parent
280c516cbe
commit
f7fa696921
2 changed files with 4 additions and 8 deletions
|
@ -73,8 +73,6 @@ pub const UNLIKELY_ROLES: &[&str] = &[
|
||||||
|
|
||||||
pub const DEFAULT_TAGS_TO_SCORE: &[&str] =
|
pub const DEFAULT_TAGS_TO_SCORE: &[&str] =
|
||||||
&["SECTION", "H2", "H3", "H4", "H5", "H6", "P", "TD", "PRE"];
|
&["SECTION", "H2", "H3", "H4", "H5", "H6", "P", "TD", "PRE"];
|
||||||
pub const DEPRECATED_SIZE_ATTRIBUTE_ELEMS: Lazy<HashSet<&str>> =
|
|
||||||
Lazy::new(|| HashSet::from(["TABLE", "TH", "TD", "HR", "PRE"]));
|
|
||||||
pub const PRESENTATIONAL_ATTRIBUTES: &[&str] = &[
|
pub const PRESENTATIONAL_ATTRIBUTES: &[&str] = &[
|
||||||
"align",
|
"align",
|
||||||
"background",
|
"background",
|
||||||
|
@ -89,6 +87,8 @@ pub const PRESENTATIONAL_ATTRIBUTES: &[&str] = &[
|
||||||
"valign",
|
"valign",
|
||||||
"vspace",
|
"vspace",
|
||||||
];
|
];
|
||||||
|
pub static DEPRECATED_SIZE_ATTRIBUTE_ELEMS: Lazy<HashSet<&str>> =
|
||||||
|
Lazy::new(|| HashSet::from(["TABLE", "TH", "TD", "HR", "PRE"]));
|
||||||
pub static DIV_TO_P_ELEMS: Lazy<HashSet<&str>> = Lazy::new(|| {
|
pub static DIV_TO_P_ELEMS: Lazy<HashSet<&str>> = Lazy::new(|| {
|
||||||
HashSet::from([
|
HashSet::from([
|
||||||
"BLOCKQUOTE",
|
"BLOCKQUOTE",
|
||||||
|
|
|
@ -855,9 +855,7 @@ impl FullTextParser {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn post_process_document(
|
pub(crate) fn post_process_document(document: &Document) -> Result<(), FullTextParserError> {
|
||||||
document: &Document
|
|
||||||
) -> Result<(), FullTextParserError> {
|
|
||||||
if let Some(mut root) = document.get_root_element() {
|
if let Some(mut root) = document.get_root_element() {
|
||||||
Self::simplify_nested_elements(&mut root)?;
|
Self::simplify_nested_elements(&mut root)?;
|
||||||
|
|
||||||
|
@ -869,9 +867,7 @@ impl FullTextParser {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn post_process_page(
|
pub(crate) fn post_process_page(node: &mut Node) -> Result<(), FullTextParserError> {
|
||||||
node: &mut Node,
|
|
||||||
) -> Result<(), FullTextParserError> {
|
|
||||||
Util::clean_conditionally(node, "fieldset");
|
Util::clean_conditionally(node, "fieldset");
|
||||||
Util::clean_conditionally(node, "table");
|
Util::clean_conditionally(node, "table");
|
||||||
Util::clean_conditionally(node, "ul");
|
Util::clean_conditionally(node, "ul");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue