Start adding paragraph.

This commit is contained in:
Tom Alexander 2023-12-27 18:47:59 -05:00
parent 90d4b11922
commit 5272e2f1b4
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 30 additions and 1 deletions

View File

@ -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;

View File

@ -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<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
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,