aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/list.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/list.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/list.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/construct/list.rs b/src/construct/list.rs
index 48ed291..12c666b 100644
--- a/src/construct/list.rs
+++ b/src/construct/list.rs
@@ -390,8 +390,7 @@ fn nok(_tokenizer: &mut Tokenizer, _code: Code) -> StateFnResult {
}
/// Find adjacent list items with the same marker.
-pub fn resolve_list_item(tokenizer: &mut Tokenizer) {
- let mut edit_map = EditMap::new();
+pub fn resolve_list_item(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool {
let mut index = 0;
let mut balance = 0;
let mut lists_wip: Vec<(Kind, usize, usize, usize)> = vec![];
@@ -486,11 +485,12 @@ pub fn resolve_list_item(tokenizer: &mut Tokenizer) {
list_start.token_type = token_type.clone();
list_end.token_type = token_type;
- edit_map.add(list_item.2, 0, vec![list_start]);
- edit_map.add(list_item.3 + 1, 0, vec![list_end]);
+ map.add(list_item.2, 0, vec![list_start]);
+ map.add(list_item.3 + 1, 0, vec![list_end]);
index += 1;
}
- edit_map.consume(&mut tokenizer.events);
+ // This resolver improves events, but is not needed by other resolvers.
+ false
}