From 3e60b2746bb95cfcd9b7fa4b7ed9e1c72259fb23 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 8 Jun 2026 12:32:06 -0700 Subject: It parses correctly for everything defined. I think I'll change fragment to view, it's nicer and shorter. --- src/lib.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 25d9be1..dec06a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,6 +50,7 @@ struct Output { type Properties = HashMap; +#[derive(Debug)] enum Token { Root(Vec), Fragment(String,Properties,Vec), @@ -111,7 +112,7 @@ impl Crimtag { pub fn load_static(&mut self, data: &str) -> Result<(),Box::> { let mut p = parser::Parser::new(); - p.parse( &data ); + println!("Parsed token tree: {:?}", p.parse( &data )? ); Ok(()) } @@ -146,7 +147,20 @@ mod tests { let mut ct = Crimtag::new(); if let Err(e) = ct.load_static(r#"Here is a sample [|fragment "index" theme="standard"|>Hi<|fragment|] -That was fun!"#) { +That was fun! now a placeholder: [|fragment "placeholder"|] and now one with an implicit [|fragment "simple"|>Body [|show "content"|]<|fragment|] aoeu + +Now with explicit outputs: +[|fragment "complex"|> + [|output "content"|> + Here's a [|show "name"|]. + <|output|] + [|output "sidebar"|> + What's up world? + <|output|] + [|output "footer"|> + Same, I guess! + <|output|] +<|fragment|]"#) { println!("Error: {:?}", e ); } else { println!("It finished"); -- cgit v1.2.3