Compare commits
No commits in common. "f141a4e186d648a144a431fcaae54e3b175e5632" and "4753f4c7c69f7027669d1a5cafb1e8529697309c" have entirely different histories.
f141a4e186
...
4753f4c7c6
@ -46,22 +46,16 @@ pub(crate) fn citation<'b, 'g, 'r, 's>(
|
||||
let (remaining, prefix) =
|
||||
must_balance_bracket(opt(parser_with_context!(global_prefix)(context)))(remaining)?;
|
||||
|
||||
let contents_begin = remaining;
|
||||
let (remaining, references) =
|
||||
separated_list1(tag(";"), parser_with_context!(citation_reference)(context))(remaining)?;
|
||||
let contents_end = {
|
||||
let (rem, _) = opt(tag(";"))(remaining)?;
|
||||
rem
|
||||
};
|
||||
let (remaining, suffix) = must_balance_bracket(opt(map(
|
||||
tuple((tag(";"), parser_with_context!(global_suffix)(context))),
|
||||
|(_, suffix)| suffix,
|
||||
)))(remaining)?;
|
||||
let (remaining, _) = tag("]")(remaining)?;
|
||||
let (remaining, post_blank) =
|
||||
let (remaining, _trailing_whitespace) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
let contents = contents_begin.get_until(contents_end);
|
||||
Ok((
|
||||
remaining,
|
||||
Citation {
|
||||
@ -70,8 +64,6 @@ pub(crate) fn citation<'b, 'g, 'r, 's>(
|
||||
prefix: prefix.unwrap_or(Vec::new()),
|
||||
suffix: suffix.unwrap_or(Vec::new()),
|
||||
children: references,
|
||||
contents: Into::<&str>::into(contents),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ pub(crate) fn org_macro<'b, 'g, 'r, 's>(
|
||||
let (remaining, macro_args) = opt(parser_with_context!(org_macro_args)(context))(remaining)?;
|
||||
let (remaining, _) = tag("}}}")(remaining)?;
|
||||
let macro_value = get_consumed(input, remaining);
|
||||
let (remaining, post_blank) =
|
||||
let (remaining, _trailing_whitespace) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
|
||||
let source = get_consumed(input, remaining);
|
||||
@ -47,7 +47,6 @@ pub(crate) fn org_macro<'b, 'g, 'r, 's>(
|
||||
.map(|arg| arg.into())
|
||||
.collect(),
|
||||
value: Into::<&str>::into(macro_value),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ pub(crate) fn radio_link<'b, 'g, 'r, 's>(
|
||||
let rematched_target = rematch_target(context, radio_target, input);
|
||||
if let Ok((remaining, rematched_target)) = rematched_target {
|
||||
let path = get_consumed(input, remaining);
|
||||
let (remaining, post_blank) = space0(remaining)?;
|
||||
let (remaining, _) = space0(remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
return Ok((
|
||||
remaining,
|
||||
@ -47,11 +47,6 @@ pub(crate) fn radio_link<'b, 'g, 'r, 's>(
|
||||
source: source.into(),
|
||||
children: rematched_target,
|
||||
path: path.into(),
|
||||
post_blank: if post_blank.len() > 0 {
|
||||
Some(Into::<&str>::into(post_blank))
|
||||
} else {
|
||||
None
|
||||
},
|
||||
},
|
||||
));
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ fn diary_timestamp<'b, 'g, 'r, 's>(
|
||||
let (remaining, _) = tag("<%%(")(input)?;
|
||||
let (remaining, _body) = sexp(context, remaining)?;
|
||||
let (remaining, _) = tag(")>")(remaining)?;
|
||||
let (remaining, post_blank) =
|
||||
let (remaining, _trailing_whitespace) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
|
||||
@ -85,7 +85,6 @@ fn diary_timestamp<'b, 'g, 'r, 's>(
|
||||
end_time: None,
|
||||
repeater: None,
|
||||
warning_delay: None,
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -160,7 +159,7 @@ fn active_timestamp<'b, 'g, 'r, 's>(
|
||||
)))(remaining)?;
|
||||
let (remaining, _) = tag(">")(remaining)?;
|
||||
|
||||
let (remaining, post_blank) =
|
||||
let (remaining, _trailing_whitespace) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
|
||||
@ -176,7 +175,6 @@ fn active_timestamp<'b, 'g, 'r, 's>(
|
||||
end_time: time.map(|(_, time)| time),
|
||||
repeater: repeater.map(|(_, repeater)| repeater),
|
||||
warning_delay: warning_delay.map(|(_, warning_delay)| warning_delay),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -215,7 +213,7 @@ pub(crate) fn inactive_timestamp<'b, 'g, 'r, 's>(
|
||||
)))(remaining)?;
|
||||
let (remaining, _) = tag("]")(remaining)?;
|
||||
|
||||
let (remaining, post_blank) =
|
||||
let (remaining, _trailing_whitespace) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
|
||||
@ -231,7 +229,6 @@ pub(crate) fn inactive_timestamp<'b, 'g, 'r, 's>(
|
||||
end_time: time.map(|(_, time)| time),
|
||||
repeater: repeater.map(|(_, repeater)| repeater),
|
||||
warning_delay: warning_delay.map(|(_, warning_delay)| warning_delay),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -249,7 +246,7 @@ fn active_date_range_timestamp<'b, 'g, 'r, 's>(
|
||||
let (remaining, _separator) = tag("--")(remaining)?;
|
||||
let (remaining, second_timestamp) = active_timestamp(context, remaining)?;
|
||||
|
||||
let (remaining, post_blank) =
|
||||
let (remaining, _trailing_whitespace) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
|
||||
@ -267,7 +264,6 @@ fn active_date_range_timestamp<'b, 'g, 'r, 's>(
|
||||
warning_delay: first_timestamp
|
||||
.warning_delay
|
||||
.or(second_timestamp.warning_delay),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -306,7 +302,7 @@ fn active_time_range_timestamp<'b, 'g, 'r, 's>(
|
||||
)))(remaining)?;
|
||||
let (remaining, _) = tag(">")(remaining)?;
|
||||
|
||||
let (remaining, post_blank) =
|
||||
let (remaining, _trailing_whitespace) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
|
||||
@ -322,7 +318,6 @@ fn active_time_range_timestamp<'b, 'g, 'r, 's>(
|
||||
end_time: Some(second_time),
|
||||
repeater: repeater.map(|(_, repeater)| repeater),
|
||||
warning_delay: warning_delay.map(|(_, warning_delay)| warning_delay),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -340,7 +335,7 @@ pub(crate) fn inactive_date_range_timestamp<'b, 'g, 'r, 's>(
|
||||
let (remaining, _separator) = tag("--")(remaining)?;
|
||||
let (remaining, second_timestamp) = inactive_timestamp(context, remaining)?;
|
||||
|
||||
let (remaining, post_blank) =
|
||||
let (remaining, _trailing_whitespace) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
|
||||
@ -359,7 +354,6 @@ pub(crate) fn inactive_date_range_timestamp<'b, 'g, 'r, 's>(
|
||||
warning_delay: first_timestamp
|
||||
.warning_delay
|
||||
.or(second_timestamp.warning_delay),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -398,7 +392,7 @@ pub(crate) fn inactive_time_range_timestamp<'b, 'g, 'r, 's>(
|
||||
)))(remaining)?;
|
||||
let (remaining, _) = tag("]")(remaining)?;
|
||||
|
||||
let (remaining, post_blank) =
|
||||
let (remaining, _trailing_whitespace) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
|
||||
@ -414,7 +408,6 @@ pub(crate) fn inactive_time_range_timestamp<'b, 'g, 'r, 's>(
|
||||
end_time: Some(second_time),
|
||||
repeater: repeater.map(|(_, repeater)| repeater),
|
||||
warning_delay: warning_delay.map(|(_, warning_delay)| warning_delay),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -128,7 +128,6 @@ pub struct RadioTarget<'s> {
|
||||
pub struct RadioLink<'s> {
|
||||
pub source: &'s str,
|
||||
pub path: &'s str,
|
||||
pub post_blank: Option<&'s str>,
|
||||
pub children: Vec<Object<'s>>,
|
||||
}
|
||||
|
||||
@ -177,7 +176,6 @@ pub struct OrgMacro<'s> {
|
||||
pub args: Vec<&'s str>,
|
||||
|
||||
pub value: &'s str,
|
||||
pub post_blank: Option<&'s str>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -224,8 +222,6 @@ pub struct Citation<'s> {
|
||||
pub prefix: Vec<Object<'s>>,
|
||||
pub suffix: Vec<Object<'s>>,
|
||||
pub children: Vec<CitationReference<'s>>,
|
||||
pub contents: &'s str,
|
||||
pub post_blank: Option<&'s str>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -302,7 +298,6 @@ pub struct Timestamp<'s> {
|
||||
pub end_time: Option<Time<'s>>,
|
||||
pub repeater: Option<Repeater>,
|
||||
pub warning_delay: Option<WarningDelay>,
|
||||
pub post_blank: Option<&'s str>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@ -676,15 +671,11 @@ impl<'s> StandardProperties<'s> for RadioLink<'s> {
|
||||
}
|
||||
|
||||
fn get_contents<'b>(&'b self) -> Option<&'s str> {
|
||||
Some(self.path)
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_post_blank(&self) -> PostBlank {
|
||||
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.")
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -748,15 +739,11 @@ impl<'s> StandardProperties<'s> for OrgMacro<'s> {
|
||||
}
|
||||
|
||||
fn get_contents<'b>(&'b self) -> Option<&'s str> {
|
||||
None
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_post_blank(&self) -> PostBlank {
|
||||
self.post_blank
|
||||
.map(|text| text.chars().count())
|
||||
.unwrap_or(0)
|
||||
.try_into()
|
||||
.expect("Too much post-blank to fit into a PostBlank.")
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -834,15 +821,11 @@ impl<'s> StandardProperties<'s> for Citation<'s> {
|
||||
}
|
||||
|
||||
fn get_contents<'b>(&'b self) -> Option<&'s str> {
|
||||
Some(self.contents)
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_post_blank(&self) -> PostBlank {
|
||||
self.post_blank
|
||||
.map(|text| text.chars().count())
|
||||
.unwrap_or(0)
|
||||
.try_into()
|
||||
.expect("Too much post-blank to fit into a PostBlank.")
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -852,11 +835,11 @@ impl<'s> StandardProperties<'s> for CitationReference<'s> {
|
||||
}
|
||||
|
||||
fn get_contents<'b>(&'b self) -> Option<&'s str> {
|
||||
None
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_post_blank(&self) -> PostBlank {
|
||||
0
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -976,15 +959,11 @@ impl<'s> StandardProperties<'s> for Timestamp<'s> {
|
||||
}
|
||||
|
||||
fn get_contents<'b>(&'b self) -> Option<&'s str> {
|
||||
None
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_post_blank(&self) -> PostBlank {
|
||||
self.post_blank
|
||||
.map(|text| text.chars().count())
|
||||
.unwrap_or(0)
|
||||
.try_into()
|
||||
.expect("Too much post-blank to fit into a PostBlank.")
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user