aboutsummaryrefslogtreecommitdiffstats
path: root/src/tokenizer.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-16 12:55:50 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-16 12:55:50 +0200
commit7350acc692a79d9d4cf56afbc53ac3c9f2a6237c (patch)
tree02f8b83230a40b509adf4b4872e313544c7fc80f /src/tokenizer.rs
parent58ba69452a25c3d4b2059c01cc6cd837159d2f90 (diff)
downloadmarkdown-rs-7350acc692a79d9d4cf56afbc53ac3c9f2a6237c.tar.gz
markdown-rs-7350acc692a79d9d4cf56afbc53ac3c9f2a6237c.tar.bz2
markdown-rs-7350acc692a79d9d4cf56afbc53ac3c9f2a6237c.zip
Add support for hard break (trailing)
Diffstat (limited to '')
-rw-r--r--src/tokenizer.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index a63d209..da45ee5 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -62,6 +62,8 @@ pub enum TokenType {
HardBreakEscape,
HardBreakEscapeMarker,
+ HardBreakTrailing,
+ HardBreakTrailingSpace,
HtmlFlow,
HtmlFlowData,
@@ -445,6 +447,7 @@ impl Tokenizer {
None,
None,
None,
+ None,
done,
)
}
@@ -464,12 +467,13 @@ impl Tokenizer {
None,
None,
None,
+ None,
done,
)
}
#[allow(clippy::too_many_arguments, clippy::many_single_char_names)]
- pub fn attempt_6(
+ pub fn attempt_7(
&mut self,
a: impl FnOnce(&mut Tokenizer, Code) -> StateFnResult + 'static,
b: impl FnOnce(&mut Tokenizer, Code) -> StateFnResult + 'static,
@@ -477,6 +481,7 @@ impl Tokenizer {
d: impl FnOnce(&mut Tokenizer, Code) -> StateFnResult + 'static,
e: impl FnOnce(&mut Tokenizer, Code) -> StateFnResult + 'static,
f: impl FnOnce(&mut Tokenizer, Code) -> StateFnResult + 'static,
+ g: impl FnOnce(&mut Tokenizer, Code) -> StateFnResult + 'static,
done: impl FnOnce(bool) -> Box<StateFn> + 'static,
) -> Box<StateFn> {
self.call_multiple(
@@ -487,6 +492,7 @@ impl Tokenizer {
Some(Box::new(d)),
Some(Box::new(e)),
Some(Box::new(f)),
+ Some(Box::new(g)),
done,
)
}
@@ -501,6 +507,7 @@ impl Tokenizer {
d: Option<Box<StateFn>>,
e: Option<Box<StateFn>>,
f: Option<Box<StateFn>>,
+ g: Option<Box<StateFn>>,
done: impl FnOnce(bool) -> Box<StateFn> + 'static,
) -> Box<StateFn> {
if let Some(head) = a {
@@ -509,7 +516,9 @@ impl Tokenizer {
done(ok)
} else {
Box::new(move |tokenizer: &mut Tokenizer, code| {
- tokenizer.call_multiple(check, b, c, d, e, f, None, done)(tokenizer, code)
+ tokenizer.call_multiple(check, b, c, d, e, f, g, None, done)(
+ tokenizer, code,
+ )
})
}
};