aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/label_start_image.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-07 18:56:06 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-07 18:56:06 +0200
commit92b42e06f943338ce8b54b7e22cbb116ff598fa6 (patch)
treeff51df093f52dc33bfac5e1c236b41cfbd21c220 /src/construct/label_start_image.rs
parentfdb1f1694f44cfbc59d303a10371300b48d74627 (diff)
downloadmarkdown-rs-92b42e06f943338ce8b54b7e22cbb116ff598fa6.tar.gz
markdown-rs-92b42e06f943338ce8b54b7e22cbb116ff598fa6.tar.bz2
markdown-rs-92b42e06f943338ce8b54b7e22cbb116ff598fa6.zip
Refactor to move token types to `token`
Diffstat (limited to 'src/construct/label_start_image.rs')
-rw-r--r--src/construct/label_start_image.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/construct/label_start_image.rs b/src/construct/label_start_image.rs
index a45205a..f9b8300 100644
--- a/src/construct/label_start_image.rs
+++ b/src/construct/label_start_image.rs
@@ -15,9 +15,9 @@
//!
//! ## Tokens
//!
-//! * [`LabelImage`][TokenType::LabelImage]
-//! * [`LabelImageMarker`][TokenType::LabelImageMarker]
-//! * [`LabelMarker`][TokenType::LabelMarker]
+//! * [`LabelImage`][Token::LabelImage]
+//! * [`LabelImageMarker`][Token::LabelImageMarker]
+//! * [`LabelMarker`][Token::LabelMarker]
//!
//! ## References
//!
@@ -29,7 +29,8 @@
//! [html-img]: https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element
use super::label_end::resolve_media;
-use crate::tokenizer::{Code, LabelStart, State, StateFnResult, TokenType, Tokenizer};
+use crate::token::Token;
+use crate::tokenizer::{Code, LabelStart, State, StateFnResult, Tokenizer};
/// Start of label (image) start.
///
@@ -39,10 +40,10 @@ use crate::tokenizer::{Code, LabelStart, State, StateFnResult, TokenType, Tokeni
pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
match code {
Code::Char('!') => {
- tokenizer.enter(TokenType::LabelImage);
- tokenizer.enter(TokenType::LabelImageMarker);
+ tokenizer.enter(Token::LabelImage);
+ tokenizer.enter(Token::LabelImageMarker);
tokenizer.consume(code);
- tokenizer.exit(TokenType::LabelImageMarker);
+ tokenizer.exit(Token::LabelImageMarker);
(State::Fn(Box::new(open)), None)
}
_ => (State::Nok, None),
@@ -57,10 +58,10 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
pub fn open(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult {
match code {
Code::Char('[') => {
- tokenizer.enter(TokenType::LabelMarker);
+ tokenizer.enter(Token::LabelMarker);
tokenizer.consume(code);
- tokenizer.exit(TokenType::LabelMarker);
- tokenizer.exit(TokenType::LabelImage);
+ tokenizer.exit(Token::LabelMarker);
+ tokenizer.exit(Token::LabelImage);
let end = tokenizer.events.len() - 1;
tokenizer.label_start_stack.push(LabelStart {
start: (end - 5, end),