Create structure for org macros.

This commit is contained in:
Tom Alexander
2023-07-13 23:26:51 -04:00
parent c0371ff958
commit d24c26de7b
5 changed files with 60 additions and 5 deletions

View File

@@ -24,6 +24,7 @@ use crate::parser::Italic;
use crate::parser::Keyword;
use crate::parser::LatexEnvironment;
use crate::parser::Object;
use crate::parser::OrgMacro;
use crate::parser::Paragraph;
use crate::parser::PlainLink;
use crate::parser::PlainList;
@@ -152,6 +153,7 @@ fn compare_object<'s>(
Object::RadioTarget(obj) => compare_radio_target(source, emacs, obj),
Object::PlainLink(obj) => compare_plain_link(source, emacs, obj),
Object::AngleLink(obj) => compare_angle_link(source, emacs, obj),
Object::OrgMacro(obj) => compare_org_macro(source, emacs, obj),
}
}
@@ -1213,3 +1215,26 @@ fn compare_angle_link<'s>(
children: Vec::new(),
})
}
fn compare_org_macro<'s>(
source: &'s str,
emacs: &'s Token<'s>,
rust: &'s OrgMacro<'s>,
) -> Result<DiffResult, Box<dyn std::error::Error>> {
let mut this_status = DiffStatus::Good;
let emacs_name = "macro";
if assert_name(emacs, emacs_name).is_err() {
this_status = DiffStatus::Bad;
}
if assert_bounds(source, emacs, rust).is_err() {
this_status = DiffStatus::Bad;
}
Ok(DiffResult {
status: this_status,
name: emacs_name.to_owned(),
message: None,
children: Vec::new(),
})
}