summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2022-03-30 07:58:27 -0700
committerEric Huss <eric@huss.org>2022-03-30 07:58:27 -0700
commit78bcda02cbbb7e128a03d1acac22f1485bc67f91 (patch)
tree86a0f1fe27d38f4fff585fa9bacdbd4b845e28c7 /src/config.rs
parentcdfa5ad9909e2cba8390688f3f0686fb70cb4bef (diff)
Fix html print config default.
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/config.rs b/src/config.rs
index 2bd6f3e0..951957bd 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -588,7 +588,7 @@ impl HtmlConfig {
/// Configuration for how to render the print icon, print.html, and print.css.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
-#[serde(rename_all = "kebab-case")]
+#[serde(default, rename_all = "kebab-case")]
pub struct Print {
/// Whether print support is enabled.
pub enable: bool,
@@ -1175,4 +1175,24 @@ mod tests {
Config::from_str(src).unwrap();
}
+
+ #[test]
+ fn print_config() {
+ let src = r#"
+ [output.html.print]
+ enable = false
+ "#;
+ let got = Config::from_str(src).unwrap();
+ let html_config = got.html_config().unwrap();
+ assert_eq!(html_config.print.enable, false);
+ assert_eq!(html_config.print.page_break, true);
+ let src = r#"
+ [output.html.print]
+ page-break = false
+ "#;
+ let got = Config::from_str(src).unwrap();
+ let html_config = got.html_config().unwrap();
+ assert_eq!(html_config.print.enable, true);
+ assert_eq!(html_config.print.page_break, false);
+ }
}