From 37b91d171d98e0aae6d673928ec58b99fb1c012f Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 22 Apr 2023 22:56:36 -0400 Subject: [PATCH] Compare the objects in heading titles when diffing the asts. --- src/compare/diff.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/compare/diff.rs b/src/compare/diff.rs index 0583b74..1f13463 100644 --- a/src/compare/diff.rs +++ b/src/compare/diff.rs @@ -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) => {