aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/partial_title.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-12 17:28:19 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-12 17:28:19 +0200
commit6dc2011d69c85820feddf6799142d304cc2eeb29 (patch)
tree29d8774a526631052ba6cd56be2492e5e249d494 /src/construct/partial_title.rs
parent1234de9c22343fc4e1fe9e3e1127d2db01e96c2f (diff)
downloadmarkdown-rs-6dc2011d69c85820feddf6799142d304cc2eeb29.tar.gz
markdown-rs-6dc2011d69c85820feddf6799142d304cc2eeb29.tar.bz2
markdown-rs-6dc2011d69c85820feddf6799142d304cc2eeb29.zip
Refactor to improve entering
Diffstat (limited to '')
-rw-r--r--src/construct/partial_title.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/construct/partial_title.rs b/src/construct/partial_title.rs
index b97243e..93dbd28 100644
--- a/src/construct/partial_title.rs
+++ b/src/construct/partial_title.rs
@@ -31,7 +31,7 @@
//! [label_end]: crate::construct::label_end
use crate::construct::partial_space_or_tab_eol::{space_or_tab_eol_with_options, Options};
-use crate::event::{Content, Name};
+use crate::event::{Content, Link, Name};
use crate::state::{Name as StateName, State};
use crate::subtokenize::link;
use crate::tokenizer::Tokenizer;
@@ -106,7 +106,7 @@ pub fn at_break(tokenizer: &mut Tokenizer) -> State {
State::Retry(space_or_tab_eol_with_options(
tokenizer,
Options {
- content_type: Some(Content::String),
+ content: Some(Content::String),
connect: tokenizer.tokenize_state.connect,
},
))
@@ -118,7 +118,14 @@ pub fn at_break(tokenizer: &mut Tokenizer) -> State {
State::Retry(StateName::TitleBegin)
}
Some(_) => {
- tokenizer.enter_with_content(Name::Data, Some(Content::String));
+ tokenizer.enter_link(
+ Name::Data,
+ Link {
+ previous: None,
+ next: None,
+ content: Content::String,
+ },
+ );
if tokenizer.tokenize_state.connect {
let index = tokenizer.events.len() - 1;