Skip to content

Commit 4749f9d

Browse files
committed
Some minor corrections from code review.
1 parent 8564a7f commit 4749f9d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

guide/src/format/configuration/general.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ This is general information about your book.
4848
- **language:** The main language of the book, which is used as a language attribute `<html lang="en">` for example.
4949
This is also used to derive the direction of text (RTL, LTR) within the book.
5050
- **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.
5252

5353
**book.toml**
5454
```toml

src/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ pub struct BookConfig {
412412
/// The main language of the book.
413413
pub language: Option<String>,
414414
/// 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`].
416416
pub text_direction: Option<TextDirection>,
417417
}
418418

@@ -431,13 +431,13 @@ impl Default for BookConfig {
431431
}
432432

433433
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.
436436
pub fn realized_text_direction(&self) -> TextDirection {
437437
if let Some(direction) = self.text_direction {
438438
direction
439439
} else {
440-
TextDirection::from_lang_code(&self.language.clone().unwrap_or_default())
440+
TextDirection::from_lang_code(self.language.as_deref().unwrap_or_default())
441441
}
442442
}
443443
}

0 commit comments

Comments
 (0)