diff options
author | Titus Wormer <tituswormer@gmail.com> | 2023-05-23 16:31:21 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2023-05-23 16:31:21 +0200 |
commit | 0be7464edbd0fae379eff1e18d64bd2099651040 (patch) | |
tree | 5511818733bfa40d9b22b09bfc10c5be2c788988 /src/construct/label_end.rs | |
parent | 35cbee9ede93fbf9296357765cab0e23698bfb22 (diff) | |
download | markdown-rs-0be7464edbd0fae379eff1e18d64bd2099651040.tar.gz markdown-rs-0be7464edbd0fae379eff1e18d64bd2099651040.tar.bz2 markdown-rs-0be7464edbd0fae379eff1e18d64bd2099651040.zip |
Refactor some code
Diffstat (limited to 'src/construct/label_end.rs')
-rw-r--r-- | src/construct/label_end.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs index f47920c..1c5e0bd 100644 --- a/src/construct/label_end.rs +++ b/src/construct/label_end.rs @@ -529,7 +529,7 @@ pub fn resource_title_after(tokenizer: &mut Tokenizer) -> State { if matches!(tokenizer.current, Some(b'\t' | b'\n' | b' ')) { tokenizer.attempt( - State::Next(StateName::LabelEndResourceBetween), + State::Next(StateName::LabelEndResourceEnd), State::Next(StateName::LabelEndResourceEnd), ); State::Retry(space_or_tab_eol(tokenizer)) @@ -571,7 +571,7 @@ pub fn reference_full(tokenizer: &mut Tokenizer) -> State { tokenizer.tokenize_state.token_3 = Name::ReferenceString; tokenizer.attempt( State::Next(StateName::LabelEndReferenceFullAfter), - State::Nok, + State::Next(StateName::LabelEndReferenceFullMissing) ); State::Retry(StateName::LabelStart) } @@ -615,6 +615,19 @@ pub fn reference_full_after(tokenizer: &mut Tokenizer) -> State { } } +/// In reference (full) that was missing. +/// +/// ```markdown +/// > | [a][b d +/// ^ +/// ``` +pub fn reference_full_missing(tokenizer: &mut Tokenizer) -> State { + tokenizer.tokenize_state.token_1 = Name::Data; + tokenizer.tokenize_state.token_2 = Name::Data; + tokenizer.tokenize_state.token_3 = Name::Data; + State::Nok +} + /// In reference (collapsed), at `[`. /// /// > 👉 **Note**: we only get here if the label is defined. |