diff --git a/justfile b/justfile index c9394a8..b8589fd 100644 --- a/justfile +++ b/justfile @@ -2,8 +2,8 @@ default: just --list build: RUST_LOG=debug cargo build -run ui=' ' file='~/dev/lumina-iced/testypres.lisp': - RUST_LOG=debug cargo run -- {{ui}} {{file}} +run ui=' ' file='~/dev/lumina-iced/test_presentation.lisp': + RUST_LOG=debug cargo run -- -i {{ui}} {{file}} clean: RUST_LOG=debug cargo clean test: diff --git a/src/lisp.rs b/src/lisp.rs index 4754361..80109cd 100644 --- a/src/lisp.rs +++ b/src/lisp.rs @@ -1,3 +1,5 @@ +use std::{fs::read_to_string, path::PathBuf}; + use crisp::types::{Symbol, Value}; use tracing::error; @@ -21,7 +23,20 @@ pub fn parse_lisp(value: Value) -> Vec { } } Value::Symbol(Symbol(s)) if s == "load" => { - vec![Slide::default()] + let Ok(path) = PathBuf::from(String::from(&vec[1])) + .canonicalize() + else { + return vec![Slide::default()]; + }; + let lisp = read_to_string(path).expect("oops"); + let lisp_value = crisp::reader::read(&lisp); + match lisp_value { + Value::List(value) => value + .into_iter() + .flat_map(|v| parse_lisp(v)) + .collect(), + _ => panic!("Should not be"), + } } _ => todo!(), }, @@ -77,6 +92,8 @@ mod test { assert_eq!(first_lisp_slide, &test_vec[0]); assert_eq!(second_lisp_slide, &test_vec[1]); assert_eq!(third_lisp_slide, &test_vec[2]); + + assert_eq!(slide_vec, test_vec); } _ => panic!("this should be a lisp"), } diff --git a/test_presentation.lisp b/test_presentation.lisp index 4088bb5..2428a10 100644 --- a/test_presentation.lisp +++ b/test_presentation.lisp @@ -98,9 +98,9 @@ And my life began")) (song :author "Jordan Feliz" :ccli 97987 :font "Quicksand" :font-size 80 :title "The River" - :background (video :source "./coolerbg.mkv" :fit cover) + :background (video :source "~/vids/test/camprules2024theo.mp4" :fit cover) :verse-order (v1 c1 v2 c1) (v1 "I'm going down to the river") (c1 "Down to the river") (v2 "Down to the river to pray ay ay!")) -(load "./10000-reasons.lisp") +(load "./test_song.lisp")