From 165d946e0dc703532a8f4cffadec12f21a692ec9 Mon Sep 17 00:00:00 2001 From: Oliver Atkinson Date: Fri, 16 May 2025 11:54:30 -0600 Subject: [PATCH] close #3 --- src/main.rs | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4a0c006..5002449 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,7 +37,7 @@ fn main() -> iced::Result { if let Ok(f) = bible::get( query, second_query, - vec![&bible], + &bible, ) { println!("{}", f); } @@ -214,22 +214,18 @@ impl State { Ok(file) => { let mut buffer = BufWriter::new(file); + // the toml heading at the top of md files + let _ = buffer.write_all("---\n---\n".as_bytes()); + for col in &self.states { - // start code block - let _ = buffer.write_all("```\n".as_bytes()); - // write header - if let Some(bible) = &col.bible_selected { - let translation = &bible.translation_name; - let location = &col.bible_search; - - let _ = buffer.write_all(format!("{translation} {location}\n").as_bytes()); - } + // separate each col with hr + let _ = buffer.write_all("\n---\n".as_bytes()); if let Some(scripture) = &col.scripture_body { + // code block for scripture + let _ = buffer.write_all("```\n".as_bytes()); let _ = buffer.write_all(parse(scripture).as_bytes()); + let _ = buffer.write_all("```\n".as_bytes()); } - // end code block - let _ = buffer.write_all("```\n".as_bytes()); - let _ = buffer.write_all(&col.notes.text().as_bytes()); } let _ = buffer.flush(); @@ -337,7 +333,7 @@ impl State { if let (Some(book), Some(chap_and_ver), Some(bible)) = (book, location, &self.states[i].bible_selected) { - self.states[i].scripture_body = match bible::get(book, chap_and_ver, vec![bible]) { + self.states[i].scripture_body = match bible::get(book, chap_and_ver, bible) { Ok(s) => { Some(s) },