aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-19 17:09:16 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-19 17:09:16 +0200
commit5e6829c2fb79c2b7f59e38f924e2b2900c52b5d5 (patch)
treed5725002bd5b28b91edb9e6e41ce90c9f3d5063d /src/construct
parentdc6b4ac40a715d724ee597c995eb05ab30baa6e2 (diff)
downloadmarkdown-rs-5e6829c2fb79c2b7f59e38f924e2b2900c52b5d5.tar.gz
markdown-rs-5e6829c2fb79c2b7f59e38f924e2b2900c52b5d5.tar.bz2
markdown-rs-5e6829c2fb79c2b7f59e38f924e2b2900c52b5d5.zip
Refactor to move more things to `util/`
Diffstat (limited to 'src/construct')
-rw-r--r--src/construct/autolink.rs6
-rw-r--r--src/construct/block_quote.rs2
-rw-r--r--src/construct/character_reference.rs14
-rw-r--r--src/construct/code_fenced.rs6
-rw-r--r--src/construct/code_indented.rs2
-rw-r--r--src/construct/frontmatter.rs2
-rw-r--r--src/construct/heading_atx.rs2
-rw-r--r--src/construct/heading_setext.rs3
-rw-r--r--src/construct/html_flow.rs12
-rw-r--r--src/construct/html_text.rs2
-rw-r--r--src/construct/label_end.rs2
-rw-r--r--src/construct/list_item.rs2
-rw-r--r--src/construct/partial_label.rs4
-rw-r--r--src/construct/partial_whitespace.rs8
-rw-r--r--src/construct/thematic_break.rs2
15 files changed, 37 insertions, 32 deletions
diff --git a/src/construct/autolink.rs b/src/construct/autolink.rs
index b25dc32..4ecd580 100644
--- a/src/construct/autolink.rs
+++ b/src/construct/autolink.rs
@@ -116,15 +116,15 @@
//! [definition]: crate::construct::definition
//! [label_start_link]: crate::construct::label_start_link
//! [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
+//! [autolink_scheme_size_max]: crate::util::constant::AUTOLINK_SCHEME_SIZE_MAX
+//! [autolink_domain_size_max]: crate::util::constant::AUTOLINK_DOMAIN_SIZE_MAX
//! [sanitize_uri]: crate::util::sanitize_uri
//! [html_a]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element
-use crate::constant::{AUTOLINK_DOMAIN_SIZE_MAX, AUTOLINK_SCHEME_SIZE_MAX};
use crate::event::Name;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
+use crate::util::constant::{AUTOLINK_DOMAIN_SIZE_MAX, AUTOLINK_SCHEME_SIZE_MAX};
/// Start of autolink.
///
diff --git a/src/construct/block_quote.rs b/src/construct/block_quote.rs
index 8d7e227..039c839 100644
--- a/src/construct/block_quote.rs
+++ b/src/construct/block_quote.rs
@@ -46,11 +46,11 @@
//! [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
-use crate::constant::TAB_SIZE;
use crate::construct::partial_space_or_tab::space_or_tab_min_max;
use crate::event::Name;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
+use crate::util::constant::TAB_SIZE;
/// Start of block quote.
///
diff --git a/src/construct/character_reference.rs b/src/construct/character_reference.rs
index 3bdc636..4669836 100644
--- a/src/construct/character_reference.rs
+++ b/src/construct/character_reference.rs
@@ -65,17 +65,19 @@
//! [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
+//! [character_references]: crate::util::constant::CHARACTER_REFERENCES
//! [html]: https://html.spec.whatwg.org/multipage/parsing.html#character-reference-state
-use crate::constant::{
- CHARACTER_REFERENCES, CHARACTER_REFERENCE_DECIMAL_SIZE_MAX,
- CHARACTER_REFERENCE_HEXADECIMAL_SIZE_MAX, CHARACTER_REFERENCE_NAMED_SIZE_MAX,
-};
use crate::event::Name;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
-use crate::util::slice::Slice;
+use crate::util::{
+ constant::{
+ CHARACTER_REFERENCES, CHARACTER_REFERENCE_DECIMAL_SIZE_MAX,
+ CHARACTER_REFERENCE_HEXADECIMAL_SIZE_MAX, CHARACTER_REFERENCE_NAMED_SIZE_MAX,
+ },
+ slice::Slice,
+};
/// Start of character reference.
///
diff --git a/src/construct/code_fenced.rs b/src/construct/code_fenced.rs
index 748e38f..bfd15dc 100644
--- a/src/construct/code_fenced.rs
+++ b/src/construct/code_fenced.rs
@@ -110,12 +110,14 @@
//! [html_code]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-code-element
//! [html_pre]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element
-use crate::constant::{CODE_FENCED_SEQUENCE_SIZE_MIN, TAB_SIZE};
use crate::construct::partial_space_or_tab::{space_or_tab, space_or_tab_min_max};
use crate::event::{Content, Link, Name};
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
-use crate::util::slice::{Position, Slice};
+use crate::util::{
+ constant::{CODE_FENCED_SEQUENCE_SIZE_MIN, TAB_SIZE},
+ slice::{Position, Slice},
+};
/// Start of fenced code.
///
diff --git a/src/construct/code_indented.rs b/src/construct/code_indented.rs
index c5439f1..866c78e 100644
--- a/src/construct/code_indented.rs
+++ b/src/construct/code_indented.rs
@@ -53,11 +53,11 @@
//! [html_code]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-code-element
//! [html_pre]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element
-use crate::constant::TAB_SIZE;
use crate::construct::partial_space_or_tab::{space_or_tab, space_or_tab_min_max};
use crate::event::Name;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
+use crate::util::constant::TAB_SIZE;
/// Start of code (indented).
///
diff --git a/src/construct/frontmatter.rs b/src/construct/frontmatter.rs
index dc47bee..74006f6 100644
--- a/src/construct/frontmatter.rs
+++ b/src/construct/frontmatter.rs
@@ -56,11 +56,11 @@
//!
//! [constructs]: crate::Constructs
-use crate::constant::FRONTMATTER_SEQUENCE_SIZE;
use crate::construct::partial_space_or_tab::space_or_tab;
use crate::event::Name;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
+use crate::util::constant::FRONTMATTER_SEQUENCE_SIZE;
/// Start of frontmatter.
///
diff --git a/src/construct/heading_atx.rs b/src/construct/heading_atx.rs
index 4ff0143..dd09f74 100644
--- a/src/construct/heading_atx.rs
+++ b/src/construct/heading_atx.rs
@@ -62,12 +62,12 @@
//! [wiki_setext]: https://en.wikipedia.org/wiki/Setext
//! [atx]: http://www.aaronsw.com/2002/atx/
-use crate::constant::{HEADING_ATX_OPENING_FENCE_SIZE_MAX, TAB_SIZE};
use crate::construct::partial_space_or_tab::{space_or_tab, space_or_tab_min_max};
use crate::event::{Content, Event, Kind, Link, Name};
use crate::resolve::Name as ResolveName;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
+use crate::util::constant::{HEADING_ATX_OPENING_FENCE_SIZE_MAX, TAB_SIZE};
use alloc::vec;
/// Start of a heading (atx).
diff --git a/src/construct/heading_setext.rs b/src/construct/heading_setext.rs
index 3adeb38..19d2dda 100644
--- a/src/construct/heading_setext.rs
+++ b/src/construct/heading_setext.rs
@@ -69,13 +69,12 @@
//! [wiki_setext]: https://en.wikipedia.org/wiki/Setext
//! [atx]: http://www.aaronsw.com/2002/atx/
-use crate::constant::TAB_SIZE;
use crate::construct::partial_space_or_tab::{space_or_tab, space_or_tab_min_max};
use crate::event::{Kind, Name};
use crate::resolve::Name as ResolveName;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
-use crate::util::skip::opt_back as skip_opt_back;
+use crate::util::{constant::TAB_SIZE, skip::opt_back as skip_opt_back};
use alloc::vec;
/// At start of heading (setext) underline.
diff --git a/src/construct/html_flow.rs b/src/construct/html_flow.rs
index bd41aa9..edb500e 100644
--- a/src/construct/html_flow.rs
+++ b/src/construct/html_flow.rs
@@ -94,20 +94,20 @@
//! [flow]: crate::construct::flow
//! [html_text]: crate::construct::html_text
//! [paragraph]: crate::construct::paragraph
-//! [html_raw_names]: crate::constant::HTML_RAW_NAMES
-//! [html_block_names]: crate::constant::HTML_BLOCK_NAMES
+//! [html_raw_names]: crate::util::constant::HTML_RAW_NAMES
+//! [html_block_names]: crate::util::constant::HTML_BLOCK_NAMES
//! [html_parsing]: https://html.spec.whatwg.org/multipage/parsing.html#parsing
-use crate::constant::{
- HTML_BLOCK_NAMES, HTML_CDATA_PREFIX, HTML_RAW_NAMES, HTML_RAW_SIZE_MAX, TAB_SIZE,
-};
use crate::construct::partial_space_or_tab::{
space_or_tab_with_options, Options as SpaceOrTabOptions,
};
use crate::event::Name;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
-use crate::util::slice::Slice;
+use crate::util::{
+ constant::{HTML_BLOCK_NAMES, HTML_CDATA_PREFIX, HTML_RAW_NAMES, HTML_RAW_SIZE_MAX, TAB_SIZE},
+ slice::Slice,
+};
/// Symbol for `<script>` (condition 1).
const RAW: u8 = 1;
diff --git a/src/construct/html_text.rs b/src/construct/html_text.rs
index 26eded9..5aa6137 100644
--- a/src/construct/html_text.rs
+++ b/src/construct/html_text.rs
@@ -51,11 +51,11 @@
//! [html_flow]: crate::construct::html_flow
//! [html_parsing]: https://html.spec.whatwg.org/multipage/parsing.html#parsing
-use crate::constant::HTML_CDATA_PREFIX;
use crate::construct::partial_space_or_tab::space_or_tab;
use crate::event::Name;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
+use crate::util::constant::HTML_CDATA_PREFIX;
/// Start of HTML (text)
///
diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs
index 41f16d7..4532920 100644
--- a/src/construct/label_end.rs
+++ b/src/construct/label_end.rs
@@ -158,13 +158,13 @@
//! [html_a]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element
//! [html_img]: https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element
-use crate::constant::RESOURCE_DESTINATION_BALANCE_MAX;
use crate::construct::partial_space_or_tab_eol::space_or_tab_eol;
use crate::event::{Event, Kind, Name};
use crate::resolve::Name as ResolveName;
use crate::state::{Name as StateName, State};
use crate::tokenizer::{Label, LabelStart, Tokenizer};
use crate::util::{
+ constant::RESOURCE_DESTINATION_BALANCE_MAX,
normalize_identifier::normalize_identifier,
skip,
slice::{Position, Slice},
diff --git a/src/construct/list_item.rs b/src/construct/list_item.rs
index 13c287a..7228a00 100644
--- a/src/construct/list_item.rs
+++ b/src/construct/list_item.rs
@@ -58,13 +58,13 @@
//! [html_ul]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-ul-element
//! [commonmark_block]: https://spec.commonmark.org/0.30/#phase-1-block-structure
-use crate::constant::{LIST_ITEM_VALUE_SIZE_MAX, TAB_SIZE};
use crate::construct::partial_space_or_tab::space_or_tab_min_max;
use crate::event::{Kind, Name};
use crate::resolve::Name as ResolveName;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
use crate::util::{
+ constant::{LIST_ITEM_VALUE_SIZE_MAX, TAB_SIZE},
skip,
slice::{Position, Slice},
};
diff --git a/src/construct/partial_label.rs b/src/construct/partial_label.rs
index 1c1dcec..47ffd90 100644
--- a/src/construct/partial_label.rs
+++ b/src/construct/partial_label.rs
@@ -59,14 +59,14 @@
//! [label_start_link]: crate::construct::label_start_link
//! [label_end]: crate::construct::label_end
//! [code_text]: crate::construct::code_text
-//! [link_reference_size_max]: crate::constant::LINK_REFERENCE_SIZE_MAX
+//! [link_reference_size_max]: crate::util::constant::LINK_REFERENCE_SIZE_MAX
-use crate::constant::LINK_REFERENCE_SIZE_MAX;
use crate::construct::partial_space_or_tab_eol::{space_or_tab_eol_with_options, Options};
use crate::event::{Content, Link, Name};
use crate::state::{Name as StateName, State};
use crate::subtokenize::link;
use crate::tokenizer::Tokenizer;
+use crate::util::constant::LINK_REFERENCE_SIZE_MAX;
/// Start of label.
///
diff --git a/src/construct/partial_whitespace.rs b/src/construct/partial_whitespace.rs
index 707107d..bb25075 100644
--- a/src/construct/partial_whitespace.rs
+++ b/src/construct/partial_whitespace.rs
@@ -54,13 +54,15 @@
//! [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
+//! [hard_break_prefix_size_min]: crate::util::constant::HARD_BREAK_PREFIX_SIZE_MIN
//! [html]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-br-element
-use crate::constant::HARD_BREAK_PREFIX_SIZE_MIN;
use crate::event::{Event, Kind, Name};
use crate::tokenizer::Tokenizer;
-use crate::util::slice::{Position, Slice};
+use crate::util::{
+ constant::HARD_BREAK_PREFIX_SIZE_MIN,
+ slice::{Position, Slice},
+};
use alloc::vec;
/// Resolve whitespace.
diff --git a/src/construct/thematic_break.rs b/src/construct/thematic_break.rs
index 74fd961..f77f83e 100644
--- a/src/construct/thematic_break.rs
+++ b/src/construct/thematic_break.rs
@@ -56,11 +56,11 @@
//! [list-item]: crate::construct::list_item
//! [html]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-hr-element
-use crate::constant::{TAB_SIZE, THEMATIC_BREAK_MARKER_COUNT_MIN};
use crate::construct::partial_space_or_tab::{space_or_tab, space_or_tab_min_max};
use crate::event::Name;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
+use crate::util::constant::{TAB_SIZE, THEMATIC_BREAK_MARKER_COUNT_MIN};
/// Start of thematic break.
///