Skip to content

Commit e0476b8

Browse files
Add Right-to-Left support (#955)
* Add RTL support * Fix code direction * Fix versions popup align * Add RTL support for hoverxref * Fix reversing inline code * Add a trailing newline Co-authored-by: Austin Shalit <[email protected]> Co-authored-by: Austin Shalit <[email protected]>
1 parent 5dfc260 commit e0476b8

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

source/_static/css/frc-rtl.css

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
@import url('https://fonts.googleapis.com/css2?family=Heebo&display=swap');
2+
3+
body, .rst-content .toctree-wrapper > p.caption, h1, h2, h3, h4, h5, h6, legend {
4+
font-family: 'Heebo', sans-serif;
5+
}
6+
body {
7+
direction: rtl;
8+
}
9+
.fa:before {
10+
transform: scale(-1, 1);
11+
}
12+
.rst-content div[class^=highlight] pre, .highlighttable {
13+
direction: ltr;
14+
}
15+
.rst-content code, .rst-content tt {
16+
direction: ltr;
17+
unicode-bidi: bidi-override;
18+
}
19+
20+
.link-bar-container {
21+
margin-right: 320px;
22+
margin-left: 0;
23+
}
24+
#link-bar li, .wy-nav-top i {
25+
float: right;
26+
}
27+
28+
.wy-nav-side, .rst-versions {
29+
right: 0;
30+
left: unset;
31+
}
32+
.wy-nav-content-wrap {
33+
margin-right: 320px;
34+
margin-left: 0;
35+
}
36+
@media screen and (max-width: 768px) {
37+
.wy-nav-side, .rst-versions {
38+
right: -300px;
39+
}
40+
.wy-nav-content-wrap {
41+
margin-right: 0;
42+
}
43+
.wy-nav-side.shift, .rst-versions.shift {
44+
right: 0;
45+
left: unset;
46+
}
47+
.wy-nav-content-wrap.shift {
48+
right: 85%;
49+
left: unset;
50+
}
51+
}
52+
53+
.rst-content .admonition-title:before {
54+
margin-right: 0;
55+
margin-left: 4px;
56+
}
57+
.wy-breadcrumbs li.wy-breadcrumbs-aside {
58+
float: left;
59+
}
60+
.float-right {
61+
float: left;
62+
}
63+
.float-left {
64+
float: right;
65+
}
66+
67+
.rst-versions .rst-current-version {
68+
text-align: left;
69+
}
70+
.rst-versions .rst-current-version .fa-book, .rst-versions .rst-current-version .icon-book {
71+
float: right;
72+
}
73+
.rst-other-versions {
74+
text-align: right;
75+
}

source/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@
165165

166166
def setup(app):
167167
app.add_css_file('css/frc-rtd.css')
168+
169+
# Right-to-left support
170+
is_rtl = app.config.language in rtl_locale
171+
app.config.hoverxref_tooltip_side = 'left' if is_rtl else 'right'
172+
if is_rtl:
173+
app.add_css_file('css/frc-rtl.css')
168174

169175
# -- Options for latex generation --------------------------------------------
170176

@@ -199,3 +205,4 @@ def setup(app):
199205

200206
gettext_compact = False
201207
locale_dirs = ['locale/']
208+
rtl_locale = ['he']

0 commit comments

Comments
 (0)