aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/spans.rs5
-rw-r--r--examples/tokenize.rs4
2 files changed, 5 insertions, 4 deletions
diff --git a/examples/spans.rs b/examples/spans.rs
index fc3c6a1..c1fe23b 100644
--- a/examples/spans.rs
+++ b/examples/spans.rs
@@ -4,11 +4,12 @@ use codespan_reporting::{
term,
term::termcolor::{ColorChoice, StandardStream},
};
-use html5tokenizer::{offset::PosTrackingReader, NaiveParser, Token};
+use html5tokenizer::{offset::PosTrackingReader, NaiveParser, Token, TracingEmitter};
fn main() {
let html = r#"<img src=example.jpg alt="some description">"#;
- let parser = NaiveParser::new(PosTrackingReader::new(html));
+ let parser =
+ NaiveParser::new_with_emitter(PosTrackingReader::new(html), TracingEmitter::default());
let Token::StartTag(tag) = parser.flatten().next().unwrap() else {
panic!()
diff --git a/examples/tokenize.rs b/examples/tokenize.rs
index 791db0f..a7c2214 100644
--- a/examples/tokenize.rs
+++ b/examples/tokenize.rs
@@ -1,13 +1,13 @@
//! Let's you easily try out the tokenizer with e.g.
//! printf '<h1>Hello world!</h1>' | cargo run --example=tokenize
-use html5tokenizer::{Tokenizer, TracingEmitter};
+use html5tokenizer::{BasicEmitter, Tokenizer};
use std::io::BufReader;
fn main() {
let mut tokenizer = Tokenizer::new(
BufReader::new(std::io::stdin().lock()),
- TracingEmitter::default(),
+ BasicEmitter::default(),
);
while let Some(token) = tokenizer.next() {
for (error, _) in tokenizer.emitter_mut().drain_errors() {