Merge branch 'diary_sexp'
This commit is contained in:
commit
34a0858473
@ -2161,8 +2161,6 @@ fn compare_diary_sexp<'b, 's>(
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let mut message = None;
|
||||
|
||||
// TODO: Compare :value
|
||||
|
||||
// TODO: Compare :caption
|
||||
// Compare name
|
||||
let name = get_property_quoted_string(emacs, ":name")?;
|
||||
@ -2174,6 +2172,16 @@ fn compare_diary_sexp<'b, 's>(
|
||||
));
|
||||
}
|
||||
|
||||
// Compare value
|
||||
let value = get_property_quoted_string(emacs, ":value")?;
|
||||
if value.as_ref().map(String::as_str) != Some(rust.value) {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Value mismatch (emacs != rust) {:?} != {:?}",
|
||||
value, rust.value
|
||||
));
|
||||
}
|
||||
|
||||
Ok(DiffResult {
|
||||
status: this_status,
|
||||
name: rust.get_elisp_name(),
|
||||
|
@ -1,14 +1,13 @@
|
||||
use nom::branch::alt;
|
||||
use nom::bytes::complete::is_not;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::character::complete::line_ending;
|
||||
use nom::combinator::eof;
|
||||
use nom::combinator::recognize;
|
||||
use nom::multi::many0;
|
||||
use nom::sequence::tuple;
|
||||
|
||||
use super::keyword::affiliated_keyword;
|
||||
use super::org_source::OrgSource;
|
||||
use super::util::get_name;
|
||||
use super::util::org_line_ending;
|
||||
use crate::context::RefContext;
|
||||
use crate::error::Res;
|
||||
use crate::parser::util::get_consumed;
|
||||
@ -22,9 +21,8 @@ pub(crate) fn diary_sexp<'b, 'g, 'r, 's>(
|
||||
) -> Res<OrgSource<'s>, DiarySexp<'s>> {
|
||||
let (input, affiliated_keywords) = many0(affiliated_keyword)(input)?;
|
||||
start_of_line(input)?;
|
||||
let (remaining, _clock) = tag("%%(")(input)?;
|
||||
let (remaining, _contents) = is_not("\r\n")(remaining)?;
|
||||
let (remaining, _eol) = alt((line_ending, eof))(remaining)?;
|
||||
let (remaining, value) = recognize(tuple((tag("%%("), is_not("\r\n"))))(input)?;
|
||||
let (remaining, _eol) = org_line_ending(remaining)?;
|
||||
|
||||
let source = get_consumed(input, remaining);
|
||||
Ok((
|
||||
@ -32,6 +30,7 @@ pub(crate) fn diary_sexp<'b, 'g, 'r, 's>(
|
||||
DiarySexp {
|
||||
source: source.into(),
|
||||
name: get_name(&affiliated_keywords),
|
||||
value: Into::<&str>::into(value),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ pub struct Clock<'s> {
|
||||
pub struct DiarySexp<'s> {
|
||||
pub source: &'s str,
|
||||
pub name: Option<&'s str>,
|
||||
pub value: &'s str,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user