rm template dir

This commit is contained in:
lachrymaLF 2025-04-05 02:13:33 -04:00
parent 20e816f420
commit c73bc6145b
4 changed files with 6 additions and 7 deletions

View file

@ -1,6 +1,9 @@
# Compost (kpw_compose-ng) # Compost (kpw_compose-ng)
Static site generator with infamous `<c>` tags. Static site generator with infamous `<c>` tags.
## Features other than `<c>`
- Thumbnail generator (ImageMagick)
## Run the example ## Run the example
Make sure you [have the Rust toolchain installed](https://www.rust-lang.org/learn/get-started) and `gcc` and `convert` (ImageMagick) are available. Make sure you [have the Rust toolchain installed](https://www.rust-lang.org/learn/get-started) and `gcc` and `convert` (ImageMagick) are available.
```sh ```sh
@ -29,7 +32,6 @@ im = "convert" # ImageMagick
lib_dir = "./lib/" lib_dir = "./lib/"
include_dir = "./include/" include_dir = "./include/"
c_dir = "./bin/" c_dir = "./bin/"
template_dir = "./templates/"
content_dir = "./content/" content_dir = "./content/"
output_dir = "./out/" output_dir = "./out/"
copy_year = 2025 copy_year = 2025

View file

@ -3,7 +3,6 @@ im = "convert"
lib_dir = "./lib/" lib_dir = "./lib/"
include_dir = "./include/" include_dir = "./include/"
c_dir = "./bin/" c_dir = "./bin/"
template_dir = "./templates/"
content_dir = "./content/" content_dir = "./content/"
output_dir = "./out/" output_dir = "./out/"
copy_year = 2025 copy_year = 2025

View file

@ -12,14 +12,13 @@ use serde::{Serialize, Deserialize};
use toml; use toml;
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
struct Config< 'a> { struct Config<'a> {
cc: Cow<'a, str>, cc: Cow<'a, str>,
im: Cow<'a, str>, im: Cow<'a, str>,
lib_dir: Cow<'a, Path>, lib_dir: Cow<'a, Path>,
include_dir: Cow<'a, Path>, include_dir: Cow<'a, Path>,
c_dir: Cow<'a, Path>, c_dir: Cow<'a, Path>,
template_dir: Cow<'a, Path>,
content_dir: Cow<'a, Path>, content_dir: Cow<'a, Path>,
output_dir: Cow<'a, Path>, output_dir: Cow<'a, Path>,
copy_year: i32, copy_year: i32,
@ -131,7 +130,7 @@ fn compose(
format!("{}{}", config.root_url, match Command::new(config.im.as_ref()) format!("{}{}", config.root_url, match Command::new(config.im.as_ref())
.arg(config.default_thumb.as_ref()) .arg(config.default_thumb.as_ref())
.arg("(") .arg("(")
.arg("-size").arg("1200x200") .arg("-size").arg("1200x320")
.arg("gradient:transparent-black") .arg("gradient:transparent-black")
.arg(")") .arg(")")
.arg("-gravity").arg("South") .arg("-gravity").arg("South")
@ -209,7 +208,6 @@ fn main() -> Result<(), std::io::Error> {
lib_dir : Cow::Borrowed(Path::new("./lib/")), lib_dir : Cow::Borrowed(Path::new("./lib/")),
include_dir : Cow::Borrowed(Path::new("./include/")), include_dir : Cow::Borrowed(Path::new("./include/")),
c_dir : Cow::Borrowed(Path::new("./bin/")), c_dir : Cow::Borrowed(Path::new("./bin/")),
template_dir : Cow::Borrowed(Path::new("./templates/")),
content_dir : Cow::Borrowed(Path::new("./content/")), content_dir : Cow::Borrowed(Path::new("./content/")),
output_dir : Cow::Borrowed(Path::new("./out/")), output_dir : Cow::Borrowed(Path::new("./out/")),
copy_year : chrono::Utc::now().year(), copy_year : chrono::Utc::now().year(),
@ -244,7 +242,7 @@ fn main() -> Result<(), std::io::Error> {
create_dir(&config.c_dir).expect("Could not create output directory for C."); create_dir(&config.c_dir).expect("Could not create output directory for C.");
let pages: Vec<_> = glob(config.content_dir.join("*").to_str().unwrap()).unwrap().collect(); let pages: Vec<_> = glob(config.content_dir.join("*").to_str().unwrap()).unwrap().collect();
let template = read_to_string(&config.template_dir.join(config.template_fn.as_ref())).expect("The specified template could not be found..."); let template = read_to_string(config.template_fn.as_ref()).expect("The specified template could not be found...");
pages.into_par_iter().for_each(|page| compose(&page.unwrap(), &config, &template, c_prelude.as_str())); pages.into_par_iter().for_each(|page| compose(&page.unwrap(), &config, &template, c_prelude.as_str()));
if let Some(dir) = config.docroot_dir { if let Some(dir) = config.docroot_dir {