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/code_fenced.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/code_fenced.rs')
-rw-r--r-- | src/construct/code_fenced.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/construct/code_fenced.rs b/src/construct/code_fenced.rs index 56a2a04..be0542a 100644 --- a/src/construct/code_fenced.rs +++ b/src/construct/code_fenced.rs @@ -103,7 +103,7 @@ use crate::constant::{CODE_FENCED_SEQUENCE_SIZE_MIN, TAB_SIZE}; use crate::construct::partial_space_or_tab::{space_or_tab, space_or_tab_min_max}; -use crate::event::{Content, Name}; +use crate::event::{Content, Link, Name}; use crate::state::{Name as StateName, State}; use crate::tokenizer::Tokenizer; use crate::util::slice::{Position, Slice}; @@ -223,7 +223,14 @@ pub fn info_before(tokenizer: &mut Tokenizer) -> State { } _ => { tokenizer.enter(Name::CodeFencedFenceInfo); - 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::CodeFencedInfo) } } @@ -281,7 +288,14 @@ pub fn meta_before(tokenizer: &mut Tokenizer) -> State { None | Some(b'\n') => State::Retry(StateName::CodeFencedInfoBefore), _ => { tokenizer.enter(Name::CodeFencedFenceMeta); - 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::CodeFencedMeta) } } |