File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -648,6 +648,10 @@ fn make_data(
648648 "language" . to_owned ( ) ,
649649 json ! ( config. book. language. clone( ) . unwrap_or_default( ) ) ,
650650 ) ;
651+ data. insert (
652+ "text_direction" . to_owned ( ) ,
653+ json ! ( config. book. realized_text_direction( ) ) ,
654+ ) ;
651655 data. insert (
652656 "book_title" . to_owned ( ) ,
653657 json ! ( config. book. title. clone( ) . unwrap_or_default( ) ) ,
@@ -1088,6 +1092,8 @@ struct RenderItemContext<'a> {
10881092
10891093#[ cfg( test) ]
10901094mod tests {
1095+ use crate :: config:: TextDirection ;
1096+
10911097 use super :: * ;
10921098 use pretty_assertions:: assert_eq;
10931099
@@ -1299,4 +1305,10 @@ mod tests {
12991305 assert_eq ! ( & * got, * should_be) ;
13001306 }
13011307 }
1308+
1309+ #[ test]
1310+ fn test_json_direction ( ) {
1311+ assert_eq ! ( json!( TextDirection :: RightToLeft ) , json!( "rtl" ) ) ;
1312+ assert_eq ! ( json!( TextDirection :: LeftToRight ) , json!( "ltr" ) ) ;
1313+ }
13021314}
Original file line number Diff line number Diff line change 11<!DOCTYPE HTML>
2- <html lang =" {{ language }} " class =" {{ default_theme }} " >
2+ <html lang =" {{ language }} " class =" {{ default_theme }} " dir = " {{ text_direction }} " >
33 <head >
44 <!-- Book generated using mdBook -->
55 <meta charset =" UTF-8" >
You can’t perform that action at this time.
0 commit comments