aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/heading_setext.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-20 18:00:52 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-20 18:00:52 +0200
commit75c2109c6051009b220436bd823970a374f4f9fd (patch)
treec8123e6e4a0a71e2daec77d76c0dc4485bad2240 /src/construct/heading_setext.rs
parent86801cdb3b114b30a14d4b8c01c8fb70b2bcee82 (diff)
downloadmarkdown-rs-75c2109c6051009b220436bd823970a374f4f9fd.tar.gz
markdown-rs-75c2109c6051009b220436bd823970a374f4f9fd.tar.bz2
markdown-rs-75c2109c6051009b220436bd823970a374f4f9fd.zip
Refactor to share edit map
Diffstat (limited to '')
-rw-r--r--src/construct/heading_setext.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/construct/heading_setext.rs b/src/construct/heading_setext.rs
index d1e7d57..ee6c23c 100644
--- a/src/construct/heading_setext.rs
+++ b/src/construct/heading_setext.rs
@@ -196,8 +196,7 @@ fn after(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
}
/// Resolve heading (setext).
-pub fn resolve(tokenizer: &mut Tokenizer) {
- let mut edit_map = EditMap::new();
+pub fn resolve(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool {
let mut index = 0;
let mut paragraph_enter: Option<usize> = None;
let mut paragraph_exit: Option<usize> = None;
@@ -229,12 +228,13 @@ pub fn resolve(tokenizer: &mut Tokenizer) {
let mut heading_exit = tokenizer.events[index].clone();
heading_exit.token_type = Token::HeadingSetext;
- edit_map.add(enter, 0, vec![heading_enter]);
- edit_map.add(index + 1, 0, vec![heading_exit]);
+ map.add(enter, 0, vec![heading_enter]);
+ map.add(index + 1, 0, vec![heading_exit]);
}
index += 1;
}
- edit_map.consume(&mut tokenizer.events);
+ // This resolver improves events, but is not needed by other resolvers.
+ false
}