diff options
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 { |