some updates
This commit is contained in:
parent
c60353f8c8
commit
d6536f8a88
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1257,7 +1257,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "crisp"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.tfcconnection.org/chris/crisp#04a470d771bd86646d27ef35811fc7d6a3c7bafb"
|
||||
source = "git+https://git.tfcconnection.org/chris/crisp#b01eda5e0e3df469b45ff91424f7ad6f806cbca3"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"miette",
|
||||
|
|
|
@ -10,8 +10,6 @@ use std::{
|
|||
|
||||
use crate::core::lisp::Symbol;
|
||||
|
||||
use super::lisp::get_lists;
|
||||
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize,
|
||||
)]
|
||||
|
@ -207,11 +205,31 @@ fn lisp_to_slide(lisp: Vec<Value>) -> Slide {
|
|||
slide.background(lisp_to_background(background));
|
||||
} else {
|
||||
slide.background(Background::default());
|
||||
};
|
||||
match slide.build() {
|
||||
Ok(slide) => slide,
|
||||
Err(e) => {
|
||||
miette!("Shoot! Slide didn't build: {e}");
|
||||
Slide::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn lisp_to_background(lisp: &Value) {
|
||||
todo!()
|
||||
fn lisp_to_background(lisp: &Value) -> Background {
|
||||
match lisp {
|
||||
Value::List(list) => {
|
||||
if let Some(source) = list.iter().position(|v| {
|
||||
v == Value::Keyword(Keyword::from("source"))
|
||||
}) {
|
||||
let path = list[source + 1];
|
||||
let path = String::from(path);
|
||||
Background::from(path)
|
||||
} else {
|
||||
Background::default()
|
||||
}
|
||||
}
|
||||
_ => Background::default(),
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
|
@ -233,7 +251,7 @@ impl SlideBuilder {
|
|||
Self::default()
|
||||
}
|
||||
|
||||
pub(crate) fn background(
|
||||
pub(crate) fn background_path(
|
||||
mut self,
|
||||
background: PathBuf,
|
||||
) -> Result<Self, ParseError> {
|
||||
|
@ -242,6 +260,14 @@ impl SlideBuilder {
|
|||
Ok(self)
|
||||
}
|
||||
|
||||
pub(crate) fn background(
|
||||
mut self,
|
||||
background: Background,
|
||||
) -> Self {
|
||||
self.background.insert(background);
|
||||
self
|
||||
}
|
||||
|
||||
pub(crate) fn text(mut self, text: impl Into<String>) -> Self {
|
||||
let _ = self.text.insert(text.into());
|
||||
self
|
||||
|
|
Loading…
Reference in a new issue