diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-15 11:40:40 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-15 11:40:40 +0200 |
commit | ee967aa634b5f8e9d30329d587538f1371a5da95 (patch) | |
tree | cdc1461c822e440b24428eb8d431881e216ab8bd | |
parent | 13135666fac476f3cd6f059147f496533b304097 (diff) | |
download | markdown-rs-ee967aa634b5f8e9d30329d587538f1371a5da95.tar.gz markdown-rs-ee967aa634b5f8e9d30329d587538f1371a5da95.tar.bz2 markdown-rs-ee967aa634b5f8e9d30329d587538f1371a5da95.zip |
Refactor to move `content` to `construct`
39 files changed, 130 insertions, 139 deletions
@@ -14,7 +14,6 @@ Crate docs are currently at ### Refactor -- [ ] (1) Move `content` to `construct` - [ ] (1) Improve `interrupt`, `concrete`, `lazy` fields somehow? - [ ] (?) Remove last box: the one around the child tokenizer? - [ ] (1) Add helper to get byte at, get char before/after, etc. diff --git a/src/construct/attention.rs b/src/construct/attention.rs index ae8da81..1dc8868 100644 --- a/src/construct/attention.rs +++ b/src/construct/attention.rs @@ -47,7 +47,7 @@ //! * [`attention.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/attention.js) //! * [*§ 6.2 Emphasis and strong emphasis* in `CommonMark`](https://spec.commonmark.org/0.30/#emphasis-and-strong-emphasis) //! -//! [text]: crate::content::text +//! [text]: crate::construct::text //! [html-em]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-em-element //! [html-strong]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-strong-element diff --git a/src/construct/autolink.rs b/src/construct/autolink.rs index 5c826a3..37e21d9 100644 --- a/src/construct/autolink.rs +++ b/src/construct/autolink.rs @@ -94,7 +94,7 @@ //! * [`autolink.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/autolink.js) //! * [*§ 6.4 Autolinks* in `CommonMark`](https://spec.commonmark.org/0.30/#autolinks) //! -//! [text]: crate::content::text +//! [text]: crate::construct::text //! [label_end]: crate::construct::label_end //! [autolink_scheme_size_max]: crate::constant::AUTOLINK_SCHEME_SIZE_MAX //! [autolink_domain_size_max]: crate::constant::AUTOLINK_DOMAIN_SIZE_MAX diff --git a/src/construct/blank_line.rs b/src/construct/blank_line.rs index 87d257d..928b8cc 100644 --- a/src/construct/blank_line.rs +++ b/src/construct/blank_line.rs @@ -30,7 +30,7 @@ //! [heading-atx]: crate::construct::heading_atx //! [list-item]: crate::construct::list_item //! [paragraph]: crate::construct::paragraph -//! [flow]: crate::content::flow +//! [flow]: crate::construct::flow use crate::construct::partial_space_or_tab::space_or_tab; use crate::state::{Name as StateName, State}; diff --git a/src/construct/block_quote.rs b/src/construct/block_quote.rs index 4f0870f..37726c5 100644 --- a/src/construct/block_quote.rs +++ b/src/construct/block_quote.rs @@ -29,7 +29,7 @@ //! * [`block-quote.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/block-quote.js) //! * [*§ 5.1 Block quotes* in `CommonMark`](https://spec.commonmark.org/0.30/#block-quotes) //! -//! [document]: crate::content::document +//! [document]: crate::construct::document //! [html-blockquote]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-blockquote-element //! [commonmark-block]: https://spec.commonmark.org/0.30/#phase-1-block-structure diff --git a/src/construct/character_escape.rs b/src/construct/character_escape.rs index ac91c29..6dac458 100644 --- a/src/construct/character_escape.rs +++ b/src/construct/character_escape.rs @@ -28,8 +28,8 @@ //! * [`character-escape.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/character-escape.js) //! * [*§ 2.4 Backslash escapes* in `CommonMark`](https://spec.commonmark.org/0.30/#backslash-escapes) //! -//! [string]: crate::content::string -//! [text]: crate::content::text +//! [string]: crate::construct::string +//! [text]: crate::construct::text //! [character_reference]: crate::construct::character_reference //! [hard_break_escape]: crate::construct::hard_break_escape diff --git a/src/construct/character_reference.rs b/src/construct/character_reference.rs index 7d7b6f9..7935109 100644 --- a/src/construct/character_reference.rs +++ b/src/construct/character_reference.rs @@ -54,8 +54,8 @@ //! * [`character-reference.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/character-reference.js) //! * [*§ 2.5 Entity and numeric character references* in `CommonMark`](https://spec.commonmark.org/0.30/#entity-and-numeric-character-references) //! -//! [string]: crate::content::string -//! [text]: crate::content::text +//! [string]: crate::construct::string +//! [text]: crate::construct::text //! [character_escape]: crate::construct::character_reference //! [decode_numeric]: crate::util::decode_character_reference::decode_numeric //! [character_references]: crate::constant::CHARACTER_REFERENCES diff --git a/src/construct/code_fenced.rs b/src/construct/code_fenced.rs index 74d6fe1..3812d44 100644 --- a/src/construct/code_fenced.rs +++ b/src/construct/code_fenced.rs @@ -91,9 +91,9 @@ //! * [`code-fenced.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/code-fenced.js) //! * [*§ 4.5 Fenced code blocks* in `CommonMark`](https://spec.commonmark.org/0.30/#fenced-code-blocks) //! -//! [flow]: crate::content::flow -//! [string]: crate::content::string -//! [text]: crate::content::text +//! [flow]: crate::construct::flow +//! [string]: crate::construct::string +//! [text]: crate::construct::text //! [code_indented]: crate::construct::code_indented //! [code_text]: crate::construct::code_text //! [character_escape]: crate::construct::character_escape diff --git a/src/construct/code_indented.rs b/src/construct/code_indented.rs index cf111f4..e3a5333 100644 --- a/src/construct/code_indented.rs +++ b/src/construct/code_indented.rs @@ -38,8 +38,8 @@ //! * [`code-indented.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/code-indented.js) //! * [*§ 4.4 Indented code blocks* in `CommonMark`](https://spec.commonmark.org/0.30/#indented-code-blocks) //! -//! [flow]: crate::content::flow -//! [text]: crate::content::text +//! [flow]: crate::construct::flow +//! [text]: crate::construct::text //! [code_text]: crate::construct::code_text //! [code_fenced]: crate::construct::code_fenced //! [html-pre]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element diff --git a/src/construct/code_text.rs b/src/construct/code_text.rs index d601583..7ebee96 100644 --- a/src/construct/code_text.rs +++ b/src/construct/code_text.rs @@ -77,8 +77,8 @@ //! * [`code-text.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/code-text.js) //! * [*§ 6.1 Code spans* in `CommonMark`](https://spec.commonmark.org/0.30/#code-spans) //! -//! [flow]: crate::content::flow -//! [text]: crate::content::text +//! [flow]: crate::construct::flow +//! [text]: crate::construct::text //! [code_indented]: crate::construct::code_indented //! [code_fenced]: crate::construct::code_fenced //! [html-code]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-code-element diff --git a/src/construct/definition.rs b/src/construct/definition.rs index e242e23..8f274ee 100644 --- a/src/construct/definition.rs +++ b/src/construct/definition.rs @@ -80,8 +80,8 @@ //! * [`definition.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/definition.js) //! * [*§ 4.7 Link reference definitions* in `CommonMark`](https://spec.commonmark.org/0.30/#link-reference-definitions) //! -//! [flow]: crate::content::flow -//! [string]: crate::content::string +//! [flow]: crate::construct::flow +//! [string]: crate::construct::string //! [character_escape]: crate::construct::character_escape //! [character_reference]: crate::construct::character_reference //! [label_end]: crate::construct::label_end diff --git a/src/content/document.rs b/src/construct/document.rs index 9def6c5..9def6c5 100644 --- a/src/content/document.rs +++ b/src/construct/document.rs diff --git a/src/content/flow.rs b/src/construct/flow.rs index 08c7891..08c7891 100644 --- a/src/content/flow.rs +++ b/src/construct/flow.rs diff --git a/src/construct/hard_break_escape.rs b/src/construct/hard_break_escape.rs index 79d8150..1fafa0b 100644 --- a/src/construct/hard_break_escape.rs +++ b/src/construct/hard_break_escape.rs @@ -33,7 +33,7 @@ //! * [`hard-break-escape.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/hard-break-escape.js) //! * [*§ 6.7 Hard line breaks* in `CommonMark`](https://spec.commonmark.org/0.30/#hard-line-breaks) //! -//! [text]: crate::content::text +//! [text]: crate::construct::text //! [character_escape]: crate::construct::character_escape //! [character_reference]: crate::construct::character_reference //! [hard_break_trailing]: crate::construct::partial_whitespace diff --git a/src/construct/heading_atx.rs b/src/construct/heading_atx.rs index 30c22f3..3bcff54 100644 --- a/src/construct/heading_atx.rs +++ b/src/construct/heading_atx.rs @@ -47,7 +47,7 @@ //! * [`heading-atx.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/heading-atx.js) //! * [*§ 4.2 ATX headings* in `CommonMark`](https://spec.commonmark.org/0.30/#atx-headings) //! -//! [flow]: crate::content::flow +//! [flow]: crate::construct::flow //! [heading_setext]: crate::construct::heading_setext //! [hard_break_escape]: crate::construct::hard_break_escape //! [html]: https://html.spec.whatwg.org/multipage/sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements diff --git a/src/construct/heading_setext.rs b/src/construct/heading_setext.rs index 1f6270a..043104a 100644 --- a/src/construct/heading_setext.rs +++ b/src/construct/heading_setext.rs @@ -49,7 +49,7 @@ //! * [`setext-underline.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/setext-underline.js) //! * [*§ 4.3 Setext headings* in `CommonMark`](https://spec.commonmark.org/0.30/#setext-headings) //! -//! [flow]: crate::content::flow +//! [flow]: crate::construct::flow //! [heading_atx]: crate::construct::heading_atx //! [thematic_break]: crate::construct::thematic_break //! [hard_break_escape]: crate::construct::hard_break_escape diff --git a/src/construct/html_flow.rs b/src/construct/html_flow.rs index e90abc4..38e33f8 100644 --- a/src/construct/html_flow.rs +++ b/src/construct/html_flow.rs @@ -91,7 +91,7 @@ //! * [`html-flow.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/html-flow.js) //! * [*§ 4.6 HTML blocks* in `CommonMark`](https://spec.commonmark.org/0.30/#html-blocks) //! -//! [flow]: crate::content::flow +//! [flow]: crate::construct::flow //! [html_text]: crate::construct::html_text //! [paragraph]: crate::construct::paragraph //! [html_raw_names]: crate::constant::HTML_RAW_NAMES diff --git a/src/construct/html_text.rs b/src/construct/html_text.rs index c3b0a65..fde0847 100644 --- a/src/construct/html_text.rs +++ b/src/construct/html_text.rs @@ -50,7 +50,7 @@ //! * [`html-text.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/html-text.js) //! * [*§ 6.6 Raw HTML* in `CommonMark`](https://spec.commonmark.org/0.30/#raw-html) //! -//! [text]: crate::content::text +//! [text]: crate::construct::text //! [html_flow]: crate::construct::html_flow //! [html-parsing]: https://html.spec.whatwg.org/multipage/parsing.html#parsing diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs index 5d8f17a..09716b7 100644 --- a/src/construct/label_end.rs +++ b/src/construct/label_end.rs @@ -132,8 +132,8 @@ //! * [*§ 6.3 Links* in `CommonMark`](https://spec.commonmark.org/0.30/#links) //! * [*§ 6.4 Images* in `CommonMark`](https://spec.commonmark.org/0.30/#images) //! -//! [string]: crate::content::string -//! [text]: crate::content::text +//! [string]: crate::construct::string +//! [text]: crate::construct::text //! [destination]: crate::construct::partial_destination //! [title]: crate::construct::partial_title //! [label]: crate::construct::partial_label diff --git a/src/construct/label_start_image.rs b/src/construct/label_start_image.rs index e6a75d3..ffc1aee 100644 --- a/src/construct/label_start_image.rs +++ b/src/construct/label_start_image.rs @@ -24,7 +24,7 @@ //! * [`label-start-image.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/label-start-image.js) //! * [*§ 6.4 Images* in `CommonMark`](https://spec.commonmark.org/0.30/#images) //! -//! [text]: crate::content::text +//! [text]: crate::construct::text //! [label_end]: crate::construct::label_end //! [html-img]: https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element diff --git a/src/construct/label_start_link.rs b/src/construct/label_start_link.rs index 7b6ac6e..dad6884 100644 --- a/src/construct/label_start_link.rs +++ b/src/construct/label_start_link.rs @@ -23,7 +23,7 @@ //! * [`label-start-link.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/label-start-link.js) //! * [*§ 6.3 Links* in `CommonMark`](https://spec.commonmark.org/0.30/#links) //! -//! [text]: crate::content::text +//! [text]: crate::construct::text //! [label_end]: crate::construct::label_end //! [html-a]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element diff --git a/src/construct/list_item.rs b/src/construct/list_item.rs index 5161254..a70906a 100644 --- a/src/construct/list_item.rs +++ b/src/construct/list_item.rs @@ -38,7 +38,7 @@ //! * [*§ 5.2 List items* in `CommonMark`](https://spec.commonmark.org/0.30/#list-items) //! * [*§ 5.3 Lists* in `CommonMark`](https://spec.commonmark.org/0.30/#lists) //! -//! [document]: crate::content::document +//! [document]: crate::construct::document //! [html-li]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-li-element //! [html-ol]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element //! [html-ul]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-ul-element diff --git a/src/construct/mod.rs b/src/construct/mod.rs index 566bb30..49868e9 100644 --- a/src/construct/mod.rs +++ b/src/construct/mod.rs @@ -76,6 +76,8 @@ pub mod code_fenced; pub mod code_indented; pub mod code_text; pub mod definition; +pub mod document; +pub mod flow; pub mod hard_break_escape; pub mod heading_atx; pub mod heading_setext; @@ -95,4 +97,6 @@ pub mod partial_space_or_tab; pub mod partial_space_or_tab_eol; pub mod partial_title; pub mod partial_whitespace; +pub mod string; +pub mod text; pub mod thematic_break; diff --git a/src/construct/paragraph.rs b/src/construct/paragraph.rs index b33346a..5f89ef9 100644 --- a/src/construct/paragraph.rs +++ b/src/construct/paragraph.rs @@ -26,8 +26,8 @@ //! * [`content.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/content.js) //! * [*§ 4.8 Paragraphs* in `CommonMark`](https://spec.commonmark.org/0.30/#paragraphs) //! -//! [flow]: crate::content::flow -//! [text]: crate::content::text +//! [flow]: crate::construct::flow +//! [text]: crate::construct::text //! [autolink]: crate::construct::autolink //! [code_text]: crate::construct::code_text //! [html]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element diff --git a/src/construct/partial_data.rs b/src/construct/partial_data.rs index 86e48c7..3ffa646 100644 --- a/src/construct/partial_data.rs +++ b/src/construct/partial_data.rs @@ -3,8 +3,8 @@ //! It can include anything (including line endings), and stops at certain //! characters. //! -//! [string]: crate::content::string -//! [text]: crate::content::text +//! [string]: crate::construct::string +//! [text]: crate::construct::text use crate::event::{Kind, Name}; use crate::resolve::Name as ResolveName; diff --git a/src/construct/partial_destination.rs b/src/construct/partial_destination.rs index d2477ab..b5254d3 100644 --- a/src/construct/partial_destination.rs +++ b/src/construct/partial_destination.rs @@ -65,7 +65,7 @@ //! * [`micromark-factory-destination/index.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-factory-destination/dev/index.js) //! //! [definition]: crate::construct::definition -//! [string]: crate::content::string +//! [string]: crate::construct::string //! [character_escape]: crate::construct::character_escape //! [character_reference]: crate::construct::character_reference //! [label_end]: crate::construct::label_end diff --git a/src/construct/partial_label.rs b/src/construct/partial_label.rs index 20a7b15..00d613a 100644 --- a/src/construct/partial_label.rs +++ b/src/construct/partial_label.rs @@ -48,7 +48,7 @@ //! * [`micromark-factory-label/index.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-factory-label/dev/index.js) //! //! [definition]: crate::construct::definition -//! [string]: crate::content::string +//! [string]: crate::construct::string //! [attention]: crate::construct::attention //! [character_escape]: crate::construct::character_escape //! [character_reference]: crate::construct::character_reference diff --git a/src/construct/partial_non_lazy_continuation.rs b/src/construct/partial_non_lazy_continuation.rs index 3bbf7cc..5eec71f 100644 --- a/src/construct/partial_non_lazy_continuation.rs +++ b/src/construct/partial_non_lazy_continuation.rs @@ -5,7 +5,7 @@ //! For example, [html (flow)][html_flow] and code ([fenced][code_fenced], //! [indented][code_indented]), stop when next line is lazy. //! -//! [flow]: crate::content::flow +//! [flow]: crate::construct::flow //! [code_fenced]: crate::construct::code_fenced //! [code_indented]: crate::construct::code_indented //! [html_flow]: crate::construct::html_flow diff --git a/src/construct/partial_title.rs b/src/construct/partial_title.rs index f0c4931..50d26be 100644 --- a/src/construct/partial_title.rs +++ b/src/construct/partial_title.rs @@ -25,7 +25,7 @@ //! * [`micromark-factory-title/index.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-factory-title/dev/index.js) //! //! [definition]: crate::construct::definition -//! [string]: crate::content::string +//! [string]: crate::construct::string //! [character_escape]: crate::construct::character_escape //! [character_reference]: crate::construct::character_reference //! [label_end]: crate::construct::label_end diff --git a/src/construct/partial_whitespace.rs b/src/construct/partial_whitespace.rs index 7152881..bf06df9 100644 --- a/src/construct/partial_whitespace.rs +++ b/src/construct/partial_whitespace.rs @@ -38,8 +38,8 @@ //! * [`initialize/text.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark/dev/lib/initialize/text.js) //! * [*§ 6.7 Hard line breaks* in `CommonMark`](https://spec.commonmark.org/0.30/#hard-line-breaks) //! -//! [string]: crate::content::string -//! [text]: crate::content::text +//! [string]: crate::construct::string +//! [text]: crate::construct::text //! [hard_break_escape]: crate::construct::hard_break_escape //! [character_escape]: crate::construct::character_escape //! [hard_break_prefix_size_min]: crate::constant::HARD_BREAK_PREFIX_SIZE_MIN diff --git a/src/content/string.rs b/src/construct/string.rs index ec4fce2..698a51d 100644 --- a/src/content/string.rs +++ b/src/construct/string.rs @@ -10,7 +10,7 @@ //! * [Character escape][crate::construct::character_escape] //! * [Character reference][crate::construct::character_reference] //! -//! [text]: crate::content::text +//! [text]: crate::construct::text use crate::construct::partial_whitespace::resolve_whitespace; use crate::resolve::Name as ResolveName; diff --git a/src/content/text.rs b/src/construct/text.rs index 5c13dba..5c13dba 100644 --- a/src/content/text.rs +++ b/src/construct/text.rs diff --git a/src/construct/thematic_break.rs b/src/construct/thematic_break.rs index 1b581ea..9496d98 100644 --- a/src/construct/thematic_break.rs +++ b/src/construct/thematic_break.rs @@ -43,7 +43,7 @@ //! * [`thematic-break.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-core-commonmark/dev/lib/thematic-break.js) //! * [*§ 4.1 Thematic breaks* in `CommonMark`](https://spec.commonmark.org/0.30/#thematic-breaks) //! -//! [flow]: crate::content::flow +//! [flow]: crate::construct::flow //! [heading_setext]: crate::construct::heading_setext //! [list-item]: crate::construct::list_item //! [html]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-hr-element diff --git a/src/content/mod.rs b/src/content/mod.rs deleted file mode 100644 index af40cc0..0000000 --- a/src/content/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -//! Content types found in markdown. -//! -//! * [document][document] -//! * [flow][flow] -//! * [string][string] -//! * [text][text] - -pub mod document; -pub mod flow; -pub mod string; -pub mod text; diff --git a/src/event.rs b/src/event.rs index 8cdb959..09973e7 100644 --- a/src/event.rs +++ b/src/event.rs @@ -10,7 +10,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Content model**: /// [`AutolinkEmail`][Name::AutolinkEmail], /// [`AutolinkMarker`][Name::AutolinkMarker], @@ -84,7 +84,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [flow content][crate::content::flow] + /// [flow content][crate::construct::flow] /// * **Content model**: /// void /// * **Construct**: @@ -102,10 +102,10 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [document content][crate::content::document] + /// [document content][crate::construct::document] /// * **Content model**: /// [`BlockQuotePrefix`][Name::BlockQuotePrefix], - /// [flow content][crate::content::flow] + /// [flow content][crate::construct::flow] /// * **Construct**: /// [`block_quote`][crate::construct::block_quote] /// @@ -166,15 +166,15 @@ pub enum Name { /// * **Content model**: /// void /// * **Construct**: - /// [`document`][crate::content::document] + /// [`document`][crate::construct::document] ByteOrderMark, /// Whole character escape. /// /// ## Info /// /// * **Context**: - /// [string content][crate::content::string] or - /// [text content][crate::content::text] + /// [string content][crate::construct::string] or + /// [text content][crate::construct::text] /// * **Content model**: /// [`CharacterEscapeMarker`][Name::CharacterEscapeMarker], /// [`CharacterEscapeValue`][Name::CharacterEscapeValue] @@ -229,8 +229,8 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [string content][crate::content::string] or - /// [text content][crate::content::text] + /// [string content][crate::construct::string] or + /// [text content][crate::construct::text] /// * **Content model**: /// [`CharacterReferenceMarker`][Name::CharacterReferenceMarker], /// [`CharacterReferenceMarkerHexadecimal`][Name::CharacterReferenceMarkerHexadecimal], @@ -342,7 +342,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [flow content][crate::content::flow] + /// [flow content][crate::construct::flow] /// * **Content model**: /// [`CodeFencedFence`][Name::CodeFencedFence], /// [`CodeFlowChunk`][Name::CodeFlowChunk], @@ -393,7 +393,7 @@ pub enum Name { /// * **Context**: /// [`CodeFencedFence`][Name::CodeFencedFence] /// * **Content model**: - /// [string content][crate::content::string] + /// [string content][crate::construct::string] /// * **Construct**: /// [`code_fenced`][crate::construct::code_fenced] /// @@ -413,7 +413,7 @@ pub enum Name { /// * **Context**: /// [`CodeFencedFence`][Name::CodeFencedFence] /// * **Content model**: - /// [string content][crate::content::string] + /// [string content][crate::construct::string] /// * **Construct**: /// [`code_fenced`][crate::construct::code_fenced] /// @@ -479,7 +479,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [flow content][crate::content::flow] + /// [flow content][crate::construct::flow] /// * **Content model**: /// [`CodeFlowChunk`][Name::CodeFlowChunk], /// [`LineEnding`][Name::LineEnding], @@ -499,7 +499,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Content model**: /// [`CodeTextData`][Name::CodeTextData], /// [`CodeTextSequence`][Name::CodeTextSequence], @@ -555,8 +555,8 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [string content][crate::content::string], - /// [text content][crate::content::text] + /// [string content][crate::construct::string], + /// [text content][crate::construct::text] /// * **Content model**: /// void /// * **Construct**: @@ -574,7 +574,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [flow content][crate::content::flow] + /// [flow content][crate::construct::flow] /// * **Content model**: /// [`DefinitionMarker`][Name::DefinitionMarker], /// [`DefinitionLabel`][Name::DefinitionLabel], @@ -676,7 +676,7 @@ pub enum Name { /// [`DefinitionDestinationLiteral`][Name::DefinitionDestinationLiteral], /// [`DefinitionDestinationRaw`][Name::DefinitionDestinationRaw] /// * **Content model**: - /// [string content][crate::content::string] + /// [string content][crate::construct::string] /// * **Construct**: /// [`destination`][crate::construct::partial_destination] /// @@ -735,7 +735,7 @@ pub enum Name { /// * **Context**: /// [`DefinitionLabel`][Name::DefinitionLabel] /// * **Content model**: - /// [string content][crate::content::string] + /// [string content][crate::construct::string] /// * **Construct**: /// [`label`][crate::construct::partial_label] /// @@ -810,7 +810,7 @@ pub enum Name { /// * **Context**: /// [`DefinitionTitle`][Name::DefinitionTitle] /// * **Content model**: - /// [string content][crate::content::string] + /// [string content][crate::construct::string] /// * **Construct**: /// [`title`][crate::construct::partial_title] /// @@ -826,7 +826,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Content model**: /// [`EmphasisSequence`][Name::EmphasisSequence], /// [`EmphasisText`][Name::EmphasisText] @@ -865,7 +865,7 @@ pub enum Name { /// * **Context**: /// [`Emphasis`][Name::Emphasis] /// * **Content model**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Construct**: /// [`attention`][crate::construct::attention] /// @@ -881,7 +881,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Content model**: /// void /// * **Construct**: @@ -900,7 +900,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Content model**: /// void /// * **Construct**: @@ -919,7 +919,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [flow content][crate::content::flow] + /// [flow content][crate::construct::flow] /// * **Content model**: /// [`HeadingAtxSequence`][Name::HeadingAtxSequence], /// [`HeadingAtxText`][Name::HeadingAtxText], @@ -959,7 +959,7 @@ pub enum Name { /// * **Context**: /// [`HeadingAtx`][Name::HeadingAtx], /// * **Content model**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Construct**: /// [`heading_atx`][crate::construct::heading_atx] /// @@ -975,7 +975,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [flow content][crate::content::flow] + /// [flow content][crate::construct::flow] /// * **Content model**: /// [`HeadingSetextText`][Name::HeadingSetextText], /// [`HeadingSetextUnderline`][Name::HeadingSetextUnderline], @@ -1000,7 +1000,7 @@ pub enum Name { /// * **Context**: /// [`HeadingSetext`][Name::HeadingSetext] /// * **Content model**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Construct**: /// [`heading_setext`][crate::construct::heading_setext] /// @@ -1036,7 +1036,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [flow content][crate::content::flow] + /// [flow content][crate::construct::flow] /// * **Content model**: /// [`HtmlFlowData`][Name::HtmlFlowData], /// [`LineEnding`][Name::LineEnding], @@ -1074,7 +1074,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Content model**: /// [`HtmlTextData`][Name::HtmlTextData], /// [`LineEnding`][Name::LineEnding], @@ -1112,7 +1112,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Content model**: /// [`Label`][Name::Label], /// [`Resource`][Name::Resource], @@ -1263,7 +1263,7 @@ pub enum Name { /// * **Context**: /// [`Label`][Name::Label] /// * **Content model**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Construct**: /// [`label_end`][crate::construct::label_end] /// @@ -1302,7 +1302,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Content model**: /// [`Label`][Name::Label], /// [`Resource`][Name::Resource], @@ -1330,7 +1330,7 @@ pub enum Name { /// [`ListUnordered`][Name::ListUnordered], /// * **Content model**: /// [`ListItemPrefix`][Name::ListItemPrefix], - /// [flow content][crate::content::flow] + /// [flow content][crate::construct::flow] /// * **Construct**: /// [`list item`][crate::construct::list_item] /// @@ -1408,7 +1408,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [document content][crate::content::document] + /// [document content][crate::construct::document] /// * **Content model**: /// [`BlankLineEnding`][Name::BlankLineEnding], /// [`BlockQuotePrefix`][Name::BlockQuotePrefix], @@ -1432,7 +1432,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [document content][crate::content::document] + /// [document content][crate::construct::document] /// * **Content model**: /// [`BlankLineEnding`][Name::BlankLineEnding], /// [`BlockQuotePrefix`][Name::BlockQuotePrefix], @@ -1456,9 +1456,9 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [flow content][crate::content::flow] + /// [flow content][crate::construct::flow] /// * **Content model**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Construct**: /// [`paragraph`][crate::construct::paragraph] /// @@ -1516,7 +1516,7 @@ pub enum Name { /// * **Context**: /// [`Reference`][Name::Reference] /// * **Content model**: - /// [string content][crate::content::string] + /// [string content][crate::construct::string] /// * **Construct**: /// [`label`][crate::construct::partial_label] /// @@ -1634,7 +1634,7 @@ pub enum Name { /// [`ResourceDestinationLiteral`][Name::ResourceDestinationLiteral], /// [`ResourceDestinationRaw`][Name::ResourceDestinationRaw] /// * **Content model**: - /// [string content][crate::content::string] + /// [string content][crate::construct::string] /// * **Construct**: /// [`destination`][crate::construct::partial_destination] /// @@ -1709,7 +1709,7 @@ pub enum Name { /// * **Context**: /// [`ResourceTitle`][Name::ResourceTitle] /// * **Content model**: - /// [string content][crate::content::string] + /// [string content][crate::construct::string] /// * **Construct**: /// [`title`][crate::construct::partial_title] /// @@ -1743,7 +1743,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Content model**: /// [`StrongSequence`][Name::StrongSequence], /// [`StrongText`][Name::StrongText] @@ -1782,7 +1782,7 @@ pub enum Name { /// * **Context**: /// [`Strong`][Name::Strong] /// * **Content model**: - /// [text content][crate::content::text] + /// [text content][crate::construct::text] /// * **Construct**: /// [`attention`][crate::construct::attention] /// @@ -1798,7 +1798,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [flow content][crate::content::flow] + /// [flow content][crate::construct::flow] /// * **Content model**: /// [`ThematicBreakSequence`][Name::ThematicBreakSequence], /// [`SpaceOrTab`][Name::SpaceOrTab] @@ -1879,11 +1879,11 @@ pub const VOID_EVENTS: [Name; 40] = [ /// Embedded content type. #[derive(Debug, Clone, PartialEq)] pub enum Content { - /// Represents [flow content][crate::content::flow]. + /// Represents [flow content][crate::construct::flow]. Flow, - /// Represents [string content][crate::content::string]. + /// Represents [string content][crate::construct::string]. String, - /// Represents [text content][crate::content::text]. + /// Represents [text content][crate::construct::text]. Text, } @@ -7,7 +7,6 @@ mod compiler; mod constant; mod construct; -mod content; mod event; mod parser; mod resolve; diff --git a/src/resolve.rs b/src/resolve.rs index edc92b2..0bf62fe 100644 --- a/src/resolve.rs +++ b/src/resolve.rs @@ -1,5 +1,4 @@ use crate::construct; -use crate::content; use crate::tokenizer::Tokenizer; /// Names of functions that resolve. @@ -26,8 +25,8 @@ pub fn call(tokenizer: &mut Tokenizer, name: Name) { Name::List => construct::list_item::resolve, Name::Paragraph => construct::paragraph::resolve, Name::Data => construct::partial_data::resolve, - Name::String => content::string::resolve, - Name::Text => content::text::resolve, + Name::String => construct::string::resolve, + Name::Text => construct::text::resolve, }; func(tokenizer); diff --git a/src/state.rs b/src/state.rs index 344a31e..105cade 100644 --- a/src/state.rs +++ b/src/state.rs @@ -1,5 +1,4 @@ use crate::construct; -use crate::content; use crate::tokenizer::Tokenizer; /// The result of a state. @@ -391,31 +390,33 @@ pub fn call(tokenizer: &mut Tokenizer, name: Name) -> State { Name::DestinationRaw => construct::partial_destination::raw, Name::DestinationRawEscape => construct::partial_destination::raw_escape, - Name::DocumentStart => content::document::start, - Name::DocumentContainerExistingBefore => content::document::container_existing_before, - Name::DocumentContainerExistingAfter => content::document::container_existing_after, - Name::DocumentContainerNewBefore => content::document::container_new_before, + Name::DocumentStart => construct::document::start, + Name::DocumentContainerExistingBefore => construct::document::container_existing_before, + Name::DocumentContainerExistingAfter => construct::document::container_existing_after, + Name::DocumentContainerNewBefore => construct::document::container_new_before, Name::DocumentContainerNewBeforeNotBlockQuote => { - content::document::container_new_before_not_block_quote + construct::document::container_new_before_not_block_quote } - Name::DocumentContainerNewBeforeNotList => content::document::container_new_before_not_list, - Name::DocumentContainerNewAfter => content::document::container_new_after, - Name::DocumentContainersAfter => content::document::containers_after, - Name::DocumentFlowEnd => content::document::flow_end, - Name::DocumentFlowInside => content::document::flow_inside, - - Name::FlowStart => content::flow::start, - Name::FlowBeforeCodeIndented => content::flow::before_code_indented, - Name::FlowBeforeCodeFenced => content::flow::before_code_fenced, - Name::FlowBeforeHtml => content::flow::before_html, - Name::FlowBeforeHeadingAtx => content::flow::before_heading_atx, - Name::FlowBeforeHeadingSetext => content::flow::before_heading_setext, - Name::FlowBeforeThematicBreak => content::flow::before_thematic_break, - Name::FlowBeforeDefinition => content::flow::before_definition, - Name::FlowAfter => content::flow::after, - Name::FlowBlankLineBefore => content::flow::blank_line_before, - Name::FlowBlankLineAfter => content::flow::blank_line_after, - Name::FlowBeforeParagraph => content::flow::before_paragraph, + Name::DocumentContainerNewBeforeNotList => { + construct::document::container_new_before_not_list + } + Name::DocumentContainerNewAfter => construct::document::container_new_after, + Name::DocumentContainersAfter => construct::document::containers_after, + Name::DocumentFlowEnd => construct::document::flow_end, + Name::DocumentFlowInside => construct::document::flow_inside, + + Name::FlowStart => construct::flow::start, + Name::FlowBeforeCodeIndented => construct::flow::before_code_indented, + Name::FlowBeforeCodeFenced => construct::flow::before_code_fenced, + Name::FlowBeforeHtml => construct::flow::before_html, + Name::FlowBeforeHeadingAtx => construct::flow::before_heading_atx, + Name::FlowBeforeHeadingSetext => construct::flow::before_heading_setext, + Name::FlowBeforeThematicBreak => construct::flow::before_thematic_break, + Name::FlowBeforeDefinition => construct::flow::before_definition, + Name::FlowAfter => construct::flow::after, + Name::FlowBlankLineBefore => construct::flow::blank_line_before, + Name::FlowBlankLineAfter => construct::flow::blank_line_after, + Name::FlowBeforeParagraph => construct::flow::before_paragraph, Name::HardBreakEscapeStart => construct::hard_break_escape::start, Name::HardBreakEscapeAfter => construct::hard_break_escape::after, @@ -584,15 +585,15 @@ pub fn call(tokenizer: &mut Tokenizer, name: Name) -> State { Name::SpaceOrTabEolAtEol => construct::partial_space_or_tab_eol::at_eol, Name::SpaceOrTabEolAfterMore => construct::partial_space_or_tab_eol::after_more, - Name::StringStart => content::string::start, - Name::StringBefore => content::string::before, - Name::StringBeforeData => content::string::before_data, + Name::StringStart => construct::string::start, + Name::StringBefore => construct::string::before, + Name::StringBeforeData => construct::string::before_data, - Name::TextStart => content::text::start, - Name::TextBefore => content::text::before, - Name::TextBeforeHtml => content::text::before_html, - Name::TextBeforeHardBreakEscape => content::text::before_hard_break_escape, - Name::TextBeforeData => content::text::before_data, + Name::TextStart => construct::text::start, + Name::TextBefore => construct::text::before, + Name::TextBeforeHtml => construct::text::before_html, + Name::TextBeforeHardBreakEscape => construct::text::before_hard_break_escape, + Name::TextBeforeData => construct::text::before_data, Name::ThematicBreakStart => construct::thematic_break::start, Name::ThematicBreakBefore => construct::thematic_break::before, diff --git a/src/tokenizer.rs b/src/tokenizer.rs index dcd34ac..5b5e311 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -154,15 +154,15 @@ pub struct TokenizeState<'a> { // Couple of media related fields. /// List of usable label starts. /// - /// Used when tokenizing [text content][crate::content::text]. + /// Used when tokenizing [text content][crate::construct::text]. pub label_starts: Vec<LabelStart>, /// List of unusable label starts. /// - /// Used when tokenizing [text content][crate::content::text]. + /// Used when tokenizing [text content][crate::construct::text]. pub label_starts_loose: Vec<LabelStart>, /// Stack of images and links. /// - /// Used when tokenizing [text content][crate::content::text]. + /// Used when tokenizing [text content][crate::construct::text]. pub labels: Vec<Label>, /// List of defined identifiers. @@ -239,11 +239,11 @@ pub struct Tokenizer<'a> { pub tokenize_state: TokenizeState<'a>, /// Whether we would be interrupting something. /// - /// Used when tokenizing [flow content][crate::content::flow]. + /// Used when tokenizing [flow content][crate::construct::flow]. pub interrupt: bool, /// Whether containers cannot “pierce” into the current construct. /// - /// Used when tokenizing [document content][crate::content::document]. + /// Used when tokenizing [document content][crate::construct::document]. pub concrete: bool, /// Whether this line is lazy. /// |