more clear default values

This commit is contained in:
Chris Cochrun 2024-11-20 13:11:40 -06:00
parent 356384821b
commit 8cfe2506f5

View file

@ -199,6 +199,9 @@ impl From<Value> for Slide {
} }
fn lisp_to_slide(lisp: Vec<Value>) -> Slide { fn lisp_to_slide(lisp: Vec<Value>) -> Slide {
const DEFAULT_BACKGROUND_LOCATION: usize = 1;
const DEFAULT_TEXT_LOCATION: usize = 0;
let mut slide = SlideBuilder::new(); let mut slide = SlideBuilder::new();
let background_position = if let Some(background) = let background_position = if let Some(background) =
lisp.iter().position(|v| { lisp.iter().position(|v| {
@ -206,7 +209,7 @@ fn lisp_to_slide(lisp: Vec<Value>) -> Slide {
}) { }) {
background + 1 background + 1
} else { } else {
1 DEFAULT_BACKGROUND_LOCATION
}; };
dbg!(&background_position); dbg!(&background_position);
@ -219,7 +222,8 @@ fn lisp_to_slide(lisp: Vec<Value>) -> Slide {
let text_position = lisp.iter().position(|v| match v { let text_position = lisp.iter().position(|v| match v {
Value::List(vec) => { Value::List(vec) => {
vec[0] == Value::Symbol(Symbol::from("text")) vec[DEFAULT_TEXT_LOCATION]
== Value::Symbol(Symbol::from("text"))
} }
_ => false, _ => false,
}); });