mirror of
https://github.com/zensical/zensical.git
synced 2026-08-23 07:36:52 +00:00
feature: support strict configuration option (#840)
Signed-off-by: Timothée Mazzucotelli <dev@pawamoy.fr>
This commit is contained in:
@@ -62,6 +62,8 @@ pub struct Project {
|
||||
pub site_dir: String,
|
||||
/// Whether to use directory URLs.
|
||||
pub use_directory_urls: bool,
|
||||
/// Whether to abort the build on any warnings.
|
||||
pub strict: bool,
|
||||
/// Development server address.
|
||||
pub dev_addr: String,
|
||||
/// Copyright notice.
|
||||
|
||||
@@ -185,7 +185,9 @@ fn run(config_file: &PathBuf, mode: Mode) -> PyResult<bool> {
|
||||
|
||||
// Determine if strict mode is enabled
|
||||
let strict = match &mode {
|
||||
Mode::Build(options) => options.strict.unwrap_or(false),
|
||||
Mode::Build(options) => {
|
||||
options.strict.unwrap_or(false) || config.project.strict
|
||||
}
|
||||
Mode::Serve(_, _) => false,
|
||||
};
|
||||
|
||||
|
||||
@@ -411,6 +411,7 @@ def _apply_defaults(config: dict, path: str) -> dict:
|
||||
set_default(config, "site_description", None, str)
|
||||
set_default(config, "site_author", None, str)
|
||||
set_default(config, "use_directory_urls", True, bool)
|
||||
set_default(config, "strict", False, bool)
|
||||
set_default(config, "dev_addr", "localhost:8000", str)
|
||||
set_default(config, "copyright", None, str)
|
||||
set_default(config, "watch", [], list)
|
||||
|
||||
Reference in New Issue
Block a user