File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -297,6 +297,7 @@ pub struct BookConfig {
297297 /// An optional description for the book.
298298 pub description : Option < String > ,
299299 /// Location of the book source relative to the book's root directory.
300+ #[ serde( skip_serializing_if = "is_default_src" ) ]
300301 pub src : PathBuf ,
301302 /// The main language of the book.
302303 pub language : Option < String > ,
@@ -305,6 +306,11 @@ pub struct BookConfig {
305306 pub text_direction : Option < TextDirection > ,
306307}
307308
309+ /// Helper for serde serialization.
310+ fn is_default_src ( src : & PathBuf ) -> bool {
311+ src == Path :: new ( "src" )
312+ }
313+
308314impl Default for BookConfig {
309315 fn default ( ) -> BookConfig {
310316 BookConfig {
Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ All done, no errors...
2828 str![ [ r#"
2929[book]
3030authors = []
31- src = "src"
3231language = "en"
3332
3433"# ] ] ,
@@ -94,7 +93,6 @@ All done, no errors...
9493 str![ [ r#"
9594[book]
9695authors = []
97- src = "src"
9896language = "en"
9997
10098"# ] ] ,
@@ -128,7 +126,6 @@ All done, no errors...
128126[book]
129127title = "Example title"
130128authors = []
131- src = "src"
132129language = "en"
133130
134131"# ] ] ,
Original file line number Diff line number Diff line change @@ -188,7 +188,6 @@ fn backends_receive_render_context_via_stdin() {
188188 "authors": [],
189189 "description": null,
190190 "language": "en",
191- "src": "src",
192191 "text-direction": null,
193192 "title": null
194193 },
You can’t perform that action at this time.
0 commit comments