Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update html5ever to 0.25 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ categories = []
edition = "2018"

[dependencies]
regex = "1"
url = "2.1"
html5ever = "0.24"
lazy_static = "1.4"
regex = "1"
url = "2.1"
html5ever = "0.25"
markup5ever_rcdom = "0.1"
lazy_static = "1.4"

[dependencies.reqwest]
version = "0.10"
Expand Down
4 changes: 2 additions & 2 deletions src/dom.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::rc::Rc;
use html5ever::tendril::StrTendril;
use html5ever::rcdom::NodeData::{Element, Text};
use html5ever::rcdom::{Handle, Node};
use markup5ever_rcdom::NodeData::{Element, Text};
use markup5ever_rcdom::{Handle, Node};
use html5ever::Attribute;
use std::str::FromStr;

Expand Down
6 changes: 3 additions & 3 deletions src/extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::io::Read;
use std::collections::BTreeMap;
use std::path::Path;
use std::cell::Cell;
use html5ever::rcdom::{RcDom};
use markup5ever_rcdom::{RcDom, SerializableHandle};
use html5ever::{parse_document, serialize};
use html5ever::tendril::stream::TendrilSink;
use std::default::Default;
Expand Down Expand Up @@ -72,10 +72,10 @@ pub fn extract<R>(input: &mut R, url: &Url) -> Result<Product, Error> where R: R
}
let mut bytes = vec![];

let node = top_candidate.node.clone();
let node = &top_candidate.node;
scorer::clean(&mut dom, Path::new(id), node.clone(), url, &candidates);

serialize(&mut bytes, &node, Default::default()).ok();
serialize(&mut bytes, &SerializableHandle::from(node.clone()), Default::default()).ok();
let content = String::from_utf8(bytes).unwrap_or_default();

let mut text: String = String::new();
Expand Down
10 changes: 5 additions & 5 deletions src/scorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ use url::Url;
use regex::Regex;
use lazy_static::lazy_static;
use html5ever::tree_builder::TreeSink;
use html5ever::rcdom::Node;
use html5ever::rcdom::NodeData::{Element, Text};
use html5ever::rcdom::Handle;
use html5ever::rcdom::NodeData::{
use markup5ever_rcdom::Node;
use markup5ever_rcdom::NodeData::{Element, Text};
use markup5ever_rcdom::Handle;
use markup5ever_rcdom::NodeData::{
Document,
Doctype,
Comment,
ProcessingInstruction
};
use html5ever:: rcdom::RcDom;
use markup5ever_rcdom::RcDom;
use html5ever::{QualName, LocalName};
use html5ever::tree_builder::{NodeOrText, ElementFlags};
use html5ever::{ns, namespace_url};
Expand Down