diff options
32 files changed, 542 insertions, 526 deletions
diff --git a/src/compiler.rs b/src/compiler.rs index a2a43b0..8f3036a 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -270,7 +270,7 @@ fn handle(context: &mut CompileContext, index: usize) { } } -/// Handle [`Enter`][EventType::Enter]. +/// Handle [`Enter`][Kind::Enter]. fn enter(context: &mut CompileContext) { match context.events[context.index].name { Name::CodeFencedFenceInfo @@ -304,7 +304,7 @@ fn enter(context: &mut CompileContext) { } } -/// Handle [`Exit`][EventType::Exit]. +/// Handle [`Exit`][Kind::Exit]. fn exit(context: &mut CompileContext) { match context.events[context.index].name { Name::CodeFencedFenceMeta | Name::Resource => on_exit_drop(context), @@ -357,28 +357,28 @@ fn exit(context: &mut CompileContext) { } } -/// Handle [`Enter`][EventType::Enter]:`*`. +/// Handle [`Enter`][Kind::Enter]:`*`. /// /// Buffers data. fn on_enter_buffer(context: &mut CompileContext) { context.buffer(); } -/// Handle [`Enter`][EventType::Enter]:[`BlockQuote`][Token::BlockQuote]. +/// Handle [`Enter`][Kind::Enter]:[`BlockQuote`][Name::BlockQuote]. fn on_enter_block_quote(context: &mut CompileContext) { context.tight_stack.push(false); context.line_ending_if_needed(); context.push("<blockquote>"); } -/// Handle [`Enter`][EventType::Enter]:[`CodeIndented`][Token::CodeIndented]. +/// Handle [`Enter`][Kind::Enter]:[`CodeIndented`][Name::CodeIndented]. fn on_enter_code_indented(context: &mut CompileContext) { context.code_flow_seen_data = Some(false); context.line_ending_if_needed(); context.push("<pre><code>"); } -/// Handle [`Enter`][EventType::Enter]:[`CodeFenced`][Token::CodeFenced]. +/// Handle [`Enter`][Kind::Enter]:[`CodeFenced`][Name::CodeFenced]. fn on_enter_code_fenced(context: &mut CompileContext) { context.code_flow_seen_data = Some(false); context.line_ending_if_needed(); @@ -387,7 +387,7 @@ fn on_enter_code_fenced(context: &mut CompileContext) { context.code_fenced_fences_count = Some(0); } -/// Handle [`Enter`][EventType::Enter]:[`CodeText`][Token::CodeText]. +/// Handle [`Enter`][Kind::Enter]:[`CodeText`][Name::CodeText]. fn on_enter_code_text(context: &mut CompileContext) { context.code_text_inside = true; if !context.in_image_alt { @@ -396,7 +396,7 @@ fn on_enter_code_text(context: &mut CompileContext) { context.buffer(); } -/// Handle [`Enter`][EventType::Enter]:[`Definition`][Token::Definition]. +/// Handle [`Enter`][Kind::Enter]:[`Definition`][Name::Definition]. fn on_enter_definition(context: &mut CompileContext) { context.buffer(); context.media_stack.push(Media { @@ -409,20 +409,20 @@ fn on_enter_definition(context: &mut CompileContext) { }); } -/// Handle [`Enter`][EventType::Enter]:[`DefinitionDestinationString`][Token::DefinitionDestinationString]. +/// Handle [`Enter`][Kind::Enter]:[`DefinitionDestinationString`][Name::DefinitionDestinationString]. fn on_enter_definition_destination_string(context: &mut CompileContext) { context.buffer(); context.encode_html = false; } -/// Handle [`Enter`][EventType::Enter]:[`Emphasis`][Token::Emphasis]. +/// Handle [`Enter`][Kind::Enter]:[`Emphasis`][Name::Emphasis]. fn on_enter_emphasis(context: &mut CompileContext) { if !context.in_image_alt { context.push("<em>"); } } -/// Handle [`Enter`][EventType::Enter]:[`HtmlFlow`][Token::HtmlFlow]. +/// Handle [`Enter`][Kind::Enter]:[`HtmlFlow`][Name::HtmlFlow]. fn on_enter_html_flow(context: &mut CompileContext) { context.line_ending_if_needed(); if context.allow_dangerous_html { @@ -430,14 +430,14 @@ fn on_enter_html_flow(context: &mut CompileContext) { } } -/// Handle [`Enter`][EventType::Enter]:[`HtmlText`][Token::HtmlText]. +/// Handle [`Enter`][Kind::Enter]:[`HtmlText`][Name::HtmlText]. fn on_enter_html_text(context: &mut CompileContext) { if context.allow_dangerous_html { context.encode_html = false; } } -/// Handle [`Enter`][EventType::Enter]:[`Image`][Token::Image]. +/// Handle [`Enter`][Kind::Enter]:[`Image`][Name::Image]. fn on_enter_image(context: &mut CompileContext) { context.media_stack.push(Media { image: true, @@ -450,7 +450,7 @@ fn on_enter_image(context: &mut CompileContext) { context.in_image_alt = true; // Disallow tags. } -/// Handle [`Enter`][EventType::Enter]:[`Link`][Token::Link]. +/// Handle [`Enter`][Kind::Enter]:[`Link`][Name::Link]. fn on_enter_link(context: &mut CompileContext) { context.media_stack.push(Media { image: false, @@ -462,7 +462,7 @@ fn on_enter_link(context: &mut CompileContext) { }); } -/// Handle [`Enter`][EventType::Enter]:{[`ListOrdered`][Token::ListOrdered],[`ListUnordered`][Token::ListUnordered]}. +/// Handle [`Enter`][Kind::Enter]:{[`ListOrdered`][Name::ListOrdered],[`ListUnordered`][Name::ListUnordered]}. fn on_enter_list(context: &mut CompileContext) { let events = &context.events; let mut index = context.index; @@ -560,7 +560,7 @@ fn on_enter_list(context: &mut CompileContext) { context.expect_first_item = Some(true); } -/// Handle [`Enter`][EventType::Enter]:[`ListItemMarker`][Token::ListItemMarker]. +/// Handle [`Enter`][Kind::Enter]:[`ListItemMarker`][Name::ListItemMarker]. fn on_enter_list_item_marker(context: &mut CompileContext) { let expect_first_item = context.expect_first_item.take().unwrap(); @@ -574,7 +574,7 @@ fn on_enter_list_item_marker(context: &mut CompileContext) { context.expect_first_item = Some(false); } -/// Handle [`Enter`][EventType::Enter]:[`Paragraph`][Token::Paragraph]. +/// Handle [`Enter`][Kind::Enter]:[`Paragraph`][Name::Paragraph]. fn on_enter_paragraph(context: &mut CompileContext) { let tight = context.tight_stack.last().unwrap_or(&false); @@ -584,13 +584,13 @@ fn on_enter_paragraph(context: &mut CompileContext) { } } -/// Handle [`Enter`][EventType::Enter]:[`Resource`][Token::Resource]. +/// Handle [`Enter`][Kind::Enter]:[`Resource`][Name::Resource]. fn on_enter_resource(context: &mut CompileContext) { context.buffer(); // We can have line endings in the resource, ignore them. context.media_stack.last_mut().unwrap().destination = Some("".to_string()); } -/// Handle [`Enter`][EventType::Enter]:[`ResourceDestinationString`][Token::ResourceDestinationString]. +/// Handle [`Enter`][Kind::Enter]:[`ResourceDestinationString`][Name::ResourceDestinationString]. fn on_enter_resource_destination_string(context: &mut CompileContext) { context.buffer(); // Ignore encoding the result, as we’ll first percent encode the url and @@ -598,14 +598,14 @@ fn on_enter_resource_destination_string(context: &mut CompileContext) { context.encode_html = false; } -/// Handle [`Enter`][EventType::Enter]:[`Strong`][Token::Strong]. +/// Handle [`Enter`][Kind::Enter]:[`Strong`][Name::Strong]. fn on_enter_strong(context: &mut CompileContext) { if !context.in_image_alt { context.push("<strong>"); } } -/// Handle [`Exit`][EventType::Exit]:[`AutolinkEmail`][Token::AutolinkEmail]. +/// Handle [`Exit`][Kind::Exit]:[`AutolinkEmail`][Name::AutolinkEmail]. fn on_exit_autolink_email(context: &mut CompileContext) { let slice = Slice::from_position( context.bytes, @@ -629,7 +629,7 @@ fn on_exit_autolink_email(context: &mut CompileContext) { } } -/// Handle [`Exit`][EventType::Exit]:[`AutolinkProtocol`][Token::AutolinkProtocol]. +/// Handle [`Exit`][Kind::Exit]:[`AutolinkProtocol`][Name::AutolinkProtocol]. fn on_exit_autolink_protocol(context: &mut CompileContext) { let slice = Slice::from_position( context.bytes, @@ -650,21 +650,21 @@ fn on_exit_autolink_protocol(context: &mut CompileContext) { } } -/// Handle [`Exit`][EventType::Exit]:{[`HardBreakEscape`][Token::HardBreakEscape],[`HardBreakTrailing`][Token::HardBreakTrailing]}. +/// Handle [`Exit`][Kind::Exit]:{[`HardBreakEscape`][Name::HardBreakEscape],[`HardBreakTrailing`][Name::HardBreakTrailing]}. fn on_exit_break(context: &mut CompileContext) { if !context.in_image_alt { context.push("<br />"); } } -/// Handle [`Exit`][EventType::Exit]:[`BlankLineEnding`][Token::BlankLineEnding]. +/// Handle [`Exit`][Kind::Exit]:[`BlankLineEnding`][Name::BlankLineEnding]. fn on_exit_blank_line_ending(context: &mut CompileContext) { if context.index == context.events.len() - 1 { context.line_ending_if_needed(); } } -/// Handle [`Exit`][EventType::Exit]:[`BlockQuote`][Token::BlockQuote]. +/// Handle [`Exit`][Kind::Exit]:[`BlockQuote`][Name::BlockQuote]. fn on_exit_block_quote(context: &mut CompileContext) { context.tight_stack.pop(); context.line_ending_if_needed(); @@ -672,22 +672,22 @@ fn on_exit_block_quote(context: &mut CompileContext) { context.push("</blockquote>"); } -/// Handle [`Exit`][EventType::Exit]:[`CharacterReferenceMarker`][Token::CharacterReferenceMarker]. +/// Handle [`Exit`][Kind::Exit]:[`CharacterReferenceMarker`][Name::CharacterReferenceMarker]. fn on_exit_character_reference_marker(context: &mut CompileContext) { context.character_reference_marker = Some(b'&'); } -/// Handle [`Exit`][EventType::Exit]:[`CharacterReferenceMarkerHexadecimal`][Token::CharacterReferenceMarkerHexadecimal]. +/// Handle [`Exit`][Kind::Exit]:[`CharacterReferenceMarkerHexadecimal`][Name::CharacterReferenceMarkerHexadecimal]. fn on_exit_character_reference_marker_hexadecimal(context: &mut CompileContext) { context.character_reference_marker = Some(b'x'); } -/// Handle [`Exit`][EventType::Exit]:[`CharacterReferenceMarkerNumeric`][Token::CharacterReferenceMarkerNumeric]. +/// Handle [`Exit`][Kind::Exit]:[`CharacterReferenceMarkerNumeric`][Name::CharacterReferenceMarkerNumeric]. fn on_exit_character_reference_marker_numeric(context: &mut CompileContext) { context.character_reference_marker = Some(b'#'); } -/// Handle [`Exit`][EventType::Exit]:[`CharacterReferenceValue`][Token::CharacterReferenceValue]. +/// Handle [`Exit`][Kind::Exit]:[`CharacterReferenceValue`][Name::CharacterReferenceValue]. fn on_exit_character_reference_value(context: &mut CompileContext) { let marker = context .character_reference_marker @@ -709,7 +709,7 @@ fn on_exit_character_reference_value(context: &mut CompileContext) { context.push(&encode(&value, context.encode_html)); } -/// Handle [`Exit`][EventType::Exit]:[`CodeFlowChunk`][Token::CodeFlowChunk]. +/// Handle [`Exit`][Kind::Exit]:[`CodeFlowChunk`][Name::CodeFlowChunk]. fn on_exit_code_flow_chunk(context: &mut CompileContext) { context.code_flow_seen_data = Some(true); context.push(&encode( @@ -723,7 +723,7 @@ fn on_exit_code_flow_chunk(context: &mut CompileContext) { )); } -/// Handle [`Exit`][EventType::Exit]:[`CodeFencedFence`][Token::CodeFencedFence]. +/// Handle [`Exit`][Kind::Exit]:[`CodeFencedFence`][Name::CodeFencedFence]. fn on_exit_code_fenced_fence(context: &mut CompileContext) { let count = if let Some(count) = context.code_fenced_fences_count { count @@ -739,7 +739,7 @@ fn on_exit_code_fenced_fence(context: &mut CompileContext) { context.code_fenced_fences_count = Some(count + 1); } -/// Handle [`Exit`][EventType::Exit]:[`CodeFencedFenceInfo`][Token::CodeFencedFenceInfo]. +/// Handle [`Exit`][Kind::Exit]:[`CodeFencedFenceInfo`][Name::CodeFencedFenceInfo]. fn on_exit_code_fenced_fence_info(context: &mut CompileContext) { let value = context.resume(); context.push(" class=\"language-"); @@ -747,7 +747,7 @@ fn on_exit_code_fenced_fence_info(context: &mut CompileContext) { context.push("\""); } -/// Handle [`Exit`][EventType::Exit]:{[`CodeFenced`][Token::CodeFenced],[`CodeIndented`][Token::CodeIndented]}. +/// Handle [`Exit`][Kind::Exit]:{[`CodeFenced`][Name::CodeFenced],[`CodeIndented`][Name::CodeIndented]}. fn on_exit_code_flow(context: &mut CompileContext) { let seen_data = context .code_flow_seen_data @@ -788,7 +788,7 @@ fn on_exit_code_flow(context: &mut CompileContext) { context.slurp_one_line_ending = false; } -/// Handle [`Exit`][EventType::Exit]:[`CodeText`][Token::CodeText]. +/// Handle [`Exit`][Kind::Exit]:[`CodeText`][Name::CodeText]. fn on_exit_code_text(context: &mut CompileContext) { let result = context.resume(); let mut bytes = result.as_bytes(); @@ -820,14 +820,14 @@ fn on_exit_code_text(context: &mut CompileContext) { } } -/// Handle [`Exit`][EventType::Exit]:*. +/// Handle [`Exit`][Kind::Exit]:*. /// /// Resumes, and ignores what was resumed. fn on_exit_drop(context: &mut CompileContext) { context.resume(); } -/// Handle [`Exit`][EventType::Exit]:{[`CodeTextData`][Token::CodeTextData],[`Data`][Token::Data],[`CharacterEscapeValue`][Token::CharacterEscapeValue]}. +/// Handle [`Exit`][Kind::Exit]:{[`CodeTextData`][Name::CodeTextData],[`Data`][Name::Data],[`CharacterEscapeValue`][Name::CharacterEscapeValue]}. fn on_exit_data(context: &mut CompileContext) { context.push(&encode( Slice::from_position( @@ -839,7 +839,7 @@ fn on_exit_data(context: &mut CompileContext) { )); } -/// Handle [`Exit`][EventType::Exit]:[`Definition`][Token::Definition]. +/// Handle [`Exit`][Kind::Exit]:[`Definition`][Name::Definition]. fn on_exit_definition(context: &mut CompileContext) { context.resume(); let media = context.media_stack.pop().unwrap(); @@ -856,14 +856,14 @@ fn on_exit_definition(context: &mut CompileContext) { )); } -/// Handle [`Exit`][EventType::Exit]:[`DefinitionDestinationString`][Token::DefinitionDestinationString]. +/// Handle [`Exit`][Kind::Exit]:[`DefinitionDestinationString`][Name::DefinitionDestinationString]. fn on_exit_definition_destination_string(context: &mut CompileContext) { let buf = context.resume(); context.media_stack.last_mut().unwrap().destination = Some(buf); context.encode_html = true; } -/// Handle [`Exit`][EventType::Exit]:[`DefinitionLabelString`][Token::DefinitionLabelString]. +/// Handle [`Exit`][Kind::Exit]:[`DefinitionLabelString`][Name::DefinitionLabelString]. fn on_exit_definition_label_string(context: &mut CompileContext) { // Discard label, use the source content instead. context.resume(); @@ -871,20 +871,20 @@ fn on_exit_definition_label_string(context: &mut CompileContext) { Some(Position::from_exit_event(context.events, context.index).to_indices()); } -/// Handle [`Exit`][EventType::Exit]:[`DefinitionTitleString`][Token::DefinitionTitleString]. +/// Handle [`Exit`][Kind::Exit]:[`DefinitionTitleString`][Name::DefinitionTitleString]. fn on_exit_definition_title_string(context: &mut CompileContext) { let buf = context.resume(); context.media_stack.last_mut().unwrap().title = Some(buf); } -/// Handle [`Exit`][EventType::Exit]:[`Strong`][Token::Emphasis]. +/// Handle [`Exit`][Kind::Exit]:[`Strong`][Name::Emphasis]. fn on_exit_emphasis(context: &mut CompileContext) { if !context.in_image_alt { context.push("</em>"); } } -/// Handle [`Exit`][EventType::Exit]:[`HeadingAtx`][Token::HeadingAtx]. +/// Handle [`Exit`][Kind::Exit]:[`HeadingAtx`][Name::HeadingAtx]. fn on_exit_heading_atx(context: &mut CompileContext) { let rank = context .atx_opening_sequence_size @@ -896,7 +896,7 @@ fn on_exit_heading_atx(context: &mut CompileContext) { context.push(">"); } -/// Handle [`Exit`][EventType::Exit]:[`HeadingAtxSequence`][Token::HeadingAtxSequence]. +/// Handle [`Exit`][Kind::Exit]:[`HeadingAtxSequence`][Name::HeadingAtxSequence]. fn on_exit_heading_atx_sequence(context: &mut CompileContext) { // First fence we see. if context.atx_opening_sequence_size.is_none() { @@ -913,20 +913,20 @@ fn on_exit_heading_atx_sequence(context: &mut CompileContext) { } } -/// Handle [`Exit`][EventType::Exit]:[`HeadingAtxText`][Token::HeadingAtxText]. +/// Handle [`Exit`][Kind::Exit]:[`HeadingAtxText`][Name::HeadingAtxText]. fn on_exit_heading_atx_text(context: &mut CompileContext) { let value = context.resume(); context.push(&value); } -/// Handle [`Exit`][EventType::Exit]:[`HeadingSetextText`][Token::HeadingSetextText]. +/// Handle [`Exit`][Kind::Exit]:[`HeadingSetextText`][Name::HeadingSetextText]. fn on_exit_heading_setext_text(context: &mut CompileContext) { let buf = context.resume(); context.heading_setext_buffer = Some(buf); context.slurp_one_line_ending = true; } -/// Handle [`Exit`][EventType::Exit]:[`HeadingSetextUnderline`][Token::HeadingSetextUnderline]. +/// Handle [`Exit`][Kind::Exit]:[`HeadingSetextUnderline`][Name::HeadingSetextUnderline]. fn on_exit_heading_setext_underline(context: &mut CompileContext) { let text = context .heading_setext_buffer @@ -949,12 +949,12 @@ fn on_exit_heading_setext_underline(context: &mut CompileContext) { context.push(">"); } -/// Handle [`Exit`][EventType::Exit]:{[`HtmlFlow`][Token::HtmlFlow],[`HtmlText`][Token::HtmlText]}. +/// Handle [`Exit`][Kind::Exit]:{[`HtmlFlow`][Name::HtmlFlow],[`HtmlText`][Name::HtmlText]}. fn on_exit_html(context: &mut CompileContext) { context.encode_html = true; } -/// Handle [`Exit`][EventType::Exit]:{[`HtmlFlowData`][Token::HtmlFlowData],[`HtmlTextData`][Token::HtmlTextData]}. +/// Handle [`Exit`][Kind::Exit]:{[`HtmlFlowData`][Name::HtmlFlowData],[`HtmlTextData`][Name::HtmlTextData]}. fn on_exit_html_data(context: &mut CompileContext) { context.push(&encode( Slice::from_position( @@ -966,19 +966,19 @@ fn on_exit_html_data(context: &mut CompileContext) { )); } -/// Handle [`Exit`][EventType::Exit]:[`Label`][Token::Label]. +/// Handle [`Exit`][Kind::Exit]:[`Label`][Name::Label]. fn on_exit_label(context: &mut CompileContext) { let buf = context.resume(); context.media_stack.last_mut().unwrap().label = Some(buf); } -/// Handle [`Exit`][EventType::Exit]:[`LabelText`][Token::LabelText]. +/// Handle [`Exit`][Kind::Exit]:[`LabelText`][Name::LabelText]. fn on_exit_label_text(context: &mut CompileContext) { context.media_stack.last_mut().unwrap().label_id = Some(Position::from_exit_event(context.events, context.index).to_indices()); } -/// Handle [`Exit`][EventType::Exit]:[`LineEnding`][Token::LineEnding]. +/// Handle [`Exit`][Kind::Exit]:[`LineEnding`][Name::LineEnding]. fn on_exit_line_ending(context: &mut CompileContext) { if context.code_text_inside { context.push(" "); @@ -996,7 +996,7 @@ fn on_exit_line_ending(context: &mut CompileContext) { } } -/// Handle [`Exit`][EventType::Exit]:{[`ListOrdered`][Token::ListOrdered],[`ListUnordered`][Token::ListUnordered]}. +/// Handle [`Exit`][Kind::Exit]:{[`ListOrdered`][Name::ListOrdered],[`ListUnordered`][Name::ListUnordered]}. fn on_exit_list(context: &mut CompileContext) { context.tight_stack.pop(); context.line_ending(); @@ -1007,7 +1007,7 @@ fn on_exit_list(context: &mut CompileContext) { }); } -/// Handle [`Exit`][EventType::Exit]:[`ListItem`][Token::ListItem]. +/// Handle [`Exit`][Kind::Exit]:[`ListItem`][Name::ListItem]. fn on_exit_list_item(context: &mut CompileContext) { let tight = context.tight_stack.last().unwrap_or(&false); let before_item = skip::opt_back( @@ -1033,7 +1033,7 @@ fn on_exit_list_item(context: &mut CompileContext) { context.push("</li>"); } -/// Handle [`Exit`][EventType::Exit]:[`ListItemValue`][Token::ListItemValue]. +/// Handle [`Exit`][Kind::Exit]:[`ListItemValue`][Name::ListItemValue]. fn on_exit_list_item_value(context: &mut CompileContext) { let expect_first_item = context.expect_first_item.unwrap(); @@ -1052,7 +1052,7 @@ fn on_exit_list_item_value(context: &mut CompileContext) { } } -/// Handle [`Exit`][EventType::Exit]:{[`Image`][Token::Image],[`Link`][Token::Link]}. +/// Handle [`Exit`][Kind::Exit]:{[`Image`][Name::Image],[`Link`][Name::Link]}. fn on_exit_media(context: &mut CompileContext) { let mut is_in_image = false; let mut index = 0; @@ -1158,7 +1158,7 @@ fn on_exit_media(context: &mut CompileContext) { } } -/// Handle [`Exit`][EventType::Exit]:[`Paragraph`][Token::Paragraph]. +/// Handle [`Exit`][Kind::Exit]:[`Paragraph`][Name::Paragraph]. fn on_exit_paragraph(context: &mut CompileContext) { let tight = context.tight_stack.last().unwrap_or(&false); @@ -1169,7 +1169,7 @@ fn on_exit_paragraph(context: &mut CompileContext) { } } -/// Handle [`Exit`][EventType::Exit]:[`ReferenceString`][Token::ReferenceString]. +/// Handle [`Exit`][Kind::Exit]:[`ReferenceString`][Name::ReferenceString]. fn on_exit_reference_string(context: &mut CompileContext) { // Drop stuff. context.resume(); @@ -1178,27 +1178,27 @@ fn on_exit_reference_string(context: &mut CompileContext) { Some(Position::from_exit_event(context.events, context.index).to_indices()); } -/// Handle [`Exit`][EventType::Exit]:[`ResourceDestinationString`][Token::ResourceDestinationString]. +/// Handle [`Exit`][Kind::Exit]:[`ResourceDestinationString`][Name::ResourceDestinationString]. fn on_exit_resource_destination_string(context: &mut CompileContext) { let buf = context.resume(); context.media_stack.last_mut().unwrap().destination = Some(buf); context.encode_html = true; } -/// Handle [`Exit`][EventType::Exit]:[`ResourceTitleString`][Token::ResourceTitleString]. +/// Handle [`Exit`][Kind::Exit]:[`ResourceTitleString`][Name::ResourceTitleString]. fn on_exit_resource_title_string(context: &mut CompileContext) { let buf = context.resume(); context.media_stack.last_mut().unwrap().title = Some(buf); } -/// Handle [`Exit`][EventType::Exit]:[`Strong`][Token::Strong]. +/// Handle [`Exit`][Kind::Exit]:[`Strong`][Name::Strong]. fn on_exit_strong(context: &mut CompileContext) { if !context.in_image_alt { context.push("</strong>"); } } -/// Handle [`Exit`][EventType::Exit]:[`ThematicBreak`][Token::ThematicBreak]. +/// Handle [`Exit`][Kind::Exit]:[`ThematicBreak`][Name::ThematicBreak]. fn on_exit_thematic_break(context: &mut CompileContext) { context.line_ending_if_needed(); context.push("<hr />"); diff --git a/src/construct/attention.rs b/src/construct/attention.rs index 6f91370..e974fae 100644 --- a/src/construct/attention.rs +++ b/src/construct/attention.rs @@ -32,14 +32,14 @@ //! //! ## Tokens //! -//! * [`Emphasis`][Token::Emphasis] -//! * [`EmphasisSequence`][Token::EmphasisSequence] -//! * [`EmphasisText`][Token::EmphasisText] -//! * [`Strong`][Token::Strong] -//! * [`StrongSequence`][Token::StrongSequence] -//! * [`StrongText`][Token::StrongText] +//! * [`Emphasis`][Name::Emphasis] +//! * [`EmphasisSequence`][Name::EmphasisSequence] +//! * [`EmphasisText`][Name::EmphasisText] +//! * [`Strong`][Name::Strong] +//! * [`StrongSequence`][Name::StrongSequence] +//! * [`StrongText`][Name::StrongText] //! -//! > 👉 **Note**: while parsing, [`AttentionSequence`][Token::AttentionSequence] +//! > 👉 **Note**: while parsing, [`AttentionSequence`][Name::AttentionSequence] //! > is used, which is later compiled away. //! //! ## References diff --git a/src/construct/autolink.rs b/src/construct/autolink.rs index c16b7c0..c0d9ae3 100644 --- a/src/construct/autolink.rs +++ b/src/construct/autolink.rs @@ -84,10 +84,10 @@ //! //! ## Tokens //! -//! * [`Autolink`][Token::Autolink] -//! * [`AutolinkEmail`][Token::AutolinkEmail] -//! * [`AutolinkMarker`][Token::AutolinkMarker] -//! * [`AutolinkProtocol`][Token::AutolinkProtocol] +//! * [`Autolink`][Name::Autolink] +//! * [`AutolinkEmail`][Name::AutolinkEmail] +//! * [`AutolinkMarker`][Name::AutolinkMarker] +//! * [`AutolinkProtocol`][Name::AutolinkProtocol] //! //! ## References //! diff --git a/src/construct/blank_line.rs b/src/construct/blank_line.rs index 2ea986d..2adc7a4 100644 --- a/src/construct/blank_line.rs +++ b/src/construct/blank_line.rs @@ -20,7 +20,7 @@ //! //! ## Tokens //! -//! * [`SpaceOrTab`][crate::token::Token::SpaceOrTab] +//! * [`SpaceOrTab`][crate::event::Name::SpaceOrTab] //! //! ## References //! diff --git a/src/construct/block_quote.rs b/src/construct/block_quote.rs index a32375e..f2b0179 100644 --- a/src/construct/block_quote.rs +++ b/src/construct/block_quote.rs @@ -19,10 +19,10 @@ //! //! ## Tokens //! -//! * [`BlockQuote`][Token::BlockQuote] -//! * [`BlockQuoteMarker`][Token::BlockQuoteMarker] -//! * [`BlockQuotePrefix`][Token::BlockQuotePrefix] -//! * [`SpaceOrTab`][Token::SpaceOrTab] +//! * [`BlockQuote`][Name::BlockQuote] +//! * [`BlockQuoteMarker`][Name::BlockQuoteMarker] +//! * [`BlockQuotePrefix`][Name::BlockQuotePrefix] +//! * [`SpaceOrTab`][Name::SpaceOrTab] //! //! ## References //! diff --git a/src/construct/character_escape.rs b/src/construct/character_escape.rs index 0cd7126..e0f36c7 100644 --- a/src/construct/character_escape.rs +++ b/src/construct/character_escape.rs @@ -19,9 +19,9 @@ //! //! ## Tokens //! -//! * [`CharacterEscape`][Token::CharacterEscape] -//! * [`CharacterEscapeMarker`][Token::CharacterEscapeMarker] -//! * [`CharacterEscapeValue`][Token::CharacterEscapeValue] +//! * [`CharacterEscape`][Name::CharacterEscape] +//! * [`CharacterEscapeMarker`][Name::CharacterEscapeMarker] +//! * [`CharacterEscapeValue`][Name::CharacterEscapeValue] //! //! ## References //! diff --git a/src/construct/character_reference.rs b/src/construct/character_reference.rs index 0158acf..476ea14 100644 --- a/src/construct/character_reference.rs +++ b/src/construct/character_reference.rs @@ -42,12 +42,12 @@ //! //! ## Tokens //! -//! * [`CharacterReference`][Token::CharacterReference] -//! * [`CharacterReferenceMarker`][Token::CharacterReferenceMarker] -//! * [`CharacterReferenceMarkerHexadecimal`][Token::CharacterReferenceMarkerHexadecimal] -//! * [`CharacterReferenceMarkerNumeric`][Token::CharacterReferenceMarkerNumeric] -//! * [`CharacterReferenceMarkerSemi`][Token::CharacterReferenceMarkerSemi] -//! * [`CharacterReferenceValue`][Token::CharacterReferenceValue] +//! * [`CharacterReference`][Name::CharacterReference] +//! * [`CharacterReferenceMarker`][Name::CharacterReferenceMarker] +//! * [`CharacterReferenceMarkerHexadecimal`][Name::CharacterReferenceMarkerHexadecimal] +//! * [`CharacterReferenceMarkerNumeric`][Name::CharacterReferenceMarkerNumeric] +//! * [`CharacterReferenceMarkerSemi`][Name::CharacterReferenceMarkerSemi] +//! * [`CharacterReferenceValue`][Name::CharacterReferenceValue] //! //! ## References //! diff --git a/src/construct/code_fenced.rs b/src/construct/code_fenced.rs index 9488f62..6e29010 100644 --- a/src/construct/code_fenced.rs +++ b/src/construct/code_fenced.rs @@ -77,14 +77,14 @@ //! //! ## Tokens //! -//! * [`CodeFenced`][Token::CodeFenced] -//! * [`CodeFencedFence`][Token::CodeFencedFence] -//! * [`CodeFencedFenceInfo`][Token::CodeFencedFenceInfo] -//! * [`CodeFencedFenceMeta`][Token::CodeFencedFenceMeta] -//! * [`CodeFencedFenceSequence`][Token::CodeFencedFenceSequence] -//! * [`CodeFlowChunk`][Token::CodeFlowChunk] -//! * [`LineEnding`][Token::LineEnding] -//! * [`SpaceOrTab`][Token::SpaceOrTab] +//! * [`CodeFenced`][Name::CodeFenced] +//! * [`CodeFencedFence`][Name::CodeFencedFence] +//! * [`CodeFencedFenceInfo`][Name::CodeFencedFenceInfo] +//! * [`CodeFencedFenceMeta`][Name::CodeFencedFenceMeta] +//! * [`CodeFencedFenceSequence`][Name::CodeFencedFenceSequence] +//! * [`CodeFlowChunk`][Name::CodeFlowChunk] +//! * [`LineEnding`][Name::LineEnding] +//! * [`SpaceOrTab`][Name::SpaceOrTab] //! //! ## References //! diff --git a/src/construct/code_indented.rs b/src/construct/code_indented.rs index 7297759..598d2b0 100644 --- a/src/construct/code_indented.rs +++ b/src/construct/code_indented.rs @@ -28,10 +28,10 @@ //! //! ## Tokens //! -//! * [`CodeIndented`][Token::CodeIndented] -//! * [`CodeFlowChunk`][Token::CodeFlowChunk] -//! * [`LineEnding`][Token::LineEnding] -//! * [`SpaceOrTab`][Token::SpaceOrTab] +//! * [`CodeIndented`][Name::CodeIndented] +//! * [`CodeFlowChunk`][Name::CodeFlowChunk] +//! * [`LineEnding`][Name::LineEnding] +//! * [`SpaceOrTab`][Name::SpaceOrTab] //! //! ## References //! diff --git a/src/construct/code_text.rs b/src/construct/code_text.rs index f48f63c..d321f64 100644 --- a/src/construct/code_text.rs +++ b/src/construct/code_text.rs @@ -67,10 +67,10 @@ //! //! ## Tokens //! -//! * [`CodeText`][Token::CodeText] -//! * [`CodeTextData`][Token::CodeTextData] -//! * [`CodeTextSequence`][Token::CodeTextSequence] -//! * [`LineEnding`][Token::LineEnding] +//! * [`CodeText`][Name::CodeText] +//! * [`CodeTextData`][Name::CodeTextData] +//! * [`CodeTextSequence`][Name::CodeTextSequence] +//! * [`LineEnding`][Name::LineEnding] //! //! ## References //! diff --git a/src/construct/definition.rs b/src/construct/definition.rs index 2533a1c..6f63c79 100644 --- a/src/construct/definition.rs +++ b/src/construct/definition.rs @@ -59,21 +59,21 @@ //! //! ## Tokens //! -//! * [`Definition`][Token::Definition] -//! * [`DefinitionDestination`][Token::DefinitionDestination] -//! * [`DefinitionDestinationLiteral`][Token::DefinitionDestinationLiteral] -//! * [`DefinitionDestinationLiteralMarker`][Token::DefinitionDestinationLiteralMarker] -//! * [`DefinitionDestinationRaw`][Token::DefinitionDestinationRaw] -//! * [`DefinitionDestinationString`][Token::DefinitionDestinationString] -//! * [`DefinitionLabel`][Token::DefinitionLabel] -//! * [`DefinitionLabelMarker`][Token::DefinitionLabelMarker] -//! * [`DefinitionLabelString`][Token::DefinitionLabelString] -//! * [`DefinitionMarker`][Token::DefinitionMarker] -//! * [`DefinitionTitle`][Token::DefinitionTitle] -//! * [`DefinitionTitleMarker`][Token::DefinitionTitleMarker] -//! * [`DefinitionTitleString`][Token::DefinitionTitleString] -//! * [`LineEnding`][Token::LineEnding] -//! * [`SpaceOrTab`][Token::SpaceOrTab] +//! * [`Definition`][Name::Definition] +//! * [`DefinitionDestination`][Name::DefinitionDestination] +//! * [`DefinitionDestinationLiteral`][Name::DefinitionDestinationLiteral] +//! * [`DefinitionDestinationLiteralMarker`][Name::DefinitionDestinationLiteralMarker] +//! * [`DefinitionDestinationRaw`][Name::DefinitionDestinationRaw] +//! * [`DefinitionDestinationString`][Name::DefinitionDestinationString] +//! * [`DefinitionLabel`][Name::DefinitionLabel] +//! * [`DefinitionLabelMarker`][Name::DefinitionLabelMarker] +//! * [`DefinitionLabelString`][Name::DefinitionLabelString] +//! * [`DefinitionMarker`][Name::DefinitionMarker] +//! * [`DefinitionTitle`][Name::DefinitionTitle] +//! * [`DefinitionTitleMarker`][Name::DefinitionTitleMarker] +//! * [`DefinitionTitleString`][Name::DefinitionTitleString] +//! * [`LineEnding`][Name::LineEnding] +//! * [`SpaceOrTab`][Name::SpaceOrTab] //! //! ## References //! @@ -93,7 +93,8 @@ //! [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::construct::partial_space_or_tab::{space_or_tab, space_or_tab_eol}; +use crate::construct::partial_space_or_tab::space_or_tab; +use crate::construct::partial_space_or_tab_eol::space_or_tab_eol; use crate::event::Name; use crate::state::{Name as StateName, State}; use crate::tokenizer::Tokenizer; diff --git a/src/construct/hard_break_escape.rs b/src/construct/hard_break_escape.rs index 9af5b83..f5030aa 100644 --- a/src/construct/hard_break_escape.rs +++ b/src/construct/hard_break_escape.rs @@ -26,7 +26,7 @@ //! //! ## Tokens //! -//! * [`HardBreakEscape`][Token::HardBreakEscape] +//! * [`HardBreakEscape`][Name::HardBreakEscape] //! //! ## References //! diff --git a/src/construct/heading_atx.rs b/src/construct/heading_atx.rs index a114051..4e656d4 100644 --- a/src/construct/heading_atx.rs +++ b/src/construct/heading_atx.rs @@ -37,10 +37,10 @@ //! //! ## Tokens //! -//! * [`HeadingAtx`][Token::HeadingAtx] -//! * [`HeadingAtxSequence`][Token::HeadingAtxSequence] -//! * [`HeadingAtxText`][Token::HeadingAtxText] -//! * [`SpaceOrTab`][Token::SpaceOrTab] +//! * [`HeadingAtx`][Name::HeadingAtx] +//! * [`HeadingAtxSequence`][Name::HeadingAtxSequence] +//! * [`HeadingAtxText`][Name::HeadingAtxText] +//! * [`SpaceOrTab`][Name::SpaceOrTab] //! //! ## References //! diff --git a/src/construct/heading_setext.rs b/src/construct/heading_setext.rs index a3c513b..91a40b3 100644 --- a/src/construct/heading_setext.rs +++ b/src/construct/heading_setext.rs @@ -40,9 +40,9 @@ //! //! ## Tokens //! -//! * [`HeadingSetext`][Token::HeadingSetext] -//! * [`HeadingSetextText`][Token::HeadingSetextText] -//! * [`HeadingSetextUnderline`][Token::HeadingSetextUnderline] +//! * [`HeadingSetext`][Name::HeadingSetext] +//! * [`HeadingSetextText`][Name::HeadingSetextText] +//! * [`HeadingSetextUnderline`][Name::HeadingSetextUnderline] //! //! ## References //! diff --git a/src/construct/html_flow.rs b/src/construct/html_flow.rs index 8e5321f..9998797 100644 --- a/src/construct/html_flow.rs +++ b/src/construct/html_flow.rs @@ -82,9 +82,9 @@ //! //! ## Tokens //! -//! * [`HtmlFlow`][Token::HtmlFlow] -//! * [`HtmlFlowData`][Token::HtmlFlowData] -//! * [`LineEnding`][Token::LineEnding] +//! * [`HtmlFlow`][Name::HtmlFlow] +//! * [`HtmlFlowData`][Name::HtmlFlowData] +//! * [`LineEnding`][Name::LineEnding] //! //! ## References //! diff --git a/src/construct/html_text.rs b/src/construct/html_text.rs index 27e92f5..1b15956 100644 --- a/src/construct/html_text.rs +++ b/src/construct/html_text.rs @@ -42,8 +42,8 @@ //! //! ## Tokens //! -//! * [`HtmlText`][Token::HtmlText] -//! * [`HtmlTextData`][Token::HtmlTextData] +//! * [`HtmlText`][Name::HtmlText] +//! * [`HtmlTextData`][Name::HtmlTextData] //! //! ## References //! diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs index f27d79f..26dcf6b 100644 --- a/src/construct/label_end.rs +++ b/src/construct/label_end.rs @@ -102,28 +102,28 @@ //! //! ## Tokens //! -//! * [`Data`][Token::Data] -//! * [`Image`][Token::Image] -//! * [`Label`][Token::Label] -//! * [`LabelEnd`][Token::LabelEnd] -//! * [`LabelMarker`][Token::LabelMarker] -//! * [`LabelText`][Token::LabelText] -//! * [`LineEnding`][Token::LineEnding] -//! * [`Link`][Token::Link] -//! * [`Reference`][Token::Reference] -//! * [`ReferenceMarker`][Token::ReferenceMarker] -//! * [`ReferenceString`][Token::ReferenceString] -//! * [`Resource`][Token::Resource] -//! * [`ResourceDestination`][Token::ResourceDestination] -//! * [`ResourceDestinationLiteral`][Token::ResourceDestinationLiteral] -//! * [`ResourceDestinationLiteralMarker`][Token::ResourceDestinationLiteralMarker] -//! * [`ResourceDestinationRaw`][Token::ResourceDestinationRaw] -//! * [`ResourceDestinationString`][Token::ResourceDestinationString] -//! * [`ResourceMarker`][Token::ResourceMarker] -//! * [`ResourceTitle`][Token::ResourceTitle] -//! * [`ResourceTitleMarker`][Token::ResourceTitleMarker] -//! * [`ResourceTitleString`][Token::ResourceTitleString] -//! * [`SpaceOrTab`][Token::SpaceOrTab] +//! * [`Data`][Name::Data] +//! * [`Image`][Name::Image] +//! * [`Label`][Name::Label] +//! * [`LabelEnd`][Name::LabelEnd] +//! * [`LabelMarker`][Name::LabelMarker] +//! * [`LabelText`][Name::LabelText] +//! * [`LineEnding`][Name::LineEnding] +//! * [`Link`][Name::Link] +//! * [`Reference`][Name::Reference] +//! * [`ReferenceMarker`][Name::ReferenceMarker] +//! * [`ReferenceString`][Name::ReferenceString] +//! * [`Resource`][Name::Resource] +//! * [`ResourceDestination`][Name::ResourceDestination] +//! * [`ResourceDestinationLiteral`][Name::ResourceDestinationLiteral] +//! * [`ResourceDestinationLiteralMarker`][Name::ResourceDestinationLiteralMarker] +//! * [`ResourceDestinationRaw`][Name::ResourceDestinationRaw] +//! * [`ResourceDestinationString`][Name::ResourceDestinationString] +//! * [`ResourceMarker`][Name::ResourceMarker] +//! * [`ResourceTitle`][Name::ResourceTitle] +//! * [`ResourceTitleMarker`][Name::ResourceTitleMarker] +//! * [`ResourceTitleString`][Name::ResourceTitleString] +//! * [`SpaceOrTab`][Name::SpaceOrTab] //! //! ## References //! @@ -147,7 +147,7 @@ //! [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::space_or_tab_eol; +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}; diff --git a/src/construct/label_start_image.rs b/src/construct/label_start_image.rs index e8aec8b..c9f76b0 100644 --- a/src/construct/label_start_image.rs +++ b/src/construct/label_start_image.rs @@ -15,9 +15,9 @@ //! //! ## Tokens //! -//! * [`LabelImage`][Token::LabelImage] -//! * [`LabelImageMarker`][Token::LabelImageMarker] -//! * [`LabelMarker`][Token::LabelMarker] +//! * [`LabelImage`][Name::LabelImage] +//! * [`LabelImageMarker`][Name::LabelImageMarker] +//! * [`LabelMarker`][Name::LabelMarker] //! //! ## References //! diff --git a/src/construct/label_start_link.rs b/src/construct/label_start_link.rs index 530d83e..6b022c5 100644 --- a/src/construct/label_start_link.rs +++ b/src/construct/label_start_link.rs @@ -15,8 +15,8 @@ //! //! ## Tokens //! -//! * [`LabelLink`][Token::LabelLink] -//! * [`LabelMarker`][Token::LabelMarker] +//! * [`LabelLink`][Name::LabelLink] +//! * [`LabelMarker`][Name::LabelMarker] //! //! ## References //! diff --git a/src/construct/list.rs b/src/construct/list.rs index 028e283..1da1f4e 100644 --- a/src/construct/list.rs +++ b/src/construct/list.rs @@ -25,12 +25,12 @@ //! //! ## Tokens //! -//! * [`ListItem`][Token::ListItem] -//! * [`ListItemMarker`][Token::ListItemMarker] -//! * [`ListItemPrefix`][Token::ListItemPrefix] -//! * [`ListItemValue`][Token::ListItemValue] -//! * [`ListOrdered`][Token::ListOrdered] -//! * [`ListUnordered`][Token::ListUnordered] +//! * [`ListItem`][Name::ListItem] +//! * [`ListItemMarker`][Name::ListItemMarker] +//! * [`ListItemPrefix`][Name::ListItemPrefix] +//! * [`ListItemValue`][Name::ListItemValue] +//! * [`ListOrdered`][Name::ListOrdered] +//! * [`ListUnordered`][Name::ListUnordered] //! //! ## References //! diff --git a/src/construct/mod.rs b/src/construct/mod.rs index cfaca0a..0adf611 100644 --- a/src/construct/mod.rs +++ b/src/construct/mod.rs @@ -47,6 +47,7 @@ //! * [label][partial_label] //! * [non lazy continuation][partial_non_lazy_continuation] //! * [space or tab][partial_space_or_tab] +//! * [space or tab, eol][partial_space_or_tab_eol] //! * [title][partial_title] //! * [whitespace][partial_whitespace] //! @@ -91,6 +92,7 @@ pub mod partial_destination; pub mod partial_label; pub mod partial_non_lazy_continuation; pub mod partial_space_or_tab; +pub mod partial_space_or_tab_eol; pub mod partial_title; pub mod partial_whitespace; pub mod thematic_break; diff --git a/src/construct/paragraph.rs b/src/construct/paragraph.rs index acbee83..663b01b 100644 --- a/src/construct/paragraph.rs +++ b/src/construct/paragraph.rs @@ -19,7 +19,7 @@ //! //! ## Tokens //! -//! * [`Paragraph`][Token::Paragraph] +//! * [`Paragraph`][Name::Paragraph] //! //! ## References //! diff --git a/src/construct/partial_bom.rs b/src/construct/partial_bom.rs index 74ca04e..0175971 100644 --- a/src/construct/partial_bom.rs +++ b/src/construct/partial_bom.rs @@ -4,7 +4,7 @@ //! //! ## Tokens //! -//! * [`ByteOrderMark`][Token::ByteOrderMark] +//! * [`ByteOrderMark`][Name::ByteOrderMark] //! //! ## References //! diff --git a/src/construct/partial_label.rs b/src/construct/partial_label.rs index 85769eb..762baaa 100644 --- a/src/construct/partial_label.rs +++ b/src/construct/partial_label.rs @@ -59,7 +59,7 @@ //! [link_reference_size_max]: crate::constant::LINK_REFERENCE_SIZE_MAX use crate::constant::LINK_REFERENCE_SIZE_MAX; -use crate::construct::partial_space_or_tab::{space_or_tab_eol_with_options, EolOptions}; +use crate::construct::partial_space_or_tab_eol::{space_or_tab_eol_with_options, Options}; use crate::event::{Content, Name}; use crate::state::{Name as StateName, State}; use crate::subtokenize::link; @@ -105,7 +105,7 @@ pub fn at_break(tokenizer: &mut Tokenizer) -> State { Some(b'\n') => { let name = space_or_tab_eol_with_options( tokenizer, - EolOptions { + Options { content_type: Some(Content::String), connect: tokenizer.tokenize_state.connect, }, diff --git a/src/construct/partial_space_or_tab.rs b/src/construct/partial_space_or_tab.rs index 3fc9484..f2d9a73 100644 --- a/src/construct/partial_space_or_tab.rs +++ b/src/construct/partial_space_or_tab.rs @@ -24,15 +24,6 @@ pub struct Options { pub content_type: Option<Content>, } -/// Options to parse `space_or_tab` and one optional eol, but no blank line. -#[derive(Debug)] -pub struct EolOptions { - /// Connect this whitespace to the previous. - pub connect: bool, - /// Embedded content type to use. - pub content_type: Option<Content>, -} - /// One or more `space_or_tab`. /// /// ```bnf @@ -70,29 +61,6 @@ pub fn space_or_tab_with_options(tokenizer: &mut Tokenizer, options: Options) -> StateName::SpaceOrTabStart } -/// `space_or_tab`, or optionally `space_or_tab`, one `eol`, and -/// optionally `space_or_tab`. -/// -/// ```bnf -/// space_or_tab_eol ::= 1*( ' ' '\t' ) | 0*( ' ' '\t' ) eol 0*( ' ' '\t' ) -/// ``` -pub fn space_or_tab_eol(tokenizer: &mut Tokenizer) -> StateName { - space_or_tab_eol_with_options( - tokenizer, - EolOptions { - content_type: None, - connect: false, - }, - ) -} - -/// `space_or_tab_eol`, with the given options. -pub fn space_or_tab_eol_with_options(tokenizer: &mut Tokenizer, options: EolOptions) -> StateName { - tokenizer.tokenize_state.space_or_tab_eol_content_type = options.content_type; - tokenizer.tokenize_state.space_or_tab_eol_connect = options.connect; - StateName::SpaceOrTabEolStart -} - /// Before `space_or_tab`. /// /// ```markdown @@ -165,132 +133,3 @@ pub fn after(tokenizer: &mut Tokenizer) -> State { tokenizer.tokenize_state.space_or_tab_token = Name::SpaceOrTab; state } - -pub fn eol_start(tokenizer: &mut Tokenizer) -> State { - let name = space_or_tab_with_options( - tokenizer, - Options { - kind: Name::SpaceOrTab, - min: 1, - max: usize::MAX, - content_type: tokenizer - .tokenize_state - .space_or_tab_eol_content_type - .clone(), - connect: tokenizer.tokenize_state.space_or_tab_eol_connect, - }, - ); - - tokenizer.attempt( - name, - State::Next(StateName::SpaceOrTabEolAfterFirst), - State::Next(StateName::SpaceOrTabEolAtEol), - ) -} - -pub fn eol_after_first(tokenizer: &mut Tokenizer) -> State { - tokenizer.tokenize_state.space_or_tab_eol_ok = true; - - if tokenizer - .tokenize_state - .space_or_tab_eol_content_type - .is_some() - { - tokenizer.tokenize_state.space_or_tab_eol_connect = true; - } - - State::Retry(StateName::SpaceOrTabEolAtEol) -} - -/// `space_or_tab_eol`: after optionally first `space_or_tab`. -/// -/// ```markdown -/// > | a -/// ^ -/// | b -/// ``` -pub fn eol_at_eol(tokenizer: &mut Tokenizer) -> State { - if let Some(b'\n') = tokenizer.current { - tokenizer.enter_with_content( - Name::LineEnding, - tokenizer - .tokenize_state - .space_or_tab_eol_content_type - .clone(), - ); - - if tokenizer.tokenize_state.space_or_tab_eol_connect { - let index = tokenizer.events.len() - 1; - link(&mut tokenizer.events, index); - } else if tokenizer - .tokenize_state - .space_or_tab_eol_content_type - .is_some() - { - tokenizer.tokenize_state.space_or_tab_eol_connect = true; - } - - tokenizer.consume(); - tokenizer.exit(Name::LineEnding); - State::Next(StateName::SpaceOrTabEolAfterEol) - } else { - let ok = tokenizer.tokenize_state.space_or_tab_eol_ok; - tokenizer.tokenize_state.space_or_tab_eol_content_type = None; - tokenizer.tokenize_state.space_or_tab_eol_connect = false; - tokenizer.tokenize_state.space_or_tab_eol_ok = false; - if ok { - State::Ok - } else { - State::Nok - } - } -} - -/// `space_or_tab_eol`: after eol. -/// -/// ```markdown -/// | a -/// > | b -/// ^ -/// ``` -#[allow(clippy::needless_pass_by_value)] -pub fn eol_after_eol(tokenizer: &mut Tokenizer) -> State { - let name = space_or_tab_with_options( - tokenizer, - Options { - kind: Name::SpaceOrTab, - min: 1, - max: usize::MAX, - content_type: tokenizer - .tokenize_state - .space_or_tab_eol_content_type - .clone(), - connect: tokenizer.tokenize_state.space_or_tab_eol_connect, - }, - ); - tokenizer.attempt( - name, - State::Next(StateName::SpaceOrTabEolAfterMore), - State::Next(StateName::SpaceOrTabEolAfterMore), - ) -} - -/// `space_or_tab_eol`: after more (optional) `space_or_tab`. -/// -/// ```markdown -/// | a -/// > | b -/// ^ -/// ``` -pub fn eol_after_more(tokenizer: &mut Tokenizer) -> State { - tokenizer.tokenize_state.space_or_tab_eol_content_type = None; - tokenizer.tokenize_state.space_or_tab_eol_connect = false; - tokenizer.tokenize_state.space_or_tab_eol_ok = false; - - // Blank line not allowed. - if matches!(tokenizer.current, None | Some(b'\n')) { - State::Nok - } else { - State::Ok - } -} diff --git a/src/construct/partial_space_or_tab_eol.rs b/src/construct/partial_space_or_tab_eol.rs new file mode 100644 index 0000000..0807a5f --- /dev/null +++ b/src/construct/partial_space_or_tab_eol.rs @@ -0,0 +1,174 @@ +//! Several helpers to parse whitespace (`space_or_tab`, `space_or_tab_eol`). +//! +//! ## References +//! +//! * [`micromark-factory-space/index.js` in `micromark`](https://github.com/micromark/micromark/blob/main/packages/micromark-factory-space/dev/index.js) + +use crate::construct::partial_space_or_tab::{ + space_or_tab_with_options, Options as SpaceOrTabOptions, +}; +use crate::event::{Content, Name}; +use crate::state::{Name as StateName, State}; +use crate::subtokenize::link; +use crate::tokenizer::Tokenizer; + +/// Options to parse `space_or_tab` and one optional eol, but no blank line. +#[derive(Debug)] +pub struct Options { + /// Connect this whitespace to the previous. + pub connect: bool, + /// Embedded content type to use. + pub content_type: Option<Content>, +} + +/// `space_or_tab`, or optionally `space_or_tab`, one `eol`, and +/// optionally `space_or_tab`. +/// +/// ```bnf +/// space_or_tab_eol ::= 1*( ' ' '\t' ) | 0*( ' ' '\t' ) eol 0*( ' ' '\t' ) +/// ``` +pub fn space_or_tab_eol(tokenizer: &mut Tokenizer) -> StateName { + space_or_tab_eol_with_options( + tokenizer, + Options { + content_type: None, + connect: false, + }, + ) +} + +/// `space_or_tab_eol`, with the given options. +pub fn space_or_tab_eol_with_options(tokenizer: &mut Tokenizer, options: Options) -> StateName { + tokenizer.tokenize_state.space_or_tab_eol_content_type = options.content_type; + tokenizer.tokenize_state.space_or_tab_eol_connect = options.connect; + StateName::SpaceOrTabEolStart +} + +pub fn eol_start(tokenizer: &mut Tokenizer) -> State { + let name = space_or_tab_with_options( + tokenizer, + SpaceOrTabOptions { + kind: Name::SpaceOrTab, + min: 1, + max: usize::MAX, + content_type: tokenizer + .tokenize_state + .space_or_tab_eol_content_type + .clone(), + connect: tokenizer.tokenize_state.space_or_tab_eol_connect, + }, + ); + + tokenizer.attempt( + name, + State::Next(StateName::SpaceOrTabEolAfterFirst), + State::Next(StateName::SpaceOrTabEolAtEol), + ) +} + +pub fn eol_after_first(tokenizer: &mut Tokenizer) -> State { + tokenizer.tokenize_state.space_or_tab_eol_ok = true; + + if tokenizer + .tokenize_state + .space_or_tab_eol_content_type + .is_some() + { + tokenizer.tokenize_state.space_or_tab_eol_connect = true; + } + + State::Retry(StateName::SpaceOrTabEolAtEol) +} + +/// `space_or_tab_eol`: after optionally first `space_or_tab`. +/// +/// ```markdown +/// > | a +/// ^ +/// | b +/// ``` +pub fn eol_at_eol(tokenizer: &mut Tokenizer) -> State { + if let Some(b'\n') = tokenizer.current { + tokenizer.enter_with_content( + Name::LineEnding, + tokenizer + .tokenize_state + .space_or_tab_eol_content_type + .clone(), + ); + + if tokenizer.tokenize_state.space_or_tab_eol_connect { + let index = tokenizer.events.len() - 1; + link(&mut tokenizer.events, index); + } else if tokenizer + .tokenize_state + .space_or_tab_eol_content_type + .is_some() + { + tokenizer.tokenize_state.space_or_tab_eol_connect = true; + } + + tokenizer.consume(); + tokenizer.exit(Name::LineEnding); + State::Next(StateName::SpaceOrTabEolAfterEol) + } else { + let ok = tokenizer.tokenize_state.space_or_tab_eol_ok; + tokenizer.tokenize_state.space_or_tab_eol_content_type = None; + tokenizer.tokenize_state.space_or_tab_eol_connect = false; + tokenizer.tokenize_state.space_or_tab_eol_ok = false; + if ok { + State::Ok + } else { + State::Nok + } + } +} + +/// `space_or_tab_eol`: after eol. +/// +/// ```markdown +/// | a +/// > | b +/// ^ +/// ``` +#[allow(clippy::needless_pass_by_value)] +pub fn eol_after_eol(tokenizer: &mut Tokenizer) -> State { + let name = space_or_tab_with_options( + tokenizer, + SpaceOrTabOptions { + kind: Name::SpaceOrTab, + min: 1, + max: usize::MAX, + content_type: tokenizer + .tokenize_state + .space_or_tab_eol_content_type + .clone(), + connect: tokenizer.tokenize_state.space_or_tab_eol_connect, + }, + ); + tokenizer.attempt( + name, + State::Next(StateName::SpaceOrTabEolAfterMore), + State::Next(StateName::SpaceOrTabEolAfterMore), + ) +} + +/// `space_or_tab_eol`: after more (optional) `space_or_tab`. +/// +/// ```markdown +/// | a +/// > | b +/// ^ +/// ``` +pub fn eol_after_more(tokenizer: &mut Tokenizer) -> State { + tokenizer.tokenize_state.space_or_tab_eol_content_type = None; + tokenizer.tokenize_state.space_or_tab_eol_connect = false; + tokenizer.tokenize_state.space_or_tab_eol_ok = false; + + // Blank line not allowed. + if matches!(tokenizer.current, None | Some(b'\n')) { + State::Nok + } else { + State::Ok + } +} diff --git a/src/construct/partial_title.rs b/src/construct/partial_title.rs index be06c02..6421360 100644 --- a/src/construct/partial_title.rs +++ b/src/construct/partial_title.rs @@ -30,7 +30,7 @@ //! [character_reference]: crate::construct::character_reference //! [label_end]: crate::construct::label_end -use crate::construct::partial_space_or_tab::{space_or_tab_eol_with_options, EolOptions}; +use crate::construct::partial_space_or_tab_eol::{space_or_tab_eol_with_options, Options}; use crate::event::{Content, Name}; use crate::state::{Name as StateName, State}; use crate::subtokenize::link; @@ -101,7 +101,7 @@ pub fn at_break(tokenizer: &mut Tokenizer) -> State { Some(b'\n') => { let name = space_or_tab_eol_with_options( tokenizer, - EolOptions { + Options { content_type: Some(Content::String), connect: tokenizer.tokenize_state.connect, }, diff --git a/src/construct/partial_whitespace.rs b/src/construct/partial_whitespace.rs index 688e7fd..7152881 100644 --- a/src/construct/partial_whitespace.rs +++ b/src/construct/partial_whitespace.rs @@ -30,8 +30,8 @@ //! removed, making hard break (trailing) hard to use. //! ## Tokens //! -//! * [`HardBreakTrailing`][Token::HardBreakTrailing] -//! * [`SpaceOrTab`][Token::SpaceOrTab] +//! * [`HardBreakTrailing`][Name::HardBreakTrailing] +//! * [`SpaceOrTab`][Name::SpaceOrTab] //! //! ## References //! @@ -71,7 +71,7 @@ pub fn resolve_whitespace(tokenizer: &mut Tokenizer, hard_break: bool, trim_whol } } -/// Trim a [`Data`][Token::Data] token. +/// Trim a [`Data`][Name::Data] token. fn trim_data( tokenizer: &mut Tokenizer, exit_index: usize, diff --git a/src/construct/thematic_break.rs b/src/construct/thematic_break.rs index 8e3c4f4..5969e77 100644 --- a/src/construct/thematic_break.rs +++ b/src/construct/thematic_break.rs @@ -35,8 +35,8 @@ //! //! ## Tokens //! -//! * [`ThematicBreak`][Token::ThematicBreak] -//! * [`ThematicBreakSequence`][Token::ThematicBreakSequence] +//! * [`ThematicBreak`][Name::ThematicBreak] +//! * [`ThematicBreakSequence`][Name::ThematicBreakSequence] //! //! ## References //! diff --git a/src/event.rs b/src/event.rs index ba07028..664a609 100644 --- a/src/event.rs +++ b/src/event.rs @@ -12,9 +12,9 @@ pub enum Name { /// * **Context**: /// [text content][crate::content::text] /// * **Content model**: - /// [`AutolinkEmail`][Token::AutolinkEmail], - /// [`AutolinkMarker`][Token::AutolinkMarker], - /// [`AutolinkProtocol`][Token::AutolinkProtocol] + /// [`AutolinkEmail`][Name::AutolinkEmail], + /// [`AutolinkMarker`][Name::AutolinkMarker], + /// [`AutolinkProtocol`][Name::AutolinkProtocol] /// * **Construct**: /// [`autolink`][crate::construct::autolink] /// @@ -30,7 +30,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Autolink`][Token::Autolink] + /// [`Autolink`][Name::Autolink] /// * **Content model**: /// void /// * **Construct**: @@ -48,7 +48,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Autolink`][Token::Autolink] + /// [`Autolink`][Name::Autolink] /// * **Content model**: /// void /// * **Construct**: @@ -66,7 +66,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Autolink`][Token::Autolink] + /// [`Autolink`][Name::Autolink] /// * **Content model**: /// void /// * **Construct**: @@ -104,7 +104,7 @@ pub enum Name { /// * **Context**: /// [document content][crate::content::document] /// * **Content model**: - /// [`BlockQuotePrefix`][Token::BlockQuotePrefix], + /// [`BlockQuotePrefix`][Name::BlockQuotePrefix], /// [flow content][crate::content::flow] /// * **Construct**: /// [`block_quote`][crate::construct::block_quote] @@ -123,7 +123,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`BlockQuotePrefix`][Token::BlockQuotePrefix] + /// [`BlockQuotePrefix`][Name::BlockQuotePrefix] /// * **Content model**: /// void /// * **Construct**: @@ -142,10 +142,10 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`BlockQuote`][Token::BlockQuote] + /// [`BlockQuote`][Name::BlockQuote] /// * **Content model**: - /// [`BlockQuoteMarker`][Token::BlockQuoteMarker], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`BlockQuoteMarker`][Name::BlockQuoteMarker], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`block_quote`][crate::construct::block_quote] /// @@ -176,8 +176,8 @@ pub enum Name { /// [string content][crate::content::string] or /// [text content][crate::content::text] /// * **Content model**: - /// [`CharacterEscapeMarker`][Token::CharacterEscapeMarker], - /// [`CharacterEscapeValue`][Token::CharacterEscapeValue] + /// [`CharacterEscapeMarker`][Name::CharacterEscapeMarker], + /// [`CharacterEscapeValue`][Name::CharacterEscapeValue] /// * **Construct**: /// [`character_escape`][crate::construct::character_escape] /// @@ -193,7 +193,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CharacterEscape`][Token::CharacterEscape] + /// [`CharacterEscape`][Name::CharacterEscape] /// * **Content model**: /// void /// * **Construct**: @@ -211,7 +211,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CharacterEscape`][Token::CharacterEscape] + /// [`CharacterEscape`][Name::CharacterEscape] /// * **Content model**: /// void /// * **Construct**: @@ -232,11 +232,11 @@ pub enum Name { /// [string content][crate::content::string] or /// [text content][crate::content::text] /// * **Content model**: - /// [`CharacterReferenceMarker`][Token::CharacterReferenceMarker], - /// [`CharacterReferenceMarkerHexadecimal`][Token::CharacterReferenceMarkerHexadecimal], - /// [`CharacterReferenceMarkerNumeric`][Token::CharacterReferenceMarkerNumeric], - /// [`CharacterReferenceMarkerSemi`][Token::CharacterReferenceMarkerSemi], - /// [`CharacterReferenceValue`][Token::CharacterReferenceValue] + /// [`CharacterReferenceMarker`][Name::CharacterReferenceMarker], + /// [`CharacterReferenceMarkerHexadecimal`][Name::CharacterReferenceMarkerHexadecimal], + /// [`CharacterReferenceMarkerNumeric`][Name::CharacterReferenceMarkerNumeric], + /// [`CharacterReferenceMarkerSemi`][Name::CharacterReferenceMarkerSemi], + /// [`CharacterReferenceValue`][Name::CharacterReferenceValue] /// * **Construct**: /// [`character_reference`][crate::construct::character_reference] /// @@ -252,7 +252,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CharacterReference`][Token::CharacterReference] + /// [`CharacterReference`][Name::CharacterReference] /// * **Content model**: /// void /// * **Construct**: @@ -270,7 +270,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CharacterReference`][Token::CharacterReference] + /// [`CharacterReference`][Name::CharacterReference] /// * **Content model**: /// void /// * **Construct**: @@ -288,7 +288,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CharacterReference`][Token::CharacterReference] + /// [`CharacterReference`][Name::CharacterReference] /// * **Content model**: /// void /// * **Construct**: @@ -306,7 +306,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CharacterReference`][Token::CharacterReference] + /// [`CharacterReference`][Name::CharacterReference] /// * **Content model**: /// void /// * **Construct**: @@ -324,7 +324,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CharacterReference`][Token::CharacterReference] + /// [`CharacterReference`][Name::CharacterReference] /// * **Content model**: /// void /// * **Construct**: @@ -344,10 +344,10 @@ pub enum Name { /// * **Context**: /// [flow content][crate::content::flow] /// * **Content model**: - /// [`CodeFencedFence`][Token::CodeFencedFence], - /// [`CodeFlowChunk`][Token::CodeFlowChunk], - /// [`LineEnding`][Token::LineEnding], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`CodeFencedFence`][Name::CodeFencedFence], + /// [`CodeFlowChunk`][Name::CodeFlowChunk], + /// [`LineEnding`][Name::LineEnding], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`code_fenced`][crate::construct::code_fenced] /// @@ -367,12 +367,12 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CodeFenced`][Token::CodeFenced] + /// [`CodeFenced`][Name::CodeFenced] /// * **Content model**: - /// [`CodeFencedFenceInfo`][Token::CodeFencedFenceInfo], - /// [`CodeFencedFenceMeta`][Token::CodeFencedFenceMeta], - /// [`CodeFencedFenceSequence`][Token::CodeFencedFenceSequence], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`CodeFencedFenceInfo`][Name::CodeFencedFenceInfo], + /// [`CodeFencedFenceMeta`][Name::CodeFencedFenceMeta], + /// [`CodeFencedFenceSequence`][Name::CodeFencedFenceSequence], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`code_fenced`][crate::construct::code_fenced] /// @@ -391,7 +391,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CodeFencedFence`][Token::CodeFencedFence] + /// [`CodeFencedFence`][Name::CodeFencedFence] /// * **Content model**: /// [string content][crate::content::string] /// * **Construct**: @@ -411,7 +411,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CodeFencedFence`][Token::CodeFencedFence] + /// [`CodeFencedFence`][Name::CodeFencedFence] /// * **Content model**: /// [string content][crate::content::string] /// * **Construct**: @@ -431,7 +431,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CodeFencedFenceSequence`][Token::CodeFencedFenceSequence] + /// [`CodeFencedFenceSequence`][Name::CodeFencedFenceSequence] /// * **Content model**: /// void /// * **Construct**: @@ -452,8 +452,8 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CodeFenced`][Token::CodeFenced], - /// [`CodeIndented`][Token::CodeIndented] + /// [`CodeFenced`][Name::CodeFenced], + /// [`CodeIndented`][Name::CodeIndented] /// * **Content model**: /// void /// * **Construct**: @@ -481,9 +481,9 @@ pub enum Name { /// * **Context**: /// [flow content][crate::content::flow] /// * **Content model**: - /// [`CodeFlowChunk`][Token::CodeFlowChunk], - /// [`LineEnding`][Token::LineEnding], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`CodeFlowChunk`][Name::CodeFlowChunk], + /// [`LineEnding`][Name::LineEnding], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`code_fenced`][crate::construct::code_fenced] /// @@ -501,9 +501,9 @@ pub enum Name { /// * **Context**: /// [text content][crate::content::text] /// * **Content model**: - /// [`CodeTextData`][Token::CodeTextData], - /// [`CodeTextSequence`][Token::CodeTextSequence], - /// [`LineEnding`][Token::LineEnding] + /// [`CodeTextData`][Name::CodeTextData], + /// [`CodeTextSequence`][Name::CodeTextSequence], + /// [`LineEnding`][Name::LineEnding] /// * **Construct**: /// [`code_text`][crate::construct::code_text] /// @@ -519,7 +519,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CodeText`][Token::CodeText], + /// [`CodeText`][Name::CodeText], /// * **Content model**: /// void /// * **Construct**: @@ -537,7 +537,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`CodeText`][Token::CodeText], + /// [`CodeText`][Name::CodeText], /// * **Content model**: /// void /// * **Construct**: @@ -576,12 +576,12 @@ pub enum Name { /// * **Context**: /// [flow content][crate::content::flow] /// * **Content model**: - /// [`DefinitionMarker`][Token::DefinitionMarker], - /// [`DefinitionLabel`][Token::DefinitionLabel], - /// [`DefinitionDestination`][Token::DefinitionDestination], - /// [`DefinitionTitle`][Token::DefinitionTitle], - /// [`LineEnding`][Token::LineEnding], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`DefinitionMarker`][Name::DefinitionMarker], + /// [`DefinitionLabel`][Name::DefinitionLabel], + /// [`DefinitionDestination`][Name::DefinitionDestination], + /// [`DefinitionTitle`][Name::DefinitionTitle], + /// [`LineEnding`][Name::LineEnding], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`definition`][crate::construct::definition] /// @@ -597,10 +597,10 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Definition`][Token::Definition] + /// [`Definition`][Name::Definition] /// * **Content model**: - /// [`DefinitionDestinationLiteral`][Token::DefinitionDestinationLiteral], - /// [`DefinitionDestinationRaw`][Token::DefinitionDestinationRaw] + /// [`DefinitionDestinationLiteral`][Name::DefinitionDestinationLiteral], + /// [`DefinitionDestinationRaw`][Name::DefinitionDestinationRaw] /// * **Construct**: /// [`destination`][crate::construct::partial_destination] /// @@ -618,10 +618,10 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`DefinitionDestination`][Token::DefinitionDestination] + /// [`DefinitionDestination`][Name::DefinitionDestination] /// * **Content model**: - /// [`DefinitionDestinationLiteralMarker`][Token::DefinitionDestinationLiteralMarker], - /// [`DefinitionDestinationString`][Token::DefinitionDestinationString] + /// [`DefinitionDestinationLiteralMarker`][Name::DefinitionDestinationLiteralMarker], + /// [`DefinitionDestinationString`][Name::DefinitionDestinationString] /// * **Construct**: /// [`destination`][crate::construct::partial_destination] /// @@ -637,7 +637,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`DefinitionDestinationLiteral`][Token::DefinitionDestinationLiteral] + /// [`DefinitionDestinationLiteral`][Name::DefinitionDestinationLiteral] /// * **Content model**: /// void /// * **Construct**: @@ -655,9 +655,9 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`DefinitionDestination`][Token::DefinitionDestination] + /// [`DefinitionDestination`][Name::DefinitionDestination] /// * **Content model**: - /// [`DefinitionDestinationString`][Token::DefinitionDestinationString] + /// [`DefinitionDestinationString`][Name::DefinitionDestinationString] /// * **Construct**: /// [`destination`][crate::construct::partial_destination] /// @@ -673,8 +673,8 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`DefinitionDestinationLiteral`][Token::DefinitionDestinationLiteral], - /// [`DefinitionDestinationRaw`][Token::DefinitionDestinationRaw] + /// [`DefinitionDestinationLiteral`][Name::DefinitionDestinationLiteral], + /// [`DefinitionDestinationRaw`][Name::DefinitionDestinationRaw] /// * **Content model**: /// [string content][crate::content::string] /// * **Construct**: @@ -694,12 +694,12 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Definition`][Token::Definition] + /// [`Definition`][Name::Definition] /// * **Content model**: - /// [`DefinitionLabelMarker`][Token::DefinitionLabelMarker], - /// [`DefinitionLabelString`][Token::DefinitionLabelString], - /// [`LineEnding`][Token::LineEnding], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`DefinitionLabelMarker`][Name::DefinitionLabelMarker], + /// [`DefinitionLabelString`][Name::DefinitionLabelString], + /// [`LineEnding`][Name::LineEnding], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`label`][crate::construct::partial_label] /// @@ -715,7 +715,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`DefinitionLabel`][Token::DefinitionLabel] + /// [`DefinitionLabel`][Name::DefinitionLabel] /// * **Content model**: /// void /// * **Construct**: @@ -733,7 +733,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`DefinitionLabel`][Token::DefinitionLabel] + /// [`DefinitionLabel`][Name::DefinitionLabel] /// * **Content model**: /// [string content][crate::content::string] /// * **Construct**: @@ -751,7 +751,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Definition`][Token::Definition] + /// [`Definition`][Name::Definition] /// * **Content model**: /// void /// * **Construct**: @@ -769,12 +769,12 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Definition`][Token::Definition] + /// [`Definition`][Name::Definition] /// * **Content model**: - /// [`DefinitionTitleMarker`][Token::DefinitionTitleMarker], - /// [`DefinitionTitleString`][Token::DefinitionTitleString], - /// [`LineEnding`][Token::LineEnding], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`DefinitionTitleMarker`][Name::DefinitionTitleMarker], + /// [`DefinitionTitleString`][Name::DefinitionTitleString], + /// [`LineEnding`][Name::LineEnding], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`title`][crate::construct::partial_title] /// @@ -790,7 +790,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`DefinitionTitle`][Token::DefinitionTitle] + /// [`DefinitionTitle`][Name::DefinitionTitle] /// * **Content model**: /// void /// * **Construct**: @@ -808,7 +808,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`DefinitionTitle`][Token::DefinitionTitle] + /// [`DefinitionTitle`][Name::DefinitionTitle] /// * **Content model**: /// [string content][crate::content::string] /// * **Construct**: @@ -828,8 +828,8 @@ pub enum Name { /// * **Context**: /// [text content][crate::content::text] /// * **Content model**: - /// [`EmphasisSequence`][Token::EmphasisSequence], - /// [`EmphasisText`][Token::EmphasisText] + /// [`EmphasisSequence`][Name::EmphasisSequence], + /// [`EmphasisText`][Name::EmphasisText] /// * **Construct**: /// [`attention`][crate::construct::attention] /// @@ -845,7 +845,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Emphasis`][Token::Emphasis] + /// [`Emphasis`][Name::Emphasis] /// * **Content model**: /// void /// * **Construct**: @@ -863,7 +863,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Emphasis`][Token::Emphasis] + /// [`Emphasis`][Name::Emphasis] /// * **Content model**: /// [text content][crate::content::text] /// * **Construct**: @@ -921,9 +921,9 @@ pub enum Name { /// * **Context**: /// [flow content][crate::content::flow] /// * **Content model**: - /// [`HeadingAtxSequence`][Token::HeadingAtxSequence], - /// [`HeadingAtxText`][Token::HeadingAtxText], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`HeadingAtxSequence`][Name::HeadingAtxSequence], + /// [`HeadingAtxText`][Name::HeadingAtxText], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`heading_atx`][crate::construct::heading_atx] /// @@ -939,7 +939,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`HeadingAtx`][Token::HeadingAtx] + /// [`HeadingAtx`][Name::HeadingAtx] /// * **Content model**: /// void /// * **Construct**: @@ -957,7 +957,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`HeadingAtx`][Token::HeadingAtx], + /// [`HeadingAtx`][Name::HeadingAtx], /// * **Content model**: /// [text content][crate::content::text] /// * **Construct**: @@ -977,10 +977,10 @@ pub enum Name { /// * **Context**: /// [flow content][crate::content::flow] /// * **Content model**: - /// [`HeadingSetextText`][Token::HeadingSetextText], - /// [`HeadingSetextUnderline`][Token::HeadingSetextUnderline], - /// [`LineEnding`][Token::LineEnding], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`HeadingSetextText`][Name::HeadingSetextText], + /// [`HeadingSetextUnderline`][Name::HeadingSetextUnderline], + /// [`LineEnding`][Name::LineEnding], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`heading_setext`][crate::construct::heading_setext] /// @@ -998,7 +998,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`HeadingSetext`][Token::HeadingSetext] + /// [`HeadingSetext`][Name::HeadingSetext] /// * **Content model**: /// [text content][crate::content::text] /// * **Construct**: @@ -1017,7 +1017,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`HeadingSetext`][Token::HeadingSetext] + /// [`HeadingSetext`][Name::HeadingSetext] /// * **Content model**: /// void /// * **Construct**: @@ -1038,9 +1038,9 @@ pub enum Name { /// * **Context**: /// [flow content][crate::content::flow] /// * **Content model**: - /// [`HtmlFlowData`][Token::HtmlFlowData], - /// [`LineEnding`][Token::LineEnding], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`HtmlFlowData`][Name::HtmlFlowData], + /// [`LineEnding`][Name::LineEnding], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`html_flow`][crate::construct::html_flow] /// @@ -1056,7 +1056,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`HtmlFlow`][Token::HtmlFlow], + /// [`HtmlFlow`][Name::HtmlFlow], /// * **Content model**: /// void /// * **Construct**: @@ -1076,9 +1076,9 @@ pub enum Name { /// * **Context**: /// [text content][crate::content::text] /// * **Content model**: - /// [`HtmlTextData`][Token::HtmlTextData], - /// [`LineEnding`][Token::LineEnding], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`HtmlTextData`][Name::HtmlTextData], + /// [`LineEnding`][Name::LineEnding], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`html_text`][crate::construct::html_text] /// @@ -1094,7 +1094,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`HtmlText`][Token::HtmlText] + /// [`HtmlText`][Name::HtmlText] /// * **Content model**: /// void /// * **Construct**: @@ -1114,9 +1114,9 @@ pub enum Name { /// * **Context**: /// [text content][crate::content::text] /// * **Content model**: - /// [`Label`][Token::Label], - /// [`Resource`][Token::Resource], - /// [`Reference`][Token::Reference] + /// [`Label`][Name::Label], + /// [`Resource`][Name::Resource], + /// [`Reference`][Name::Reference] /// * **Construct**: /// [`label_end`][crate::construct::label_end] /// @@ -1136,13 +1136,13 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Image`][Token::Image], - /// [`Link`][Token::Link] + /// [`Image`][Name::Image], + /// [`Link`][Name::Link] /// * **Content model**: - /// [`LabelImage`][Token::LabelImage], - /// [`LabelLink`][Token::LabelLink], - /// [`LabelEnd`][Token::LabelEnd], - /// [`LabelText`][Token::LabelText] + /// [`LabelImage`][Name::LabelImage], + /// [`LabelLink`][Name::LabelLink], + /// [`LabelEnd`][Name::LabelEnd], + /// [`LabelText`][Name::LabelText] /// * **Construct**: /// [`label_end`][crate::construct::label_end] /// @@ -1162,9 +1162,9 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Label`][Token::Label] + /// [`Label`][Name::Label] /// * **Content model**: - /// [`LabelMarker`][Token::LabelMarker] + /// [`LabelMarker`][Name::LabelMarker] /// * **Construct**: /// [`label_end`][crate::construct::label_end] /// @@ -1182,10 +1182,10 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Label`][Token::Label] + /// [`Label`][Name::Label] /// * **Content model**: - /// [`LabelImageMarker`][Token::LabelImageMarker], - /// [`LabelMarker`][Token::LabelMarker] + /// [`LabelImageMarker`][Name::LabelImageMarker], + /// [`LabelMarker`][Name::LabelMarker] /// * **Construct**: /// [`label_start_image`][crate::construct::label_start_image] /// @@ -1201,7 +1201,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`LabelImage`][Token::LabelImage] + /// [`LabelImage`][Name::LabelImage] /// * **Content model**: /// void /// * **Construct**: @@ -1219,9 +1219,9 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Label`][Token::Label] + /// [`Label`][Name::Label] /// * **Content model**: - /// [`LabelMarker`][Token::LabelMarker] + /// [`LabelMarker`][Name::LabelMarker] /// * **Construct**: /// [`label_start_link`][crate::construct::label_start_link] /// @@ -1237,9 +1237,9 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`LabelImage`][Token::LabelImage], - /// [`LabelLink`][Token::LabelLink], - /// [`LabelEnd`][Token::LabelEnd] + /// [`LabelImage`][Name::LabelImage], + /// [`LabelLink`][Name::LabelLink], + /// [`LabelEnd`][Name::LabelEnd] /// * **Content model**: /// void /// * **Construct**: @@ -1261,7 +1261,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Label`][Token::Label] + /// [`Label`][Name::Label] /// * **Content model**: /// [text content][crate::content::text] /// * **Construct**: @@ -1304,9 +1304,9 @@ pub enum Name { /// * **Context**: /// [text content][crate::content::text] /// * **Content model**: - /// [`Label`][Token::Label], - /// [`Resource`][Token::Resource], - /// [`Reference`][Token::Reference] + /// [`Label`][Name::Label], + /// [`Resource`][Name::Resource], + /// [`Reference`][Name::Reference] /// * **Construct**: /// [`label_end`][crate::construct::label_end] /// @@ -1326,10 +1326,10 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`ListOrdered`][Token::ListOrdered], - /// [`ListUnordered`][Token::ListUnordered], + /// [`ListOrdered`][Name::ListOrdered], + /// [`ListUnordered`][Name::ListUnordered], /// * **Content model**: - /// [`ListItemPrefix`][Token::ListItemPrefix], + /// [`ListItemPrefix`][Name::ListItemPrefix], /// [flow content][crate::content::flow] /// * **Construct**: /// [`list`][crate::construct::list] @@ -1348,7 +1348,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`ListItemPrefix`][Token::ListItemPrefix] + /// [`ListItemPrefix`][Name::ListItemPrefix] /// * **Content model**: /// void /// * **Construct**: @@ -1368,11 +1368,11 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`ListItem`][Token::ListItem] + /// [`ListItem`][Name::ListItem] /// * **Content model**: - /// [`ListItemMarker`][Token::ListItemMarker], - /// [`ListItemValue`][Token::ListItemValue], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`ListItemMarker`][Name::ListItemMarker], + /// [`ListItemValue`][Name::ListItemValue], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`list`][crate::construct::list] /// @@ -1390,7 +1390,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`ListItemPrefix`][Token::ListItemPrefix] + /// [`ListItemPrefix`][Name::ListItemPrefix] /// * **Content model**: /// void /// * **Construct**: @@ -1410,11 +1410,11 @@ pub enum Name { /// * **Context**: /// [document content][crate::content::document] /// * **Content model**: - /// [`BlankLineEnding`][Token::BlankLineEnding], - /// [`BlockQuotePrefix`][Token::BlockQuotePrefix], - /// [`ListItem`][Token::ListItem], - /// [`LineEnding`][Token::LineEnding], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`BlankLineEnding`][Name::BlankLineEnding], + /// [`BlockQuotePrefix`][Name::BlockQuotePrefix], + /// [`ListItem`][Name::ListItem], + /// [`LineEnding`][Name::LineEnding], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`list`][crate::construct::list] /// @@ -1434,11 +1434,11 @@ pub enum Name { /// * **Context**: /// [document content][crate::content::document] /// * **Content model**: - /// [`BlankLineEnding`][Token::BlankLineEnding], - /// [`BlockQuotePrefix`][Token::BlockQuotePrefix], - /// [`ListItem`][Token::ListItem], - /// [`LineEnding`][Token::LineEnding], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`BlankLineEnding`][Name::BlankLineEnding], + /// [`BlockQuotePrefix`][Name::BlockQuotePrefix], + /// [`ListItem`][Name::ListItem], + /// [`LineEnding`][Name::LineEnding], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`list`][crate::construct::list] /// @@ -1476,11 +1476,11 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Image`][Token::Image], - /// [`Link`][Token::Link] + /// [`Image`][Name::Image], + /// [`Link`][Name::Link] /// * **Content model**: - /// [`ReferenceMarker`][Token::ReferenceMarker], - /// [`ReferenceString`][Token::ReferenceString] + /// [`ReferenceMarker`][Name::ReferenceMarker], + /// [`ReferenceString`][Name::ReferenceString] /// * **Construct**: /// [`label`][crate::construct::partial_label] /// @@ -1496,7 +1496,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Reference`][Token::Reference] + /// [`Reference`][Name::Reference] /// * **Content model**: /// void /// * **Construct**: @@ -1514,7 +1514,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Reference`][Token::Reference] + /// [`Reference`][Name::Reference] /// * **Content model**: /// [string content][crate::content::string] /// * **Construct**: @@ -1532,14 +1532,14 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Image`][Token::Image], - /// [`Link`][Token::Link] + /// [`Image`][Name::Image], + /// [`Link`][Name::Link] /// * **Content model**: - /// [`ResourceMarker`][Token::ResourceMarker], - /// [`ResourceDestination`][Token::ResourceDestination], - /// [`ResourceTitle`][Token::ResourceTitle], - /// [`SpaceOrTab`][Token::SpaceOrTab], - /// [`LineEnding`][Token::LineEnding] + /// [`ResourceMarker`][Name::ResourceMarker], + /// [`ResourceDestination`][Name::ResourceDestination], + /// [`ResourceTitle`][Name::ResourceTitle], + /// [`SpaceOrTab`][Name::SpaceOrTab], + /// [`LineEnding`][Name::LineEnding] /// * **Construct**: /// [`label_end`][crate::construct::label_end] /// @@ -1557,10 +1557,10 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Resource`][Token::Resource] + /// [`Resource`][Name::Resource] /// * **Content model**: - /// [`ResourceDestinationLiteral`][Token::ResourceDestinationLiteral], - /// [`ResourceDestinationRaw`][Token::ResourceDestinationRaw] + /// [`ResourceDestinationLiteral`][Name::ResourceDestinationLiteral], + /// [`ResourceDestinationRaw`][Name::ResourceDestinationRaw] /// * **Construct**: /// [`destination`][crate::construct::partial_destination] /// @@ -1576,10 +1576,10 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`ResourceDestination`][Token::ResourceDestination] + /// [`ResourceDestination`][Name::ResourceDestination] /// * **Content model**: - /// [`ResourceDestinationLiteralMarker`][Token::ResourceDestinationLiteralMarker], - /// [`ResourceDestinationString`][Token::ResourceDestinationString] + /// [`ResourceDestinationLiteralMarker`][Name::ResourceDestinationLiteralMarker], + /// [`ResourceDestinationString`][Name::ResourceDestinationString] /// * **Construct**: /// [`destination`][crate::construct::partial_destination] /// @@ -1595,7 +1595,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`ResourceDestinationLiteral`][Token::ResourceDestinationLiteral] + /// [`ResourceDestinationLiteral`][Name::ResourceDestinationLiteral] /// * **Content model**: /// void /// * **Construct**: @@ -1613,9 +1613,9 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`ResourceDestination`][Token::ResourceDestination] + /// [`ResourceDestination`][Name::ResourceDestination] /// * **Content model**: - /// [`ResourceDestinationString`][Token::ResourceDestinationString] + /// [`ResourceDestinationString`][Name::ResourceDestinationString] /// * **Construct**: /// [`destination`][crate::construct::partial_destination] /// @@ -1631,8 +1631,8 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`ResourceDestinationLiteral`][Token::ResourceDestinationLiteral], - /// [`ResourceDestinationRaw`][Token::ResourceDestinationRaw] + /// [`ResourceDestinationLiteral`][Name::ResourceDestinationLiteral], + /// [`ResourceDestinationRaw`][Name::ResourceDestinationRaw] /// * **Content model**: /// [string content][crate::content::string] /// * **Construct**: @@ -1652,7 +1652,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Resource`][Token::Resource] + /// [`Resource`][Name::Resource] /// * **Content model**: /// void /// * **Construct**: @@ -1670,10 +1670,10 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Resource`][Token::Resource] + /// [`Resource`][Name::Resource] /// * **Content model**: - /// [`ResourceTitleMarker`][Token::ResourceTitleMarker], - /// [`ResourceTitleString`][Token::ResourceTitleString] + /// [`ResourceTitleMarker`][Name::ResourceTitleMarker], + /// [`ResourceTitleString`][Name::ResourceTitleString] /// * **Construct**: /// [`title`][crate::construct::partial_title] /// @@ -1689,7 +1689,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`ResourceTitle`][Token::ResourceTitle] + /// [`ResourceTitle`][Name::ResourceTitle] /// * **Content model**: /// void /// * **Construct**: @@ -1707,7 +1707,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`ResourceTitle`][Token::ResourceTitle] + /// [`ResourceTitle`][Name::ResourceTitle] /// * **Content model**: /// [string content][crate::content::string] /// * **Construct**: @@ -1745,8 +1745,8 @@ pub enum Name { /// * **Context**: /// [text content][crate::content::text] /// * **Content model**: - /// [`StrongSequence`][Token::StrongSequence], - /// [`StrongText`][Token::StrongText] + /// [`StrongSequence`][Name::StrongSequence], + /// [`StrongText`][Name::StrongText] /// * **Construct**: /// [`attention`][crate::construct::attention] /// @@ -1762,7 +1762,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Strong`][Token::Strong] + /// [`Strong`][Name::Strong] /// * **Content model**: /// void /// * **Construct**: @@ -1780,7 +1780,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`Strong`][Token::Strong] + /// [`Strong`][Name::Strong] /// * **Content model**: /// [text content][crate::content::text] /// * **Construct**: @@ -1800,8 +1800,8 @@ pub enum Name { /// * **Context**: /// [flow content][crate::content::flow] /// * **Content model**: - /// [`ThematicBreakSequence`][Token::ThematicBreakSequence], - /// [`SpaceOrTab`][Token::SpaceOrTab] + /// [`ThematicBreakSequence`][Name::ThematicBreakSequence], + /// [`SpaceOrTab`][Name::SpaceOrTab] /// * **Construct**: /// [`thematic_break`][crate::construct::thematic_break] /// @@ -1817,7 +1817,7 @@ pub enum Name { /// ## Info /// /// * **Context**: - /// [`ThematicBreak`][Token::ThematicBreak] + /// [`ThematicBreak`][Name::ThematicBreak] /// * **Content model**: /// void /// * **Construct**: diff --git a/src/state.rs b/src/state.rs index 7e28b0c..d5055e2 100644 --- a/src/state.rs +++ b/src/state.rs @@ -588,11 +588,11 @@ pub fn call(tokenizer: &mut Tokenizer, name: Name) -> State { Name::SpaceOrTabInside => construct::partial_space_or_tab::inside, Name::SpaceOrTabAfter => construct::partial_space_or_tab::after, - Name::SpaceOrTabEolStart => construct::partial_space_or_tab::eol_start, - Name::SpaceOrTabEolAfterFirst => construct::partial_space_or_tab::eol_after_first, - Name::SpaceOrTabEolAfterEol => construct::partial_space_or_tab::eol_after_eol, - Name::SpaceOrTabEolAtEol => construct::partial_space_or_tab::eol_at_eol, - Name::SpaceOrTabEolAfterMore => construct::partial_space_or_tab::eol_after_more, + Name::SpaceOrTabEolStart => construct::partial_space_or_tab_eol::eol_start, + Name::SpaceOrTabEolAfterFirst => construct::partial_space_or_tab_eol::eol_after_first, + Name::SpaceOrTabEolAfterEol => construct::partial_space_or_tab_eol::eol_after_eol, + Name::SpaceOrTabEolAtEol => construct::partial_space_or_tab_eol::eol_at_eol, + Name::SpaceOrTabEolAfterMore => construct::partial_space_or_tab_eol::eol_after_more, Name::StringStart => content::string::start, Name::StringBefore => content::string::before, diff --git a/src/subtokenize.rs b/src/subtokenize.rs index 9b7c6ae..588d2a3 100644 --- a/src/subtokenize.rs +++ b/src/subtokenize.rs @@ -6,9 +6,9 @@ //! `previous` and `next` links. //! These links: //! -//! * …must occur on [`Enter`][EventType::Enter] events only +//! * …must occur on [`Enter`][Kind::Enter] events only //! * …must occur on void events (they are followed by their corresponding -//! [`Exit`][EventType::Exit] event) +//! [`Exit`][Kind::Exit] event) //! * …must have `content_type` field to define the kind of subcontent //! //! Links will then be passed through a tokenizer for the corresponding content |