diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-18 13:27:16 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-18 13:27:16 +0200 |
commit | c9f75249b83839130ffbc3b6dd175b0e31008cb7 (patch) | |
tree | 55012a12979e5960845a611162a9a3e340627fa5 /src/construct/autolink.rs | |
parent | 2100b41ee330ef6b088b4d7efdf8ea589a650ceb (diff) | |
download | markdown-rs-c9f75249b83839130ffbc3b6dd175b0e31008cb7.tar.gz markdown-rs-c9f75249b83839130ffbc3b6dd175b0e31008cb7.tar.bz2 markdown-rs-c9f75249b83839130ffbc3b6dd175b0e31008cb7.zip |
Refactor examples of states
Diffstat (limited to 'src/construct/autolink.rs')
-rw-r--r-- | src/construct/autolink.rs | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/construct/autolink.rs b/src/construct/autolink.rs index db4365f..fe8f380 100644 --- a/src/construct/autolink.rs +++ b/src/construct/autolink.rs @@ -108,8 +108,10 @@ use crate::tokenizer::{Code, State, StateFnResult, Tokenizer}; /// Start of an autolink. /// /// ```markdown -/// a|<https://example.com>b -/// a|<user@example.com>b +/// > | a<https://example.com>b +/// ^ +/// > | a<user@example.com>b +/// ^ /// ``` pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { @@ -128,8 +130,10 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { /// After `<`, before the protocol. /// /// ```markdown -/// a<|https://example.com>b -/// a<|user@example.com>b +/// > | a<https://example.com>b +/// ^ +/// > | a<user@example.com>b +/// ^ /// ``` fn open(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { @@ -145,8 +149,10 @@ fn open(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { /// After the first character of the protocol or email name. /// /// ```markdown -/// a<h|ttps://example.com>b -/// a<u|ser@example.com>b +/// > | a<https://example.com>b +/// ^ +/// > | a<user@example.com>b +/// ^ /// ``` fn scheme_or_email_atext(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { @@ -160,8 +166,10 @@ fn scheme_or_email_atext(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult /// Inside an ambiguous protocol or email name. /// /// ```markdown -/// a<ht|tps://example.com>b -/// a<us|er@example.com>b +/// > | a<https://example.com>b +/// ^ +/// > | a<user@example.com>b +/// ^ /// ``` fn scheme_inside_or_email_atext( tokenizer: &mut Tokenizer, @@ -191,7 +199,8 @@ fn scheme_inside_or_email_atext( /// Inside a URL, after the protocol. /// /// ```markdown -/// a<https:|//example.com>b +/// > | a<https://example.com>b +/// ^ /// ``` fn url_inside(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { @@ -213,7 +222,8 @@ fn url_inside(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { /// Inside email atext. /// /// ```markdown -/// a<user.na|me@example.com>b +/// > | a<user.name@example.com>b +/// ^ /// ``` fn email_atext(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { @@ -235,8 +245,8 @@ fn email_atext(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { /// After an at-sign or a dot in the label. /// /// ```markdown -/// a<user.name@|example.com>b -/// a<user.name@example.|com>b +/// > | a<user.name@example.com>b +/// ^ ^ /// ``` fn email_at_sign_or_dot(tokenizer: &mut Tokenizer, code: Code, size: usize) -> StateFnResult { match code { @@ -248,7 +258,8 @@ fn email_at_sign_or_dot(tokenizer: &mut Tokenizer, code: Code, size: usize) -> S /// In the label, where `.` and `>` are allowed. /// /// ```markdown -/// a<user.name@ex|ample.com>b +/// > | a<user.name@example.com>b +/// ^ /// ``` fn email_label(tokenizer: &mut Tokenizer, code: Code, size: usize) -> StateFnResult { match code { @@ -276,7 +287,8 @@ fn email_label(tokenizer: &mut Tokenizer, code: Code, size: usize) -> StateFnRes /// Though, this is also used in `email_label` to parse other values. /// /// ```markdown -/// a<user.name@ex-|ample.com>b +/// > | a<user.name@ex-ample.com>b +/// ^ /// ``` fn email_value(tokenizer: &mut Tokenizer, code: Code, size: usize) -> StateFnResult { match code { @@ -301,8 +313,10 @@ fn email_value(tokenizer: &mut Tokenizer, code: Code, size: usize) -> StateFnRes /// At the `>`. /// /// ```markdown -/// a<https://example.com|>b -/// a<user@example.com|>b +/// > | a<https://example.com>b +/// ^ +/// > | a<user@example.com>b +/// ^ /// ``` fn end(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { match code { |