Compare commits

..

No commits in common. "9cfb2fa052c9cabb28d79bcf0afdac48df7ddcd4" and "b943f9076663789935fdaa254637cb6e5e7eb8d7" have entirely different histories.

4 changed files with 6 additions and 20 deletions

View File

@ -58,7 +58,6 @@ fn _filtered_keyword<'s, F: Fn(OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s
affiliated_keywords: AffiliatedKeywords::default(), // To be populated by the caller if this keyword is in a context to support affiliated keywords. affiliated_keywords: AffiliatedKeywords::default(), // To be populated by the caller if this keyword is in a context to support affiliated keywords.
key: parsed_key.into(), key: parsed_key.into(),
value: "", value: "",
post_blank: None,
}, },
)); ));
} }
@ -72,7 +71,6 @@ fn _filtered_keyword<'s, F: Fn(OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s
affiliated_keywords: AffiliatedKeywords::default(), // To be populated by the caller if this keyword is in a context to support affiliated keywords. affiliated_keywords: AffiliatedKeywords::default(), // To be populated by the caller if this keyword is in a context to support affiliated keywords.
key: parsed_key.into(), key: parsed_key.into(),
value: parsed_value.into(), value: parsed_value.into(),
post_blank: None,
}, },
)) ))
} }
@ -91,13 +89,12 @@ where
AK: IntoIterator<Item = Keyword<'s>>, AK: IntoIterator<Item = Keyword<'s>>,
{ {
let (remaining, mut kw) = filtered_keyword(regular_keyword_key)(remaining)?; let (remaining, mut kw) = filtered_keyword(regular_keyword_key)(remaining)?;
let (remaining, post_blank) = let (remaining, _trailing_ws) =
maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?; maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?;
let source = get_consumed(input, remaining); let source = get_consumed(input, remaining);
kw.affiliated_keywords = kw.affiliated_keywords =
parse_affiliated_keywords(context.get_global_settings(), affiliated_keywords); parse_affiliated_keywords(context.get_global_settings(), affiliated_keywords);
kw.source = Into::<&str>::into(source); kw.source = Into::<&str>::into(source);
kw.post_blank = post_blank.map(Into::<&str>::into);
Ok((remaining, kw)) Ok((remaining, kw))
} }

View File

@ -134,7 +134,7 @@ pub(crate) fn radio_target<'b, 'g, 'r, 's>(
))(remaining)?; ))(remaining)?;
let (remaining, _closing) = tag(">>>")(remaining)?; let (remaining, _closing) = tag(">>>")(remaining)?;
let (remaining, post_blank) = let (remaining, _trailing_whitespace) =
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?; maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
let source = get_consumed(input, remaining); let source = get_consumed(input, remaining);
Ok(( Ok((
@ -142,7 +142,6 @@ pub(crate) fn radio_target<'b, 'g, 'r, 's>(
RadioTarget { RadioTarget {
source: source.into(), source: source.into(),
value: raw_value.into(), value: raw_value.into(),
post_blank: post_blank.map(Into::<&str>::into),
children, children,
}, },
)) ))

View File

@ -153,7 +153,6 @@ pub struct Keyword<'s> {
pub affiliated_keywords: AffiliatedKeywords<'s>, pub affiliated_keywords: AffiliatedKeywords<'s>,
pub key: &'s str, pub key: &'s str,
pub value: &'s str, pub value: &'s str,
pub post_blank: Option<&'s str>,
} }
#[derive(Debug)] #[derive(Debug)]
@ -388,15 +387,11 @@ impl<'s> StandardProperties<'s> for Keyword<'s> {
} }
fn get_contents<'b>(&'b self) -> Option<&'s str> { fn get_contents<'b>(&'b self) -> Option<&'s str> {
None todo!()
} }
fn get_post_blank(&self) -> PostBlank { fn get_post_blank(&self) -> PostBlank {
self.post_blank todo!()
.map(|text| text.lines().count())
.unwrap_or(0)
.try_into()
.expect("Too much post-blank to fit into a PostBlank.")
} }
} }

View File

@ -120,7 +120,6 @@ pub struct RegularLink<'s> {
pub struct RadioTarget<'s> { pub struct RadioTarget<'s> {
pub source: &'s str, pub source: &'s str,
pub value: &'s str, pub value: &'s str,
pub post_blank: Option<&'s str>,
pub children: Vec<Object<'s>>, pub children: Vec<Object<'s>>,
} }
@ -680,15 +679,11 @@ impl<'s> StandardProperties<'s> for RadioTarget<'s> {
} }
fn get_contents<'b>(&'b self) -> Option<&'s str> { fn get_contents<'b>(&'b self) -> Option<&'s str> {
Some(self.value) todo!()
} }
fn get_post_blank(&self) -> PostBlank { fn get_post_blank(&self) -> PostBlank {
self.post_blank todo!()
.map(|post_blank| post_blank.chars().count())
.unwrap_or(0)
.try_into()
.expect("Too much post-blank to fit into a PostBlank.")
} }
} }