aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/html_text.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-20 17:06:00 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-20 17:06:00 +0200
commit65dd765cceee8bdccc74c08066eec59a579a16b1 (patch)
treecb60ab00039135b6f0a65efcb508f73a8b39aa11 /src/construct/html_text.rs
parent61271d73128f8553f8c4c17927828cde52a25eba (diff)
downloadmarkdown-rs-65dd765cceee8bdccc74c08066eec59a579a16b1.tar.gz
markdown-rs-65dd765cceee8bdccc74c08066eec59a579a16b1.tar.bz2
markdown-rs-65dd765cceee8bdccc74c08066eec59a579a16b1.zip
Add improved whitespace handling
* add several helpers for parsing betwen x and y `space_or_tab`s * use those helpers in a bunch of places * move initial indent parsing to flow constructs themselves
Diffstat (limited to '')
-rw-r--r--src/construct/html_text.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/construct/html_text.rs b/src/construct/html_text.rs
index 93b4b62..a91113f 100644
--- a/src/construct/html_text.rs
+++ b/src/construct/html_text.rs
@@ -49,7 +49,7 @@
//! [html_flow]: crate::construct::html_flow
//! [html-parsing]: https://html.spec.whatwg.org/multipage/parsing.html#parsing
-use crate::construct::partial_whitespace::start as whitespace;
+use crate::construct::partial_space_or_tab::space_or_tab_opt;
use crate::tokenizer::{Code, State, StateFn, StateFnResult, TokenType, Tokenizer};
/// Start of HTML (text)
@@ -673,10 +673,9 @@ fn after_line_ending(
code: Code,
return_state: Box<StateFn>,
) -> StateFnResult {
- tokenizer.attempt(
- |tokenizer, code| whitespace(tokenizer, code, TokenType::Whitespace),
- |_ok| Box::new(|t, c| after_line_ending_prefix(t, c, return_state)),
- )(tokenizer, code)
+ tokenizer.go(space_or_tab_opt(), |t, c| {
+ after_line_ending_prefix(t, c, return_state)
+ })(tokenizer, code)
}
/// After a line ending, after indent.