Compare the objects in heading titles when diffing the asts.

This commit is contained in:
Tom Alexander 2023-04-22 22:56:36 -04:00
parent c2bf2c6994
commit 37b91d171d
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -243,6 +243,22 @@ fn compare_heading<'s>(
this_status = DiffStatus::Bad;
}
let title = {
let children = emacs.as_list()?;
let attributes_child = children
.iter()
.nth(1)
.ok_or("Should have an attributes child.")?;
let attributes_map = attributes_child.as_map()?;
let title = attributes_map
.get(":title")
.ok_or("Missing :title attribute.");
*title?
};
for (emacs_child, rust_child) in title.as_list()?.iter().zip(rust.title.iter()) {
child_status.push(compare_object(source, emacs_child, rust_child)?);
}
for (emacs_child, rust_child) in children.iter().skip(2).zip(rust.children.iter()) {
match rust_child {
DocumentElement::Heading(rust_heading) => {