aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/heading_setext.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-22 18:46:33 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-22 18:57:19 +0200
commitbac358ee5c341729e50630f2569a69b4d580ce47 (patch)
tree9ea5f311dcad46e54dfaa55a2985c75925ff6c83 /src/construct/heading_setext.rs
parent0525454e33ed6bcd7b43da1c0969c1d592e743d9 (diff)
downloadmarkdown-rs-bac358ee5c341729e50630f2569a69b4d580ce47.tar.gz
markdown-rs-bac358ee5c341729e50630f2569a69b4d580ce47.tar.bz2
markdown-rs-bac358ee5c341729e50630f2569a69b4d580ce47.zip
Refactor to use a single shared edit map
Diffstat (limited to 'src/construct/heading_setext.rs')
-rw-r--r--src/construct/heading_setext.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/construct/heading_setext.rs b/src/construct/heading_setext.rs
index 828b7f4..7aa0054 100644
--- a/src/construct/heading_setext.rs
+++ b/src/construct/heading_setext.rs
@@ -61,7 +61,7 @@ use crate::constant::TAB_SIZE;
use crate::construct::partial_space_or_tab::{space_or_tab, space_or_tab_min_max};
use crate::token::Token;
use crate::tokenizer::{Code, EventType, State, Tokenizer};
-use crate::util::{edit_map::EditMap, skip::opt_back as skip_opt_back};
+use crate::util::skip::opt_back as skip_opt_back;
/// Kind of underline.
#[derive(Debug, Clone, PartialEq)]
@@ -196,7 +196,7 @@ fn after(tokenizer: &mut Tokenizer, code: Code) -> State {
}
/// Resolve heading (setext).
-pub fn resolve(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool {
+pub fn resolve(tokenizer: &mut Tokenizer) {
let mut index = 0;
let mut paragraph_enter = None;
let mut paragraph_exit = None;
@@ -228,13 +228,10 @@ pub fn resolve(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool {
let mut heading_exit = tokenizer.events[index].clone();
heading_exit.token_type = Token::HeadingSetext;
- map.add(enter, 0, vec![heading_enter]);
- map.add(index + 1, 0, vec![heading_exit]);
+ tokenizer.map.add(enter, 0, vec![heading_enter]);
+ tokenizer.map.add(index + 1, 0, vec![heading_exit]);
}
index += 1;
}
-
- // This resolver improves events, but is not needed by other resolvers.
- false
}