Skip to content

Commit 981b79b

Browse files
authored
Merge pull request #1775 from ehuss/fix-print-config
Fix html print config default.
2 parents cdfa5ad + 78bcda0 commit 981b79b

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/config.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ impl HtmlConfig {
588588

589589
/// Configuration for how to render the print icon, print.html, and print.css.
590590
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
591-
#[serde(rename_all = "kebab-case")]
591+
#[serde(default, rename_all = "kebab-case")]
592592
pub struct Print {
593593
/// Whether print support is enabled.
594594
pub enable: bool,
@@ -1175,4 +1175,24 @@ mod tests {
11751175

11761176
Config::from_str(src).unwrap();
11771177
}
1178+
1179+
#[test]
1180+
fn print_config() {
1181+
let src = r#"
1182+
[output.html.print]
1183+
enable = false
1184+
"#;
1185+
let got = Config::from_str(src).unwrap();
1186+
let html_config = got.html_config().unwrap();
1187+
assert_eq!(html_config.print.enable, false);
1188+
assert_eq!(html_config.print.page_break, true);
1189+
let src = r#"
1190+
[output.html.print]
1191+
page-break = false
1192+
"#;
1193+
let got = Config::from_str(src).unwrap();
1194+
let html_config = got.html_config().unwrap();
1195+
assert_eq!(html_config.print.enable, true);
1196+
assert_eq!(html_config.print.page_break, false);
1197+
}
11781198
}

0 commit comments

Comments
 (0)