aboutsummaryrefslogtreecommitdiffstats
path: root/src/content
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/content
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/content')
-rw-r--r--src/content/document.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/content/document.rs b/src/content/document.rs
index f2c73e4..c1017a7 100644
--- a/src/content/document.rs
+++ b/src/content/document.rs
@@ -19,7 +19,6 @@ use crate::token::Token;
use crate::tokenizer::{
Code, Container, ContainerState, Event, EventType, Point, State, StateFn, Tokenizer,
};
-use crate::util::edit_map::EditMap;
use crate::util::{
normalize_identifier::normalize_identifier,
skip,
@@ -454,7 +453,6 @@ fn exit_containers(
// Inject the container events.
fn resolve(tokenizer: &mut Tokenizer, info: &mut DocumentInfo) {
- let mut map = EditMap::new();
let mut index = 0;
let mut inject = info.inject.split_off(0);
inject.reverse();
@@ -463,7 +461,7 @@ fn resolve(tokenizer: &mut Tokenizer, info: &mut DocumentInfo) {
while let Some((before, mut after)) = inject.pop() {
if !before.is_empty() {
first_line_ending_in_run = None;
- map.add(index, 0, before);
+ tokenizer.map.add(index, 0, before);
}
while index < tokenizer.events.len() {
@@ -499,8 +497,8 @@ fn resolve(tokenizer: &mut Tokenizer, info: &mut DocumentInfo) {
subevent_index += 1;
}
- map.add(close_index, 0, after);
+ tokenizer.map.add(close_index, 0, after);
}
- map.consume(&mut tokenizer.events);
+ tokenizer.map.consume(&mut tokenizer.events);
}