diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 709aa066..8ea2f49e 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -648,6 +648,10 @@ fn make_data( "language".to_owned(), json!(config.book.language.clone().unwrap_or_default()), ); + data.insert( + "text_direction".to_owned(), + json!(config.book.realized_text_direction()), + ); data.insert( "book_title".to_owned(), json!(config.book.title.clone().unwrap_or_default()), @@ -1088,6 +1092,8 @@ struct RenderItemContext<'a> { #[cfg(test)] mod tests { + use crate::config::TextDirection; + use super::*; use pretty_assertions::assert_eq; @@ -1299,4 +1305,10 @@ mod tests { assert_eq!(&*got, *should_be); } } + + #[test] + fn test_json_direction() { + assert_eq!(json!(TextDirection::RightToLeft), json!("rtl")); + assert_eq!(json!(TextDirection::LeftToRight), json!("ltr")); + } } diff --git a/src/theme/index.hbs b/src/theme/index.hbs index a3129f2b..61b0e273 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -1,5 +1,5 @@ - +