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(
648
648
"language" . to_owned ( ) ,
649
649
json ! ( config. book. language. clone( ) . unwrap_or_default( ) ) ,
650
650
) ;
651
+ data. insert (
652
+ "text_direction" . to_owned ( ) ,
653
+ json ! ( config. book. realized_text_direction( ) ) ,
654
+ ) ;
651
655
data. insert (
652
656
"book_title" . to_owned ( ) ,
653
657
json ! ( config. book. title. clone( ) . unwrap_or_default( ) ) ,
@@ -1088,6 +1092,8 @@ struct RenderItemContext<'a> {
1088
1092
1089
1093
#[ cfg( test) ]
1090
1094
mod tests {
1095
+ use crate :: config:: TextDirection ;
1096
+
1091
1097
use super :: * ;
1092
1098
use pretty_assertions:: assert_eq;
1093
1099
@@ -1299,4 +1305,10 @@ mod tests {
1299
1305
assert_eq ! ( & * got, * should_be) ;
1300
1306
}
1301
1307
}
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
+ }
1302
1314
}
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