File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -595,6 +595,10 @@ fn make_data(
595595 "language" . to_owned ( ) ,
596596 json ! ( config. book. language. clone( ) . unwrap_or_default( ) ) ,
597597 ) ;
598+ data. insert (
599+ "text_direction" . to_owned ( ) ,
600+ json ! ( config. book. realized_text_direction( ) ) ,
601+ ) ;
598602 data. insert (
599603 "book_title" . to_owned ( ) ,
600604 json ! ( config. book. title. clone( ) . unwrap_or_default( ) ) ,
@@ -951,6 +955,8 @@ struct RenderItemContext<'a> {
951955
952956#[ cfg( test) ]
953957mod tests {
958+ use crate :: config:: TextDirection ;
959+
954960 use super :: * ;
955961
956962 #[ test]
@@ -1090,4 +1096,9 @@ mod tests {
10901096 assert_eq ! ( & * got, * should_be) ;
10911097 }
10921098 }
1099+ #[ test]
1100+ fn test_json_direction ( ) {
1101+ assert_eq ! ( json!( TextDirection :: RightToLeft ) , json!( "rtl" ) ) ;
1102+ assert_eq ! ( json!( TextDirection :: LeftToRight ) , json!( "ltr" ) ) ;
1103+ }
10931104}
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