From 5ac12229f4e1f927375ccffb92a79c50469681ab Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 9 Oct 2023 13:23:08 -0400 Subject: [PATCH] Fix footnote reference type. --- src/compare/diff.rs | 6 +++++- src/types/mod.rs | 1 + src/types/object.rs | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/compare/diff.rs b/src/compare/diff.rs index 74ac74f..9a0fe22 100644 --- a/src/compare/diff.rs +++ b/src/compare/diff.rs @@ -54,6 +54,7 @@ use crate::types::ExportSnippet; use crate::types::FixedWidthArea; use crate::types::FootnoteDefinition; use crate::types::FootnoteReference; +use crate::types::FootnoteReferenceType; use crate::types::GetStandardProperties; use crate::types::Heading; use crate::types::HorizontalRule; @@ -3323,7 +3324,10 @@ fn compare_footnote_reference<'b, 's>( ), ( EmacsField::Required(":type"), - |_| Some("inline"), + |r| Some(match r.get_type() { + FootnoteReferenceType::Standard => "standard", + FootnoteReferenceType::Inline => "inline", + }), compare_property_unquoted_atom ) )? { diff --git a/src/types/mod.rs b/src/types/mod.rs index 8148c0d..fc93c5a 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -69,6 +69,7 @@ pub use object::DayOfMonthInner; pub use object::Entity; pub use object::ExportSnippet; pub use object::FootnoteReference; +pub use object::FootnoteReferenceType; pub use object::Hour; pub use object::HourInner; pub use object::InlineBabelCall; diff --git a/src/types/object.rs b/src/types/object.rs index 62cf507..f8b88d9 100644 --- a/src/types/object.rs +++ b/src/types/object.rs @@ -764,3 +764,19 @@ impl<'s> OrgMacro<'s> { .map(|arg| coalesce_whitespace_escaped('\\', |c| ",".contains(c))(*arg)) } } + +#[derive(Debug, PartialEq)] +pub enum FootnoteReferenceType { + Standard, + Inline, +} + +impl<'s> FootnoteReference<'s> { + pub fn get_type(&self) -> FootnoteReferenceType { + if self.definition.is_empty() { + FootnoteReferenceType::Standard + } else { + FootnoteReferenceType::Inline + } + } +}