diff options
author | Martin Fischer <martin@push-f.com> | 2023-08-28 19:49:51 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-09-03 23:00:05 +0200 |
commit | c993dfb0c071d5015d019ffa94b438214a842975 (patch) | |
tree | 4b911b24812b07642d491aaf14b6dd5a9b006b58 | |
parent | f31bffb8426f04aaadea911e7c42b130a9ee80a5 (diff) |
feat: make DefaultEmitter public again
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | src/emitter.rs | 7 | ||||
-rw-r--r-- | src/lib.rs | 5 |
3 files changed, 9 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a401bfe..c7b0dc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ * `BufReadReader` can now operate on any `std::io::Read` implementation and no longer requires the reader to implement `std::io::BufRead`. +* The `DefaultEmitter` is now public again. + (Since `adjusted_current_node_present_and_not_in_html_namespace` has been removed, + the DefaultEmitter is now spec-compliant and can be exposed in good conscience.) + #### Breaking changes * Iterating over `Tokenizer` now yields values of a new `Event` enum. diff --git a/src/emitter.rs b/src/emitter.rs index dee0aa0..b75334a 100644 --- a/src/emitter.rs +++ b/src/emitter.rs @@ -158,13 +158,14 @@ pub trait Emitter<O> { fn push_doctype_system_id(&mut self, s: &str); } -/// The DefaultEmitter is not exposed in the public API because: +/// The default implementation of [`Emitter`], used to produce tokens. +/// +/// # Warning /// /// * Using the DefaultEmitter without calling [`Tokenizer::set_state`] /// results in wrong state transitions: /// -#[cfg_attr(not(feature = "integration-tests"), doc = "```ignore")] -#[cfg_attr(feature = "integration-tests", doc = "```")] +/// ``` /// # use html5tokenizer::{DefaultEmitter, Event, Tokenizer, Token}; /// let emitter = DefaultEmitter::default(); /// let html = "<script><b>"; @@ -17,7 +17,7 @@ pub mod reader; mod tokenizer; mod utils; -pub use emitter::{Comment, Doctype, Emitter, EndTag, StartTag, Token}; +pub use emitter::{Comment, DefaultEmitter, Doctype, Emitter, EndTag, StartTag, Token}; pub use error::Error; pub use naive_parser::NaiveParser; pub use tokenizer::{CdataAction, Event, State, Tokenizer}; @@ -25,9 +25,6 @@ pub use tokenizer::{CdataAction, Event, State, Tokenizer}; #[cfg(feature = "integration-tests")] pub use utils::State as InternalState; -#[cfg(feature = "integration-tests")] -pub use emitter::DefaultEmitter; - /// Relative links in the README.md don't work in rustdoc, so we have to override them. macro_rules! file_url { ($path:literal) => { |