adding text items to slides

This commit is contained in:
Chris Cochrun 2025-01-15 10:59:18 -06:00
parent 43dce4dca4
commit 2695d1b70f
2 changed files with 65 additions and 39 deletions

View file

@ -76,7 +76,30 @@ impl From<&Value> for ServiceItem {
_ => false, _ => false,
}) })
.map_or_else(|| 1, |pos| pos + 1); .map_or_else(|| 1, |pos| pos + 1);
if let Some(background) = list.get(background_pos) if let Some(content) =
list.iter().position(|v| match v {
Value::List(list)
if list.iter().next()
== Some(&Value::Symbol(
Symbol("text".into()),
)) =>
{
list.iter().next().is_some()
}
_ => false,
})
{
let slide = Slide::from(value);
let title = slide.text();
Self {
id: 0,
title,
database_id: 0,
kind: ServiceItemKind::Content(slide),
}
} else {
if let Some(background) =
list.get(background_pos)
{ {
match background { match background {
Value::List(item) => match &item[0] { Value::List(item) => match &item[0] {
@ -97,9 +120,11 @@ impl From<&Value> for ServiceItem {
Value::Symbol(Symbol(s)) Value::Symbol(Symbol(s))
if s == "presentation" => if s == "presentation" =>
{ {
Self::from(&Presentation::from( Self::from(
&Presentation::from(
background, background,
)) ),
)
} }
_ => todo!(), _ => todo!(),
}, },
@ -119,6 +144,7 @@ impl From<&Value> for ServiceItem {
ServiceItem::default() ServiceItem::default()
} }
} }
}
Value::Symbol(Symbol(s)) if s == "song" => { Value::Symbol(Symbol(s)) if s == "song" => {
let song = lisp_to_song(list.clone()); let song = lisp_to_song(list.clone());
Self::from(&song) Self::from(&song)

View file

@ -5,7 +5,7 @@ use std::{
fmt::Display, fmt::Display,
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
use tracing::error; use tracing::{debug, error};
use super::songs::Song; use super::songs::Song;