diff options
author | Julian T <julian@jtle.dk> | 2021-07-26 23:50:07 +0200 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2021-07-26 23:50:40 +0200 |
commit | d7244c2cc7b8f62f2f42cca7f3dece89c30bf105 (patch) | |
tree | 8b7bae761350bc05e1db0cc338daffc947a8e745 /src/context.rs | |
parent | 0ddf24fa0be620fc10cc07247b2c738b32943042 (diff) |
Add scaled image to page
Diffstat (limited to 'src/context.rs')
-rw-r--r-- | src/context.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/context.rs b/src/context.rs index 925db0b..f7b97ed 100644 --- a/src/context.rs +++ b/src/context.rs @@ -4,12 +4,12 @@ use std::io; use std::path::{Path, PathBuf}; use structopt::StructOpt; -use serde::Deserialize; +use serde::{Serialize, Deserialize}; use tera::{Tera, Filter, Value}; const TMPL_FILES: &'static [&'static str] = &["index.html"]; -#[derive(Debug, StructOpt)] +#[derive(Debug, StructOpt, Serialize)] #[structopt(name = "gallery")] pub struct Options { #[structopt(long, help = "Just a thing")] @@ -23,10 +23,8 @@ pub struct Options { #[structopt(long, short, default_value = "build", help = "Where to build site")] pub builddir: PathBuf, - #[structopt(long, default_value = "1080", help = "Scaled size for image")] - pub size_scaled: u32, - #[structopt(long, default_value = "720", help = "Thumbnail size for image")] - pub size_thumb: u32, + #[structopt(long, help = "Full size url prefix")] + pub url_prefix: Option<String>, } #[derive(Debug)] @@ -37,10 +35,11 @@ pub enum ConfigError { CompileTemplate(tera::Error), } -#[derive(Deserialize, Debug)] +#[derive(Deserialize, Debug, Serialize)] pub struct Config { pub imageglob: String, pub info: HashMap<String, String>, + pub sizes: HashMap<String, u32>, #[serde(skip)] pub imageglob_compiled: glob::Pattern, @@ -126,8 +125,6 @@ impl Filter for ReltoFilter { Err(tera::Error::msg("Input to relto filter must be string")) } } - - fn is_safe(&self) -> bool { true } } impl Config { |