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(
595
595
"language" . to_owned ( ) ,
596
596
json ! ( config. book. language. clone( ) . unwrap_or_default( ) ) ,
597
597
) ;
598
+ data. insert (
599
+ "text_direction" . to_owned ( ) ,
600
+ json ! ( config. book. realized_text_direction( ) ) ,
601
+ ) ;
598
602
data. insert (
599
603
"book_title" . to_owned ( ) ,
600
604
json ! ( config. book. title. clone( ) . unwrap_or_default( ) ) ,
@@ -951,6 +955,8 @@ struct RenderItemContext<'a> {
951
955
952
956
#[ cfg( test) ]
953
957
mod tests {
958
+ use crate :: config:: TextDirection ;
959
+
954
960
use super :: * ;
955
961
956
962
#[ test]
@@ -1090,4 +1096,9 @@ mod tests {
1090
1096
assert_eq ! ( & * got, * should_be) ;
1091
1097
}
1092
1098
}
1099
+ #[ test]
1100
+ fn test_json_direction ( ) {
1101
+ assert_eq ! ( json!( TextDirection :: RightToLeft ) , json!( "rtl" ) ) ;
1102
+ assert_eq ! ( json!( TextDirection :: LeftToRight ) , json!( "ltr" ) ) ;
1103
+ }
1093
1104
}
Original file line number Diff line number Diff line change 1
1
<!DOCTYPE HTML>
2
- <html lang =" {{ language }} " class =" {{ default_theme }} " >
2
+ <html lang =" {{ language }} " class =" {{ default_theme }} " dir = " {{ text_direction }} " >
3
3
<head >
4
4
<!-- Book generated using mdBook -->
5
5
<meta charset =" UTF-8" >
You can’t perform that action at this time.
0 commit comments