diff --git a/Cargo.lock b/Cargo.lock index b43e8a6..77471bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -227,8 +227,7 @@ dependencies = [ [[package]] name = "pulldown-cmark" version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e8bbe1a966bd2f362681a44f6edce3c2310ac21e4d5067a6e7ec396297a6ea0" +source = "git+https://git.gay/LailaTheElf/pulldown-cmark.git?branch=feature%2FeventTree#2300d0db6541279c41928b44d12eac510ecc3199" dependencies = [ "bitflags", "getopts", @@ -241,8 +240,7 @@ dependencies = [ [[package]] name = "pulldown-cmark-escape" version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" +source = "git+https://git.gay/LailaTheElf/pulldown-cmark.git?branch=feature%2FeventTree#2300d0db6541279c41928b44d12eac510ecc3199" [[package]] name = "quote" diff --git a/Cargo.toml b/Cargo.toml index 7eaafc3..36984f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,10 @@ edition = "2024" clap = { version = "4.5.55", features = ["derive"] } hashlink = "0.10.0" minijinja = { version = "2.10.2", features = ["loader", "builtins", "json"] } -pulldown-cmark = { version = "0.13.0", features = ["serde"] } regex = "1.11.1" yaml-rust2 = "0.10.2" + +[dependencies.pulldown-cmark] +git = "https://git.gay/LailaTheElf/pulldown-cmark.git" +branch = "feature/eventTree" +features = ["serde"] diff --git a/src/main.rs b/src/main.rs index 6643966..65233cb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,96 +1,65 @@ -use std::{path::Path, fs}; +use std::{convert::Infallible, fs, path::Path}; use clap::Parser; -use minijinja::Environment; mod render; -use render::{Renderer, IndexItem, build_jinja_env, Template}; +use render::{Renderer, IndexItem}; mod version; use version::VERSION; -fn render_index( +fn render_page( + page: &IndexItem, out_path: &Path, - index: &IndexItem, + index: &Renderer, cur_path: &Path, - site_index: &Renderer, - templates: Option>>, - jinja_env: Option<&Environment> ) { - let dest_path: &Path = &cur_path.join(&index.friendly); - // println!("dest_path: {:?}", dest_path); - - let templates = match templates { - Some(template) => template, - None => Template::index(&site_index.path.join("templates")).unwrap(), + let friendly = match page.friendly.len() { + 0 => "index", + _ => &page.friendly }; - let jinja_env = match jinja_env { - Some(env) => env, - None => &build_jinja_env(templates.clone()), - }; - - match &index.src { - Some(src) => { - // a source file is available. try to render it - - let friendly = match index.friendly.len() { - 0 => String::from("index"), - _ => index.friendly.clone() + if let Some(src) = &page.src { + if !page.is_asset { + // get output file extention + let extention = match page.target_extention.len() { + 0 => String::from("html"), + _ => page.target_extention.clone() }; - - if !index.is_asset { - // find template - let templ: Option