Getting closer to a working little system
This commit is contained in:
parent
d9459d6336
commit
c60353f8c8
9 changed files with 338 additions and 132 deletions
|
@ -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,
|
||||
)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue