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/autolink.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 '')
-rw-r--r-- | src/construct/autolink.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/construct/autolink.rs b/src/construct/autolink.rs index 0819f3a..e8f30fb 100644 --- a/src/construct/autolink.rs +++ b/src/construct/autolink.rs @@ -126,7 +126,7 @@ use crate::state::{Name as StateName, State}; use crate::tokenizer::Tokenizer; use crate::util::constant::{AUTOLINK_DOMAIN_SIZE_MAX, AUTOLINK_SCHEME_SIZE_MAX}; -/// Start of autolink. +/// Start of an autolink. /// /// ```markdown /// > | a<https://example.com>b @@ -205,8 +205,8 @@ pub fn scheme_inside_or_email_atext(tokenizer: &mut Tokenizer) -> State { Some(b'+' | b'-' | b'.' | b'0'..=b'9' | b'A'..=b'Z' | b'a'..=b'z') if tokenizer.tokenize_state.size < AUTOLINK_SCHEME_SIZE_MAX => { - tokenizer.tokenize_state.size += 1; tokenizer.consume(); + tokenizer.tokenize_state.size += 1; State::Next(StateName::AutolinkSchemeInsideOrEmailAtext) } _ => { @@ -305,12 +305,11 @@ pub fn email_at_sign_or_dot(tokenizer: &mut Tokenizer) -> State { pub fn email_label(tokenizer: &mut Tokenizer) -> State { match tokenizer.current { Some(b'.') => { - tokenizer.tokenize_state.size = 0; tokenizer.consume(); + tokenizer.tokenize_state.size = 0; State::Next(StateName::AutolinkEmailAtSignOrDot) } Some(b'>') => { - tokenizer.tokenize_state.size = 0; let index = tokenizer.events.len(); tokenizer.exit(Name::AutolinkProtocol); // Change the event name. @@ -320,6 +319,7 @@ pub fn email_label(tokenizer: &mut Tokenizer) -> State { tokenizer.consume(); tokenizer.exit(Name::AutolinkMarker); tokenizer.exit(Name::Autolink); + tokenizer.tokenize_state.size = 0; State::Ok } _ => State::Retry(StateName::AutolinkEmailValue), |