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

Parse misuse resistance #191

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Express fn parse() with fn do_parse()
  • Loading branch information
sftse committed Dec 16, 2024
commit 436dea431a48697a5b7d336f248e72a8c5cec383
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2371,7 +2371,7 @@ pub mod config {
}
}
/// Parse with context.
fn do_parse<R: io::Read>(&self, input: R) -> Result<RenderTree> {
pub(crate) fn do_parse<R: io::Read>(&self, input: R) -> Result<RenderTree> {
super::parse_with_context(input, &mut self.make_context())
}

Expand Down Expand Up @@ -2669,8 +2669,7 @@ fn parse_with_context(input: impl io::Read, context: &mut HtmlContext) -> Result

/// Reads and parses HTML from `input` and prepares a render tree.
pub fn parse(input: impl io::Read) -> Result<RenderTree> {
let mut context = config::plain().make_context();
parse_with_context(input, &mut context)
config::plain().do_parse(input)
}

/// Reads HTML from `input`, decorates it using `decorator`, and
Expand Down