diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-11 14:53:42 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-11 14:53:42 +0200 |
commit | d87dc75500a2e73d9521135054b42c18e6eae987 (patch) | |
tree | 4bc3f4a72894db3ec5ed4069841c6be5be69713d /src/construct/label_start_image.rs | |
parent | 6eb2f644057f371841fe25330a57ee185f91c7af (diff) | |
download | markdown-rs-d87dc75500a2e73d9521135054b42c18e6eae987.tar.gz markdown-rs-d87dc75500a2e73d9521135054b42c18e6eae987.tar.bz2 markdown-rs-d87dc75500a2e73d9521135054b42c18e6eae987.zip |
Refactor to move some code to `event.rs`
Diffstat (limited to 'src/construct/label_start_image.rs')
-rw-r--r-- | src/construct/label_start_image.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/construct/label_start_image.rs b/src/construct/label_start_image.rs index 7703ba4..2f7c0bf 100644 --- a/src/construct/label_start_image.rs +++ b/src/construct/label_start_image.rs @@ -29,8 +29,8 @@ //! [html-img]: https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element use super::label_end::resolve_media; -use crate::state::{Name, State}; -use crate::token::Token; +use crate::event::Name; +use crate::state::{Name as StateName, State}; use crate::tokenizer::{LabelStart, Tokenizer}; /// Start of label (image) start. @@ -42,11 +42,11 @@ use crate::tokenizer::{LabelStart, Tokenizer}; pub fn start(tokenizer: &mut Tokenizer) -> State { match tokenizer.current { Some(b'!') if tokenizer.parse_state.constructs.label_start_image => { - tokenizer.enter(Token::LabelImage); - tokenizer.enter(Token::LabelImageMarker); + tokenizer.enter(Name::LabelImage); + tokenizer.enter(Name::LabelImageMarker); tokenizer.consume(); - tokenizer.exit(Token::LabelImageMarker); - State::Next(Name::LabelStartImageOpen) + tokenizer.exit(Name::LabelImageMarker); + State::Next(StateName::LabelStartImageOpen) } _ => State::Nok, } @@ -61,10 +61,10 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { pub fn open(tokenizer: &mut Tokenizer) -> State { match tokenizer.current { Some(b'[') => { - tokenizer.enter(Token::LabelMarker); + tokenizer.enter(Name::LabelMarker); tokenizer.consume(); - tokenizer.exit(Token::LabelMarker); - tokenizer.exit(Token::LabelImage); + tokenizer.exit(Name::LabelMarker); + tokenizer.exit(Name::LabelImage); tokenizer.tokenize_state.label_start_stack.push(LabelStart { start: (tokenizer.events.len() - 6, tokenizer.events.len() - 1), balanced: false, |