diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-12 17:28:19 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-12 17:28:19 +0200 |
commit | 6dc2011d69c85820feddf6799142d304cc2eeb29 (patch) | |
tree | 29d8774a526631052ba6cd56be2492e5e249d494 /src/construct/partial_destination.rs | |
parent | 1234de9c22343fc4e1fe9e3e1127d2db01e96c2f (diff) | |
download | markdown-rs-6dc2011d69c85820feddf6799142d304cc2eeb29.tar.gz markdown-rs-6dc2011d69c85820feddf6799142d304cc2eeb29.tar.bz2 markdown-rs-6dc2011d69c85820feddf6799142d304cc2eeb29.zip |
Refactor to improve entering
Diffstat (limited to 'src/construct/partial_destination.rs')
-rw-r--r-- | src/construct/partial_destination.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/construct/partial_destination.rs b/src/construct/partial_destination.rs index 29cb5c4..d2477ab 100644 --- a/src/construct/partial_destination.rs +++ b/src/construct/partial_destination.rs @@ -71,7 +71,7 @@ //! [label_end]: crate::construct::label_end //! [sanitize_uri]: crate::util::sanitize_uri -use crate::event::{Content, Name}; +use crate::event::{Content, Link, Name}; use crate::state::{Name as StateName, State}; use crate::tokenizer::Tokenizer; @@ -99,7 +99,14 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { tokenizer.enter(tokenizer.tokenize_state.token_1.clone()); tokenizer.enter(tokenizer.tokenize_state.token_4.clone()); tokenizer.enter(tokenizer.tokenize_state.token_5.clone()); - tokenizer.enter_with_content(Name::Data, Some(Content::String)); + tokenizer.enter_link( + Name::Data, + Link { + previous: None, + next: None, + content: Content::String, + }, + ); State::Retry(StateName::DestinationRaw) } } @@ -121,7 +128,14 @@ pub fn enclosed_before(tokenizer: &mut Tokenizer) -> State { State::Ok } else { tokenizer.enter(tokenizer.tokenize_state.token_5.clone()); - tokenizer.enter_with_content(Name::Data, Some(Content::String)); + tokenizer.enter_link( + Name::Data, + Link { + previous: None, + next: None, + content: Content::String, + }, + ); State::Retry(StateName::DestinationEnclosed) } } |