diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-21 15:32:48 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-21 15:32:53 +0200 |
commit | 2d0dfe66d423e707b7de60d9bde0cec7933580fe (patch) | |
tree | ddbe9729046c740b07e656920fa991c475983046 /src/construct/paragraph.rs | |
parent | 75c2109c6051009b220436bd823970a374f4f9fd (diff) | |
download | markdown-rs-2d0dfe66d423e707b7de60d9bde0cec7933580fe.tar.gz markdown-rs-2d0dfe66d423e707b7de60d9bde0cec7933580fe.tar.bz2 markdown-rs-2d0dfe66d423e707b7de60d9bde0cec7933580fe.zip |
Refactor to move some event fields to `link`
Diffstat (limited to '')
-rw-r--r-- | src/construct/paragraph.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/construct/paragraph.rs b/src/construct/paragraph.rs index 134a4b5..3932ad8 100644 --- a/src/construct/paragraph.rs +++ b/src/construct/paragraph.rs @@ -118,10 +118,12 @@ pub fn resolve(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { data_exit.index = line_ending_index; // Link Enter:Data on the previous line to Enter:Data on this line. - let data_enter_prev = &mut tokenizer.events[exit_index - 2]; - data_enter_prev.next = Some(enter_next_index + 1); - let data_enter_next = &mut tokenizer.events[enter_next_index + 1]; - data_enter_next.previous = Some(exit_index - 2); + if let Some(link) = &mut tokenizer.events[exit_index - 2].link { + link.next = Some(enter_next_index + 1); + } + if let Some(link) = &mut tokenizer.events[enter_next_index + 1].link { + link.previous = Some(exit_index - 2); + } // Potential next start. exit_index = enter_next_index + 3; |