Compare range type.
This commit is contained in:
parent
d04c8c832c
commit
3ed9b552e2
@ -74,6 +74,7 @@ use crate::types::TableCell;
|
||||
use crate::types::TableRow;
|
||||
use crate::types::Target;
|
||||
use crate::types::Timestamp;
|
||||
use crate::types::TimestampRangeType;
|
||||
use crate::types::TimestampType;
|
||||
use crate::types::TodoKeywordType;
|
||||
use crate::types::Underline;
|
||||
@ -2137,6 +2138,19 @@ fn compare_timestamp<'b, 's>(
|
||||
}
|
||||
}
|
||||
|
||||
let range_type = get_property_unquoted_atom(emacs, ":range-type")?;
|
||||
match (range_type, &rust.range_type) {
|
||||
(Some("daterange"), TimestampRangeType::DateRange) => {}
|
||||
(None, TimestampRangeType::None) => {}
|
||||
_ => {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Range type mismatch (emacs != rust) {:?} != {:?}",
|
||||
range_type, rust.range_type
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Compare :type :range-type :raw-value :year-start :month-start :day-start :hour-start :minute-start :year-end :month-end :day-end :hour-end :minute-end :repeater-type :repeater-value :repeater-unit :warning-type :warning-value :warning-unit
|
||||
//
|
||||
// :type unquoted atom either diary, active, inactive, active-range, or inactive-range.
|
||||
|
@ -22,6 +22,7 @@ use crate::context::RefContext;
|
||||
use crate::error::Res;
|
||||
use crate::parser::util::get_consumed;
|
||||
use crate::types::Timestamp;
|
||||
use crate::types::TimestampRangeType;
|
||||
use crate::types::TimestampType;
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
@ -59,6 +60,7 @@ fn diary_timestamp<'b, 'g, 'r, 's>(
|
||||
Timestamp {
|
||||
source: source.into(),
|
||||
timestamp_type: TimestampType::Diary,
|
||||
range_type: TimestampRangeType::None,
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -124,6 +126,7 @@ fn active_timestamp<'b, 'g, 'r, 's>(
|
||||
Timestamp {
|
||||
source: source.into(),
|
||||
timestamp_type: TimestampType::Active,
|
||||
range_type: TimestampRangeType::None,
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -159,6 +162,7 @@ fn inactive_timestamp<'b, 'g, 'r, 's>(
|
||||
Timestamp {
|
||||
source: source.into(),
|
||||
timestamp_type: TimestampType::Inactive,
|
||||
range_type: TimestampRangeType::None,
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -182,6 +186,7 @@ fn active_date_range_timestamp<'b, 'g, 'r, 's>(
|
||||
Timestamp {
|
||||
source: source.into(),
|
||||
timestamp_type: TimestampType::ActiveRange,
|
||||
range_type: TimestampRangeType::DateRange,
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -224,6 +229,7 @@ fn active_time_range_timestamp<'b, 'g, 'r, 's>(
|
||||
Timestamp {
|
||||
source: source.into(),
|
||||
timestamp_type: TimestampType::Active,
|
||||
range_type: TimestampRangeType::None,
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -248,6 +254,7 @@ fn inactive_date_range_timestamp<'b, 'g, 'r, 's>(
|
||||
source: source.into(),
|
||||
|
||||
timestamp_type: TimestampType::InactiveRange,
|
||||
range_type: TimestampRangeType::DateRange,
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -290,6 +297,7 @@ fn inactive_time_range_timestamp<'b, 'g, 'r, 's>(
|
||||
Timestamp {
|
||||
source: source.into(),
|
||||
timestamp_type: TimestampType::Inactive,
|
||||
range_type: TimestampRangeType::None,
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ pub use object::Subscript;
|
||||
pub use object::Superscript;
|
||||
pub use object::Target;
|
||||
pub use object::Timestamp;
|
||||
pub use object::TimestampRangeType;
|
||||
pub use object::TimestampType;
|
||||
pub use object::Underline;
|
||||
pub use object::Verbatim;
|
||||
|
@ -186,6 +186,7 @@ pub struct Superscript<'s> {
|
||||
pub struct Timestamp<'s> {
|
||||
pub source: &'s str,
|
||||
pub timestamp_type: TimestampType,
|
||||
pub range_type: TimestampRangeType,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@ -197,6 +198,12 @@ pub enum TimestampType {
|
||||
InactiveRange,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum TimestampRangeType {
|
||||
None,
|
||||
DateRange,
|
||||
}
|
||||
|
||||
impl<'s> GetStandardProperties<'s> for Object<'s> {
|
||||
fn get_standard_properties<'b>(&'b self) -> &'b dyn StandardProperties<'s> {
|
||||
match self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user