aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/construct/attention.rs5
-rw-r--r--src/construct/heading_atx.rs3
-rw-r--r--src/construct/heading_setext.rs3
-rw-r--r--src/construct/label_end.rs6
-rw-r--r--src/construct/label_start_image.rs4
-rw-r--r--src/construct/label_start_link.rs4
-rw-r--r--src/construct/list.rs5
-rw-r--r--src/construct/paragraph.rs3
-rw-r--r--src/construct/partial_data.rs5
9 files changed, 22 insertions, 16 deletions
diff --git a/src/construct/attention.rs b/src/construct/attention.rs
index ac2ef25..6f91370 100644
--- a/src/construct/attention.rs
+++ b/src/construct/attention.rs
@@ -52,6 +52,7 @@
//! [html-strong]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-strong-element
use crate::event::{Event, Kind, Name, Point};
+use crate::resolve::Name as ResolveName;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
use crate::unicode::PUNCTUATION;
@@ -141,7 +142,7 @@ pub fn inside(tokenizer: &mut Tokenizer) -> State {
}
_ => {
tokenizer.exit(Name::AttentionSequence);
- tokenizer.register_resolver("attention".to_string(), Box::new(resolve_attention));
+ tokenizer.register_resolver(ResolveName::Attention);
tokenizer.tokenize_state.marker = b'\0';
State::Ok
}
@@ -150,7 +151,7 @@ pub fn inside(tokenizer: &mut Tokenizer) -> State {
/// Resolve attention sequences.
#[allow(clippy::too_many_lines)]
-fn resolve_attention(tokenizer: &mut Tokenizer) {
+pub fn resolve(tokenizer: &mut Tokenizer) {
let mut start = 0;
let mut balance = 0;
let mut sequences = vec![];
diff --git a/src/construct/heading_atx.rs b/src/construct/heading_atx.rs
index e856ac3..a114051 100644
--- a/src/construct/heading_atx.rs
+++ b/src/construct/heading_atx.rs
@@ -57,6 +57,7 @@
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, Name};
+use crate::resolve::Name as ResolveName;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
@@ -140,7 +141,7 @@ pub fn at_break(tokenizer: &mut Tokenizer) -> State {
match tokenizer.current {
None | Some(b'\n') => {
tokenizer.exit(Name::HeadingAtx);
- tokenizer.register_resolver("heading_atx".to_string(), Box::new(resolve));
+ tokenizer.register_resolver(ResolveName::HeadingAtx);
// Feel free to interrupt.
tokenizer.interrupt = false;
State::Ok
diff --git a/src/construct/heading_setext.rs b/src/construct/heading_setext.rs
index 3a24f9f..a3c513b 100644
--- a/src/construct/heading_setext.rs
+++ b/src/construct/heading_setext.rs
@@ -60,6 +60,7 @@
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;
@@ -160,7 +161,7 @@ pub fn after(tokenizer: &mut Tokenizer) -> State {
None | Some(b'\n') => {
// Feel free to interrupt.
tokenizer.interrupt = false;
- tokenizer.register_resolver("heading_setext".to_string(), Box::new(resolve));
+ tokenizer.register_resolver(ResolveName::HeadingSetext);
State::Ok
}
_ => State::Nok,
diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs
index 61f378d..f27d79f 100644
--- a/src/construct/label_end.rs
+++ b/src/construct/label_end.rs
@@ -149,9 +149,9 @@
use crate::constant::RESOURCE_DESTINATION_BALANCE_MAX;
use crate::construct::partial_space_or_tab::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::{Media, Tokenizer};
-
use crate::util::{
normalize_identifier::normalize_identifier,
skip,
@@ -331,7 +331,7 @@ pub fn ok(tokenizer: &mut Tokenizer) -> State {
});
tokenizer.tokenize_state.start = 0;
tokenizer.tokenize_state.end = 0;
- tokenizer.register_resolver_before("media".to_string(), Box::new(resolve_media));
+ tokenizer.register_resolver_before(ResolveName::Label);
State::Ok
}
@@ -614,7 +614,7 @@ pub fn reference_collapsed_open(tokenizer: &mut Tokenizer) -> State {
/// This turns correct label start (image, link) and label end into links and
/// images, or turns them back into data.
#[allow(clippy::too_many_lines)]
-pub fn resolve_media(tokenizer: &mut Tokenizer) {
+pub fn resolve(tokenizer: &mut Tokenizer) {
let mut left = tokenizer.tokenize_state.label_start_list_loose.split_off(0);
let mut left_2 = tokenizer.tokenize_state.label_start_stack.split_off(0);
let media = tokenizer.tokenize_state.media_list.split_off(0);
diff --git a/src/construct/label_start_image.rs b/src/construct/label_start_image.rs
index 2f7c0bf..e8aec8b 100644
--- a/src/construct/label_start_image.rs
+++ b/src/construct/label_start_image.rs
@@ -28,8 +28,8 @@
//! [label_end]: crate::construct::label_end
//! [html-img]: https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element
-use super::label_end::resolve_media;
use crate::event::Name;
+use crate::resolve::Name as ResolveName;
use crate::state::{Name as StateName, State};
use crate::tokenizer::{LabelStart, Tokenizer};
@@ -70,7 +70,7 @@ pub fn open(tokenizer: &mut Tokenizer) -> State {
balanced: false,
inactive: false,
});
- tokenizer.register_resolver_before("media".to_string(), Box::new(resolve_media));
+ tokenizer.register_resolver_before(ResolveName::Label);
State::Ok
}
_ => State::Nok,
diff --git a/src/construct/label_start_link.rs b/src/construct/label_start_link.rs
index 456a4e9..530d83e 100644
--- a/src/construct/label_start_link.rs
+++ b/src/construct/label_start_link.rs
@@ -27,8 +27,8 @@
//! [label_end]: crate::construct::label_end
//! [html-a]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element
-use super::label_end::resolve_media;
use crate::event::Name;
+use crate::resolve::Name as ResolveName;
use crate::state::State;
use crate::tokenizer::{LabelStart, Tokenizer};
@@ -52,7 +52,7 @@ pub fn start(tokenizer: &mut Tokenizer) -> State {
balanced: false,
inactive: false,
});
- tokenizer.register_resolver_before("media".to_string(), Box::new(resolve_media));
+ tokenizer.register_resolver_before(ResolveName::Label);
State::Ok
}
_ => State::Nok,
diff --git a/src/construct/list.rs b/src/construct/list.rs
index ded77d0..028e283 100644
--- a/src/construct/list.rs
+++ b/src/construct/list.rs
@@ -47,6 +47,7 @@
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::{
@@ -283,7 +284,7 @@ pub fn after(tokenizer: &mut Tokenizer) -> State {
container.size = prefix;
tokenizer.exit(Name::ListItemPrefix);
- tokenizer.register_resolver_before("list_item".to_string(), Box::new(resolve_list_item));
+ tokenizer.register_resolver_before(ResolveName::List);
State::Ok
}
}
@@ -355,7 +356,7 @@ pub fn nok(_tokenizer: &mut Tokenizer) -> State {
}
/// Find adjacent list items with the same marker.
-pub fn resolve_list_item(tokenizer: &mut Tokenizer) {
+pub fn resolve(tokenizer: &mut Tokenizer) {
let mut lists_wip: Vec<(u8, usize, usize, usize)> = vec![];
let mut lists: Vec<(u8, usize, usize, usize)> = vec![];
let mut index = 0;
diff --git a/src/construct/paragraph.rs b/src/construct/paragraph.rs
index b605c0f..acbee83 100644
--- a/src/construct/paragraph.rs
+++ b/src/construct/paragraph.rs
@@ -33,6 +33,7 @@
//! [html]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element
use crate::event::{Content, Kind, Name};
+use crate::resolve::Name as ResolveName;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
use crate::util::skip::opt as skip_opt;
@@ -65,7 +66,7 @@ pub fn inside(tokenizer: &mut Tokenizer) -> State {
None | Some(b'\n') => {
tokenizer.exit(Name::Data);
tokenizer.exit(Name::Paragraph);
- tokenizer.register_resolver_before("paragraph".to_string(), Box::new(resolve));
+ tokenizer.register_resolver_before(ResolveName::Paragraph);
// You’d be interrupting.
tokenizer.interrupt = true;
State::Ok
diff --git a/src/construct/partial_data.rs b/src/construct/partial_data.rs
index fda021e..f9b7947 100644
--- a/src/construct/partial_data.rs
+++ b/src/construct/partial_data.rs
@@ -7,6 +7,7 @@
//! [text]: crate::content::text
use crate::event::{Kind, Name};
+use crate::resolve::Name as ResolveName;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
@@ -44,7 +45,7 @@ pub fn at_break(tokenizer: &mut Tokenizer) -> State {
State::Next(StateName::DataAtBreak)
}
Some(byte) if tokenizer.tokenize_state.markers.contains(&byte) => {
- tokenizer.register_resolver_before("data".to_string(), Box::new(resolve_data));
+ tokenizer.register_resolver_before(ResolveName::Data);
State::Ok
}
_ => {
@@ -77,7 +78,7 @@ pub fn inside(tokenizer: &mut Tokenizer) -> State {
}
/// Merge adjacent data events.
-pub fn resolve_data(tokenizer: &mut Tokenizer) {
+pub fn resolve(tokenizer: &mut Tokenizer) {
let len = tokenizer.events.len();
let mut index = 0;