File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,7 @@ impl<'de> serde::Deserialize<'de> for Config {
313
313
}
314
314
315
315
warn_on_invalid_fields ( & raw ) ;
316
+ warn_on_invalid_fields_in_book_section ( & raw ) ;
316
317
317
318
use serde:: de:: Error ;
318
319
let mut table = match raw {
@@ -389,6 +390,29 @@ fn warn_on_invalid_fields(table: &Value) {
389
390
}
390
391
}
391
392
393
+ fn warn_on_invalid_fields_in_book_section ( table : & Value ) {
394
+ let valid_items = [
395
+ "title" ,
396
+ "authors" ,
397
+ "description" ,
398
+ "src" ,
399
+ "language" ,
400
+ "text-direction" ,
401
+ "multilingual" ,
402
+ ] ;
403
+ if let Some ( book) = table. get ( "book" ) {
404
+ let table = book. as_table ( ) . expect ( "root.book must be a table" ) ;
405
+ for item in table. keys ( ) {
406
+ if !valid_items. contains ( & item. as_str ( ) ) {
407
+ warn ! (
408
+ "Invalid field {:?} in the [book] section of book.toml" ,
409
+ & item
410
+ ) ;
411
+ }
412
+ }
413
+ }
414
+ }
415
+
392
416
fn is_legacy_format ( table : & Value ) -> bool {
393
417
let legacy_items = [
394
418
"title" ,
You can’t perform that action at this time.
0 commit comments