Getting closer to a working little system

This commit is contained in:
Chris Cochrun 2024-11-19 12:35:42 -06:00
parent d9459d6336
commit c60353f8c8
9 changed files with 338 additions and 132 deletions

View file

@ -1,7 +1,4 @@
use lexpr::{
parse::{from_str_elisp, Options},
Parser, Value,
};
use crisp::types::{Keyword, Value};
use miette::{miette, IntoDiagnostic, Result};
use serde::{Deserialize, Serialize};
use std::{
@ -187,6 +184,36 @@ impl Slide {
}
}
impl From<Value> for Slide {
fn from(value: Value) -> Self {
match value {
Value::List(list) => lisp_to_slide(list),
_ => Slide::default(),
}
}
}
fn lisp_to_slide(lisp: Vec<Value>) -> Slide {
let mut slide = SlideBuilder::new();
let background_position = if let Some(background) =
lisp.position(|v| Value::Keyword(Keyword::from("background")))
{
background + 1
} else {
0
};
if let Some(background) = lisp.get(background_position) {
slide.background(lisp_to_background(background));
} else {
slide.background(Background::default());
}
}
fn lisp_to_background(lisp: &Value) {
todo!()
}
#[derive(
Clone, Debug, Default, PartialEq, Serialize, Deserialize,
)]