aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/paragraph.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/paragraph.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/paragraph.rs')
-rw-r--r--src/construct/paragraph.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/construct/paragraph.rs b/src/construct/paragraph.rs
index 811bc75..5409532 100644
--- a/src/construct/paragraph.rs
+++ b/src/construct/paragraph.rs
@@ -34,7 +34,7 @@
use crate::token::Token;
use crate::tokenizer::{Code, ContentType, EventType, State, Tokenizer};
-use crate::util::{edit_map::EditMap, skip::opt as skip_opt};
+use crate::util::skip::opt as skip_opt;
/// Before a paragraph.
///
@@ -80,7 +80,7 @@ fn inside(tokenizer: &mut Tokenizer, code: Code) -> State {
/// Merge “`Paragraph`”s, which currently span a single line, into actual
/// `Paragraph`s that span multiple lines.
-pub fn resolve(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool {
+pub fn resolve(tokenizer: &mut Tokenizer) {
let len = tokenizer.events.len();
let mut index = 0;
@@ -104,10 +104,10 @@ pub fn resolve(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool {
&& tokenizer.events[enter_next_index].token_type == Token::Paragraph
{
// Remove Exit:Paragraph, Enter:LineEnding, Exit:LineEnding, Enter:Paragraph.
- map.add(exit_index, 3, vec![]);
+ tokenizer.map.add(exit_index, 3, vec![]);
// Remove Enter:Paragraph.
- map.add(enter_next_index, 1, vec![]);
+ tokenizer.map.add(enter_next_index, 1, vec![]);
// Add Exit:LineEnding position info to Exit:Data.
let line_ending_exit = &tokenizer.events[exit_index + 2];
@@ -141,6 +141,5 @@ pub fn resolve(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool {
index += 1;
}
- // This resolver is needed by setext headings.
- true
+ tokenizer.map.consume(&mut tokenizer.events);
}