diff options
Diffstat (limited to 'src/construct')
-rw-r--r-- | src/construct/attention.rs | 32 | ||||
-rw-r--r-- | src/construct/heading_atx.rs | 8 | ||||
-rw-r--r-- | src/construct/label_end.rs | 32 | ||||
-rw-r--r-- | src/construct/paragraph.rs | 10 |
4 files changed, 24 insertions, 58 deletions
diff --git a/src/construct/attention.rs b/src/construct/attention.rs index f0de63f..ac6aecf 100644 --- a/src/construct/attention.rs +++ b/src/construct/attention.rs @@ -400,9 +400,7 @@ fn resolve_attention(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { }, point: seq_open_enter.0.clone(), index: seq_open_enter.1, - previous: None, - next: None, - content_type: None, + link: None, }, Event { event_type: EventType::Enter, @@ -413,9 +411,7 @@ fn resolve_attention(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { }, point: seq_open_enter.0.clone(), index: seq_open_enter.1, - previous: None, - next: None, - content_type: None, + link: None, }, Event { event_type: EventType::Exit, @@ -426,9 +422,7 @@ fn resolve_attention(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { }, point: seq_open_exit.0.clone(), index: seq_open_exit.1, - previous: None, - next: None, - content_type: None, + link: None, }, Event { event_type: EventType::Enter, @@ -439,9 +433,7 @@ fn resolve_attention(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { }, point: seq_open_exit.0.clone(), index: seq_open_exit.1, - previous: None, - next: None, - content_type: None, + link: None, }, ], ); @@ -459,9 +451,7 @@ fn resolve_attention(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { }, point: seq_close_enter.0.clone(), index: seq_close_enter.1, - previous: None, - next: None, - content_type: None, + link: None, }, Event { event_type: EventType::Enter, @@ -472,9 +462,7 @@ fn resolve_attention(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { }, point: seq_close_enter.0.clone(), index: seq_close_enter.1, - previous: None, - next: None, - content_type: None, + link: None, }, Event { event_type: EventType::Exit, @@ -485,9 +473,7 @@ fn resolve_attention(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { }, point: seq_close_exit.0.clone(), index: seq_close_exit.1, - previous: None, - next: None, - content_type: None, + link: None, }, Event { event_type: EventType::Exit, @@ -498,9 +484,7 @@ fn resolve_attention(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { }, point: seq_close_exit.0.clone(), index: seq_close_exit.1, - previous: None, - next: None, - content_type: None, + link: None, }, ], ); diff --git a/src/construct/heading_atx.rs b/src/construct/heading_atx.rs index bf3de23..0e4cda5 100644 --- a/src/construct/heading_atx.rs +++ b/src/construct/heading_atx.rs @@ -217,9 +217,7 @@ pub fn resolve(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { token_type: Token::HeadingAtxText, point: tokenizer.events[start].point.clone(), index: tokenizer.events[start].index, - previous: None, - next: None, - content_type: None, + link: None, }], ); @@ -234,9 +232,7 @@ pub fn resolve(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { token_type: Token::HeadingAtxText, point: tokenizer.events[end].point.clone(), index: tokenizer.events[end].index, - previous: None, - next: None, - content_type: None, + link: None, }], ); diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs index bcfe343..883e314 100644 --- a/src/construct/label_end.rs +++ b/src/construct/label_end.rs @@ -636,18 +636,14 @@ pub fn resolve_media(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { token_type: Token::Data, point: events[data_enter_index].point.clone(), index: events[data_enter_index].index, - previous: None, - next: None, - content_type: None, + link: None, }, Event { event_type: EventType::Exit, token_type: Token::Data, point: events[data_exit_index].point.clone(), index: events[data_exit_index].index, - previous: None, - next: None, - content_type: None, + link: None, }, ], ); @@ -690,18 +686,14 @@ pub fn resolve_media(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { }, point: group_enter_event.point.clone(), index: group_enter_event.index, - previous: None, - next: None, - content_type: None, + link: None, }, Event { event_type: EventType::Enter, token_type: Token::Label, point: group_enter_event.point.clone(), index: group_enter_event.index, - previous: None, - next: None, - content_type: None, + link: None, }, ], ); @@ -717,9 +709,7 @@ pub fn resolve_media(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { token_type: Token::LabelText, point: events[text_enter_index].point.clone(), index: events[text_enter_index].index, - previous: None, - next: None, - content_type: None, + link: None, }], ); @@ -732,9 +722,7 @@ pub fn resolve_media(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { token_type: Token::LabelText, point: events[text_exit_index].point.clone(), index: events[text_exit_index].index, - previous: None, - next: None, - content_type: None, + link: None, }], ); } @@ -748,9 +736,7 @@ pub fn resolve_media(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { token_type: Token::Label, point: events[label_exit_index].point.clone(), index: events[label_exit_index].index, - previous: None, - next: None, - content_type: None, + link: None, }], ); @@ -763,9 +749,7 @@ pub fn resolve_media(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { token_type: Token::Link, point: events[group_end_index].point.clone(), index: events[group_end_index].index, - previous: None, - next: None, - content_type: None, + link: None, }], ); 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; |