Implement the new fields for regular link.
This commit is contained in:
parent
0108f5b0b1
commit
b943f90766
@ -73,7 +73,7 @@ fn regular_link_without_description<'b, 'g, 'r, 's>(
|
||||
let (remaining, _opening_bracket) = tag("[[")(input)?;
|
||||
let (remaining, path) = pathreg(context, remaining)?;
|
||||
let (remaining, _closing_bracket) = tag("]]")(remaining)?;
|
||||
let (remaining, _trailing_whitespace) =
|
||||
let (remaining, post_blank) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
Ok((
|
||||
@ -84,6 +84,8 @@ fn regular_link_without_description<'b, 'g, 'r, 's>(
|
||||
path: path.path,
|
||||
raw_link: path.raw_link,
|
||||
search_option: path.search_option,
|
||||
contents: None,
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
children: Vec::new(),
|
||||
application: path.application,
|
||||
},
|
||||
@ -101,9 +103,10 @@ fn regular_link_with_description<'b, 'g, 'r, 's>(
|
||||
let (remaining, _opening_bracket) = tag("[[")(input)?;
|
||||
let (remaining, path) = pathreg(context, remaining)?;
|
||||
let (remaining, _closing_bracket) = tag("][")(remaining)?;
|
||||
let (remaining, description) = description(context, remaining)?;
|
||||
let (remaining, (contents, description)) =
|
||||
consumed(parser_with_context!(description)(context))(remaining)?;
|
||||
let (remaining, _closing_bracket) = tag("]]")(remaining)?;
|
||||
let (remaining, _trailing_whitespace) =
|
||||
let (remaining, post_blank) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
Ok((
|
||||
@ -114,6 +117,8 @@ fn regular_link_with_description<'b, 'g, 'r, 's>(
|
||||
path: path.path,
|
||||
raw_link: path.raw_link,
|
||||
search_option: path.search_option,
|
||||
contents: Some(Into::<&str>::into(contents)),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
children: description,
|
||||
application: path.application,
|
||||
},
|
||||
|
@ -110,6 +110,8 @@ pub struct RegularLink<'s> {
|
||||
/// This does not take into account the post-processing that you would get from the upstream emacs org-mode AST. Use `get_search_option` for an equivalent value.
|
||||
pub search_option: Option<Cow<'s, str>>,
|
||||
|
||||
pub contents: Option<&'s str>,
|
||||
pub post_blank: Option<&'s str>,
|
||||
pub children: Vec<Object<'s>>,
|
||||
pub application: Option<Cow<'s, str>>,
|
||||
}
|
||||
@ -645,11 +647,15 @@ impl<'s> StandardProperties<'s> for RegularLink<'s> {
|
||||
}
|
||||
|
||||
fn get_contents<'b>(&'b self) -> Option<&'s str> {
|
||||
todo!()
|
||||
self.contents
|
||||
}
|
||||
|
||||
fn get_post_blank(&self) -> PostBlank {
|
||||
todo!()
|
||||
self.post_blank
|
||||
.map(|post_blank| post_blank.chars().count())
|
||||
.unwrap_or(0)
|
||||
.try_into()
|
||||
.expect("Too much post-blank to fit into a PostBlank.")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user