From 4749f9d97a7a9bc7b489cfccc342f110544ec458 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 2 Sep 2023 16:41:59 -0700 Subject: [PATCH] Some minor corrections from code review. --- guide/src/format/configuration/general.md | 2 +- src/config.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/guide/src/format/configuration/general.md b/guide/src/format/configuration/general.md index b6dd02d6..887cf0cd 100644 --- a/guide/src/format/configuration/general.md +++ b/guide/src/format/configuration/general.md @@ -48,7 +48,7 @@ This is general information about your book. - **language:** The main language of the book, which is used as a language attribute `` for example. This is also used to derive the direction of text (RTL, LTR) within the book. - **text_direction**: The direction of text in the book: Left-to-right (LTR) or Right-to-left (RTL). Possible values: `ltr`, `rtl`. - When not specified, the correct text direction is derived from the book's `language` attribute. + When not specified, the text direction is derived from the book's `language` attribute. **book.toml** ```toml diff --git a/src/config.rs b/src/config.rs index 8a20e4f3..bcbb28bc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -412,7 +412,7 @@ pub struct BookConfig { /// The main language of the book. pub language: Option, /// The direction of text in the book: Left-to-right (LTR) or Right-to-left (RTL). - /// When not specified, the correct text direction is derived from [BookConfig::language]. + /// When not specified, the text direction is derived from [`BookConfig::language`]. pub text_direction: Option, } @@ -431,13 +431,13 @@ impl Default for BookConfig { } impl BookConfig { - /// Gets the realized text direction, either from [BookConfig::text_direction] - /// or derived from [BookConfig::language], to be used by templating engines. + /// Gets the realized text direction, either from [`BookConfig::text_direction`] + /// or derived from [`BookConfig::language`], to be used by templating engines. pub fn realized_text_direction(&self) -> TextDirection { if let Some(direction) = self.text_direction { direction } else { - TextDirection::from_lang_code(&self.language.clone().unwrap_or_default()) + TextDirection::from_lang_code(self.language.as_deref().unwrap_or_default()) } } }