diff options
Diffstat (limited to '')
-rw-r--r-- | src/construct/blank_line.rs | 4 | ||||
-rw-r--r-- | src/construct/list_item.rs (renamed from src/construct/list.rs) | 42 | ||||
-rw-r--r-- | src/construct/mod.rs | 4 | ||||
-rw-r--r-- | src/construct/thematic_break.rs | 4 |
4 files changed, 27 insertions, 27 deletions
diff --git a/src/construct/blank_line.rs b/src/construct/blank_line.rs index 7f1d023..87d257d 100644 --- a/src/construct/blank_line.rs +++ b/src/construct/blank_line.rs @@ -12,7 +12,7 @@ //! such as between two [heading (atx)][heading-atx]s. //! Sometimes, whether blank lines are present, changes the behavior of how //! HTML is rendered, such as whether blank lines are present between list -//! items in a [list][]. +//! items in a [list][list-item]. //! More than one blank line is never needed in `CommonMark`. //! //! Because blank lines can be empty (line endings are not considered part of @@ -28,7 +28,7 @@ //! * [*ยง 4.9 Blank lines* in `CommonMark`](https://spec.commonmark.org/0.30/#blank-lines) //! //! [heading-atx]: crate::construct::heading_atx -//! [list]: crate::construct::list +//! [list-item]: crate::construct::list_item //! [paragraph]: crate::construct::paragraph //! [flow]: crate::content::flow diff --git a/src/construct/list.rs b/src/construct/list_item.rs index 596330c..5161254 100644 --- a/src/construct/list.rs +++ b/src/construct/list_item.rs @@ -1,4 +1,4 @@ -//! List is a construct that occurs in the [document][] content type. +//! List item is a construct that occurs in the [document][] content type. //! //! It forms with, roughly, the following BNF: //! @@ -62,11 +62,11 @@ use crate::util::{ /// ^ /// ``` pub fn start(tokenizer: &mut Tokenizer) -> State { - if tokenizer.parse_state.constructs.list { + if tokenizer.parse_state.constructs.list_item { tokenizer.enter(Name::ListItem); if matches!(tokenizer.current, Some(b'\t' | b' ')) { - tokenizer.attempt(State::Next(StateName::ListBefore), State::Nok); + tokenizer.attempt(State::Next(StateName::ListItemBefore), State::Nok); State::Retry(space_or_tab_min_max( tokenizer, 0, @@ -77,7 +77,7 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { }, )) } else { - State::Retry(StateName::ListBefore) + State::Retry(StateName::ListItemBefore) } } else { State::Nok @@ -93,16 +93,16 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { pub fn before(tokenizer: &mut Tokenizer) -> State { // Unordered. if matches!(tokenizer.current, Some(b'*' | b'-')) { - tokenizer.check(State::Nok, State::Next(StateName::ListBeforeUnordered)); + tokenizer.check(State::Nok, State::Next(StateName::ListItemBeforeUnordered)); State::Retry(StateName::ThematicBreakStart) } else if tokenizer.current == Some(b'+') { - State::Retry(StateName::ListBeforeUnordered) + State::Retry(StateName::ListItemBeforeUnordered) } // Ordered. else if tokenizer.current == Some(b'1') || (matches!(tokenizer.current, Some(b'0'..=b'9')) && !tokenizer.interrupt) { - State::Retry(StateName::ListBeforeOrdered) + State::Retry(StateName::ListItemBeforeOrdered) } else { State::Nok } @@ -118,7 +118,7 @@ pub fn before(tokenizer: &mut Tokenizer) -> State { /// ``` pub fn before_unordered(tokenizer: &mut Tokenizer) -> State { tokenizer.enter(Name::ListItemPrefix); - State::Retry(StateName::ListMarker) + State::Retry(StateName::ListItemMarker) } /// At ordered list item value. @@ -130,7 +130,7 @@ pub fn before_unordered(tokenizer: &mut Tokenizer) -> State { pub fn before_ordered(tokenizer: &mut Tokenizer) -> State { tokenizer.enter(Name::ListItemPrefix); tokenizer.enter(Name::ListItemValue); - State::Retry(StateName::ListValue) + State::Retry(StateName::ListItemValue) } /// In ordered list item value. @@ -144,13 +144,13 @@ pub fn value(tokenizer: &mut Tokenizer) -> State { && (!tokenizer.interrupt || tokenizer.tokenize_state.size < 2) { tokenizer.exit(Name::ListItemValue); - State::Retry(StateName::ListMarker) + State::Retry(StateName::ListItemMarker) } else if matches!(tokenizer.current, Some(b'0'..=b'9')) && tokenizer.tokenize_state.size + 1 < LIST_ITEM_VALUE_SIZE_MAX { tokenizer.tokenize_state.size += 1; tokenizer.consume(); - State::Next(StateName::ListValue) + State::Next(StateName::ListItemValue) } else { tokenizer.tokenize_state.size = 0; State::Nok @@ -169,7 +169,7 @@ pub fn marker(tokenizer: &mut Tokenizer) -> State { tokenizer.enter(Name::ListItemMarker); tokenizer.consume(); tokenizer.exit(Name::ListItemMarker); - State::Next(StateName::ListMarkerAfter) + State::Next(StateName::ListItemMarkerAfter) } /// After list item marker. @@ -183,8 +183,8 @@ pub fn marker(tokenizer: &mut Tokenizer) -> State { pub fn marker_after(tokenizer: &mut Tokenizer) -> State { tokenizer.tokenize_state.size = 1; tokenizer.check( - State::Next(StateName::ListAfter), - State::Next(StateName::ListMarkerAfterFilled), + State::Next(StateName::ListItemAfter), + State::Next(StateName::ListItemMarkerAfterFilled), ); State::Retry(StateName::BlankLineStart) } @@ -202,10 +202,10 @@ pub fn marker_after_filled(tokenizer: &mut Tokenizer) -> State { // Attempt to parse up to the largest allowed indent, `nok` if there is more whitespace. tokenizer.attempt( - State::Next(StateName::ListAfter), - State::Next(StateName::ListPrefixOther), + State::Next(StateName::ListItemAfter), + State::Next(StateName::ListItemPrefixOther), ); - State::Retry(StateName::ListWhitespace) + State::Retry(StateName::ListItemWhitespace) } /// After marker, at whitespace. @@ -215,7 +215,7 @@ pub fn marker_after_filled(tokenizer: &mut Tokenizer) -> State { /// ^ /// ``` pub fn whitespace(tokenizer: &mut Tokenizer) -> State { - tokenizer.attempt(State::Next(StateName::ListWhitespaceAfter), State::Nok); + tokenizer.attempt(State::Next(StateName::ListItemWhitespaceAfter), State::Nok); State::Retry(space_or_tab_min_max(tokenizer, 1, TAB_SIZE)) } @@ -245,7 +245,7 @@ pub fn prefix_other(tokenizer: &mut Tokenizer) -> State { tokenizer.enter(Name::SpaceOrTab); tokenizer.consume(); tokenizer.exit(Name::SpaceOrTab); - State::Next(StateName::ListAfter) + State::Next(StateName::ListItemAfter) } _ => State::Nok, } @@ -303,8 +303,8 @@ pub fn after(tokenizer: &mut Tokenizer) -> State { /// ``` pub fn cont_start(tokenizer: &mut Tokenizer) -> State { tokenizer.check( - State::Next(StateName::ListContBlank), - State::Next(StateName::ListContFilled), + State::Next(StateName::ListItemContBlank), + State::Next(StateName::ListItemContFilled), ); State::Retry(StateName::BlankLineStart) } diff --git a/src/construct/mod.rs b/src/construct/mod.rs index 0adf611..566bb30 100644 --- a/src/construct/mod.rs +++ b/src/construct/mod.rs @@ -32,7 +32,7 @@ //! * [label end][label_end] //! * [label start (image)][label_start_image] //! * [label start (link)][label_start_link] -//! * [list][] +//! * [list item][list_item] //! * [paragraph][] //! * [thematic break][thematic_break] //! @@ -84,7 +84,7 @@ pub mod html_text; pub mod label_end; pub mod label_start_image; pub mod label_start_link; -pub mod list; +pub mod list_item; pub mod paragraph; pub mod partial_bom; pub mod partial_data; diff --git a/src/construct/thematic_break.rs b/src/construct/thematic_break.rs index f493b96..1b581ea 100644 --- a/src/construct/thematic_break.rs +++ b/src/construct/thematic_break.rs @@ -20,7 +20,7 @@ //! As using more than three markers has no effect other than wasting space, //! it is recommended to use exactly three markers. //! Thematic breaks formed with asterisks or dashes can interfere with -//! [list][]s if there is whitespace between them: `* * *` and `- - -`. +//! [list][list-item]s if there is whitespace between them: `* * *` and `- - -`. //! For these reasons, it is recommend to not use spaces or tabs between the //! markers. //! Thematic breaks formed with dashes (without whitespace) can also form @@ -45,7 +45,7 @@ //! //! [flow]: crate::content::flow //! [heading_setext]: crate::construct::heading_setext -//! [list]: crate::construct::list +//! [list-item]: crate::construct::list_item //! [html]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-hr-element use super::partial_space_or_tab::{space_or_tab, space_or_tab_min_max}; |