Make the types more consistent.
This commit is contained in:
@@ -39,8 +39,8 @@ fn flat_text_element<'s, 'r>(
|
||||
let link_matcher = parser_with_context!(flat_link)(context);
|
||||
|
||||
alt((
|
||||
bold_matcher,
|
||||
link_matcher,
|
||||
map(bold_matcher, TextElement::Bold),
|
||||
map(link_matcher, TextElement::Link),
|
||||
map(span, TextElement::Span),
|
||||
map(symbol("*"), TextElement::Symbol),
|
||||
map(symbol("["), TextElement::Symbol),
|
||||
@@ -54,14 +54,14 @@ fn recognize_bold_end(input: &str) -> Res<&str, &str> {
|
||||
recognize(bold_end)(input)
|
||||
}
|
||||
|
||||
fn flat_bold<'s, 'r>(i: &'s str, context: &'r OrgModeContext<'r>) -> Res<&'s str, TextElement<'s>> {
|
||||
fn flat_bold<'s, 'r>(i: &'s str, context: &'r OrgModeContext<'r>) -> Res<&'s str, Bold<'s>> {
|
||||
let new_context = context.with_additional_fail_matcher(&recognize_bold_end);
|
||||
let text_element_parser = parser_with_context!(flat_text_element)(&new_context);
|
||||
let (remaining, captured) = recognize(tuple((
|
||||
bold_start,
|
||||
many_till(text_element_parser, bold_end),
|
||||
)))(i)?;
|
||||
let ret = TextElement::Bold(Bold { contents: captured });
|
||||
let ret = Bold { contents: captured };
|
||||
Ok((remaining, ret))
|
||||
}
|
||||
|
||||
@@ -69,14 +69,14 @@ fn recognize_link_end(input: &str) -> Res<&str, &str> {
|
||||
recognize(link_end)(input)
|
||||
}
|
||||
|
||||
fn flat_link<'s, 'r>(i: &'s str, context: &'r OrgModeContext<'r>) -> Res<&'s str, TextElement<'s>> {
|
||||
fn flat_link<'s, 'r>(i: &'s str, context: &'r OrgModeContext<'r>) -> Res<&'s str, Link<'s>> {
|
||||
let new_context = context.with_additional_fail_matcher(&recognize_link_end);
|
||||
let text_element_parser = parser_with_context!(flat_text_element)(&new_context);
|
||||
let (remaining, captured) = recognize(tuple((
|
||||
link_start,
|
||||
many_till(text_element_parser, link_end),
|
||||
)))(i)?;
|
||||
let ret = TextElement::Link(Link { contents: captured });
|
||||
let ret = Link { contents: captured };
|
||||
Ok((remaining, ret))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user