From 75c2109c6051009b220436bd823970a374f4f9fd Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 20 Jul 2022 18:00:52 +0200 Subject: Refactor to share edit map --- src/construct/heading_setext.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/construct/heading_setext.rs') 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 = None; let mut paragraph_exit: Option = 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 } -- cgit