diff --git a/Cargo.toml b/Cargo.toml index b162fdd..ba53d18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,8 +22,9 @@ libtest-mimic = "0.8.1" # https://github.com/bheisler/iai/issues/34 # need to have cache simulation running because of bencher.dev iai = { git = "https://github.com/sigaloid/iai", rev = "d56a597" } +markup5ever_rcdom = "0.5.0-unofficial" # required for examples/scraper.rs -scraper = "0.20.0" +scraper = "0.21.0" argh = "0.1.12" [features] @@ -34,13 +35,10 @@ default = ["jetscii"] # The tree-builder feature contains utilities to use html5ever's DOM and tree # builder with html5gum's tokenizer. -tree-builder = ["html5ever", "markup5ever_rcdom"] +tree-builder = ["html5ever"] [dependencies] -# intentionally held back from 0.29 until scraper updates -html5ever = { version = "0.27.0", optional = true } -markup5ever_rcdom = { version = "0.3.0", optional = true } - +html5ever = { version = "0.29.0", optional = true } jetscii = { version = "0.5.1", optional = true } [[bench]] diff --git a/examples/build_tree.rs b/examples/build_tree.rs index 8314804..411c2db 100644 --- a/examples/build_tree.rs +++ b/examples/build_tree.rs @@ -62,10 +62,10 @@ fn main() { let errors = rcdom.errors; - if !errors.is_empty() { + if !errors.borrow().is_empty() { println!("\nParse errors:"); - for err in errors.iter() { + for err in errors.borrow().iter() { println!(" {}", err); } } diff --git a/examples/scraper.rs b/examples/scraper.rs index 4a60e26..25373b9 100644 --- a/examples/scraper.rs +++ b/examples/scraper.rs @@ -14,8 +14,9 @@ use std::io::{stdin, Read}; use argh::FromArgs; +use html5ever::interface::tree_builder::TreeSink; use html5gum::emitters::html5ever::parse_document; -use scraper::{Html, Selector}; +use scraper::{Html, HtmlTreeSink, Selector}; /// Read some HTML from stdin and parse it according to the given selector. #[derive(FromArgs)] @@ -41,8 +42,9 @@ fn main() { Html::parse_document(&input) } else { let dom = Html::new_document(); - let Ok(dom) = parse_document(&input, dom, Default::default()); - dom + let tree_sink = HtmlTreeSink::new(dom); + let Ok(tree_sink) = parse_document(&input, tree_sink, Default::default()); + tree_sink.finish() }; let selector = Selector::parse(&cli.selector).unwrap(); diff --git a/src/emitters/html5ever.rs b/src/emitters/html5ever.rs index f97aa89..cddb5ed 100644 --- a/src/emitters/html5ever.rs +++ b/src/emitters/html5ever.rs @@ -300,24 +300,26 @@ fn map_tokenizer_state(input: Html5everState) -> State { /// equivalent to the same functions in [html5ever::driver]. /// /// ``` -/// use html5ever::{local_name, QualName, ns, namespace_url}; // extern crate html5ever; -/// use scraper::Html; // extern crate scraper; +/// use html5ever::{local_name, interface::TreeSink, QualName, ns, namespace_url}; // extern crate html5ever; +/// use scraper::{HtmlTreeSink, Html}; // extern crate scraper; /// /// let input = "