File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
guide/src/format/configuration Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ This is general information about your book.
48
48
- ** language:** The main language of the book, which is used as a language attribute ` <html lang="en"> ` for example.
49
49
This is also used to derive the direction of text (RTL, LTR) within the book.
50
50
- ** text_direction** : The direction of text in the book: Left-to-right (LTR) or Right-to-left (RTL). Possible values: ` ltr ` , ` rtl ` .
51
- When not specified, the correct text direction is derived from the book's ` language ` attribute.
51
+ When not specified, the text direction is derived from the book's ` language ` attribute.
52
52
53
53
** book.toml**
54
54
``` toml
Original file line number Diff line number Diff line change @@ -412,7 +412,7 @@ pub struct BookConfig {
412
412
/// The main language of the book.
413
413
pub language : Option < String > ,
414
414
/// The direction of text in the book: Left-to-right (LTR) or Right-to-left (RTL).
415
- /// When not specified, the correct text direction is derived from [BookConfig::language].
415
+ /// When not specified, the text direction is derived from [` BookConfig::language` ].
416
416
pub text_direction : Option < TextDirection > ,
417
417
}
418
418
@@ -431,13 +431,13 @@ impl Default for BookConfig {
431
431
}
432
432
433
433
impl BookConfig {
434
- /// Gets the realized text direction, either from [BookConfig::text_direction]
435
- /// or derived from [BookConfig::language], to be used by templating engines.
434
+ /// Gets the realized text direction, either from [` BookConfig::text_direction` ]
435
+ /// or derived from [` BookConfig::language` ], to be used by templating engines.
436
436
pub fn realized_text_direction ( & self ) -> TextDirection {
437
437
if let Some ( direction) = self . text_direction {
438
438
direction
439
439
} else {
440
- TextDirection :: from_lang_code ( & self . language . clone ( ) . unwrap_or_default ( ) )
440
+ TextDirection :: from_lang_code ( self . language . as_deref ( ) . unwrap_or_default ( ) )
441
441
}
442
442
}
443
443
}
You can’t perform that action at this time.
0 commit comments