From 5272e2f1b4c184831c9e99a88861649cbca8c68e Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 27 Dec 2023 18:47:59 -0500 Subject: [PATCH] Start adding paragraph. --- src/wasm/mod.rs | 1 + src/wasm_test/compare.rs | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/wasm/mod.rs b/src/wasm/mod.rs index 3ba6002..0b9ddef 100644 --- a/src/wasm/mod.rs +++ b/src/wasm/mod.rs @@ -68,6 +68,7 @@ pub use additional_property::AdditionalPropertyValue; pub use ast_node::WasmAstNode; pub use document::WasmDocument; pub(crate) use headline::WasmHeadline; +pub(crate) use paragraph::WasmParagraph; pub use parse_result::ParseResult; pub(crate) use section::WasmSection; pub(crate) use standard_properties::WasmStandardProperties; diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index 59ed97f..01c2090 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -13,6 +13,7 @@ use crate::wasm::AdditionalPropertyValue; use crate::wasm::WasmAstNode; use crate::wasm::WasmDocument; use crate::wasm::WasmHeadline; +use crate::wasm::WasmParagraph; use crate::wasm::WasmSection; use crate::wasm::WasmStandardProperties; use crate::wasm_test::macros::wasm_compare; @@ -189,7 +190,7 @@ impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmAstNode<'s, 'p> { WasmAstNode::Document(inner) => inner.compare_ast_node(source, emacs), WasmAstNode::Headline(inner) => inner.compare_ast_node(source, emacs), WasmAstNode::Section(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Paragraph(_) => todo!(), + WasmAstNode::Paragraph(inner) => inner.compare_ast_node(source, emacs), WasmAstNode::PlainList(_) => todo!(), WasmAstNode::PlainListItem(_) => todo!(), WasmAstNode::CenterBlock(_) => todo!(), @@ -327,6 +328,33 @@ impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSection<'s, 'p> { } } +impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmParagraph<'s, 'p> { + fn compare_ast_node<'b>( + &self, + source: &'s str, + emacs: &'b Token<'s>, + ) -> Result, Box> { + let result = WasmDiffResult::default(); + // let result = wasm_compare!( + // source, + // emacs, + // self, + // ( + // EmacsField::Required(":path"), + // |w| w.path.as_ref().and_then(|p| p.to_str()), + // wasm_compare_property_quoted_string + // ), + // ( + // EmacsField::Required(":CATEGORY"), + // |w| w.category.as_ref(), + // wasm_compare_property_quoted_string + // ) + // ); + + Ok(result) + } +} + fn wasm_compare_property_quoted_string< 'b, 's,