From 0bc17a0d715e95607b818fa6113cd5bd064f59fb Mon Sep 17 00:00:00 2001 From: Ofek Ashery Date: Tue, 24 Nov 2020 23:10:42 +0200 Subject: [PATCH 1/6] Add RTL support --- source/_static/css/frc-rtl.css | 58 ++++++++++++++++++++++++++++++++++ source/conf.py | 3 ++ 2 files changed, 61 insertions(+) create mode 100644 source/_static/css/frc-rtl.css diff --git a/source/_static/css/frc-rtl.css b/source/_static/css/frc-rtl.css new file mode 100644 index 0000000000..e260fe843f --- /dev/null +++ b/source/_static/css/frc-rtl.css @@ -0,0 +1,58 @@ +@import url('https://fonts.googleapis.com/css2?family=Heebo&display=swap'); + +body, .rst-content .toctree-wrapper > p.caption, h1, h2, h3, h4, h5, h6, legend { + font-family: 'Heebo', sans-serif; +} +body { + direction: rtl; +} +.fa:before { + transform: scale(-1, 1); +} + +.link-bar-container { + margin-right: 320px; + margin-left: 0; +} +#link-bar li, .wy-nav-top i { + float: right; +} + +.wy-nav-side { + right: 0; + left: unset; +} +.wy-nav-content-wrap { + margin-right: 320px; + margin-left: 0; +} +@media screen and (max-width: 768px) { + .wy-nav-side { + right: -300px; + } + .wy-nav-content-wrap { + margin-right: 0; + } + .wy-nav-side.shift { + right: 0; + left: unset; + } + .wy-nav-content-wrap.shift { + right: 320px; + left: unset; + } +} + +.rst-content .admonition-title:before { + margin-right: 0; + margin-left: 4px; +} +.wy-breadcrumbs li.wy-breadcrumbs-aside { + float: left; +} +.float-right { + float: left; +} +.float-left { + float: right; +} diff --git a/source/conf.py b/source/conf.py index 7ed356ca0a..128fd4e3d8 100644 --- a/source/conf.py +++ b/source/conf.py @@ -165,6 +165,8 @@ def setup(app): app.add_css_file('css/frc-rtd.css') + if app.config.language in rtl_locale: + app.add_css_file('css/frc-rtl.css') # -- Options for latex generation -------------------------------------------- @@ -199,3 +201,4 @@ def setup(app): gettext_compact = False locale_dirs = ['locale/'] +rtl_locale = ['he'] From 8c61933685b58f56003b25110883143efb23566f Mon Sep 17 00:00:00 2001 From: Ofek Ashery Date: Tue, 24 Nov 2020 23:37:38 +0200 Subject: [PATCH 2/6] Fix code direction --- source/_static/css/frc-rtl.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/_static/css/frc-rtl.css b/source/_static/css/frc-rtl.css index e260fe843f..e34678562f 100644 --- a/source/_static/css/frc-rtl.css +++ b/source/_static/css/frc-rtl.css @@ -9,6 +9,9 @@ body { .fa:before { transform: scale(-1, 1); } +.rst-content div[class^=highlight] pre { + direction: ltr; +} .link-bar-container { margin-right: 320px; From 4b40d9f1a464dcc67e874551fab3ef553bd82774 Mon Sep 17 00:00:00 2001 From: Ofek Ashery Date: Wed, 25 Nov 2020 01:24:18 +0200 Subject: [PATCH 3/6] Fix versions popup align --- source/_static/css/frc-rtl.css | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/source/_static/css/frc-rtl.css b/source/_static/css/frc-rtl.css index e34678562f..11a3bc054f 100644 --- a/source/_static/css/frc-rtl.css +++ b/source/_static/css/frc-rtl.css @@ -21,7 +21,7 @@ body { float: right; } -.wy-nav-side { +.wy-nav-side, .rst-versions { right: 0; left: unset; } @@ -30,18 +30,18 @@ body { margin-left: 0; } @media screen and (max-width: 768px) { - .wy-nav-side { + .wy-nav-side, .rst-versions { right: -300px; } .wy-nav-content-wrap { margin-right: 0; } - .wy-nav-side.shift { + .wy-nav-side.shift, .rst-versions.shift { right: 0; left: unset; } .wy-nav-content-wrap.shift { - right: 320px; + right: 85%; left: unset; } } @@ -59,3 +59,13 @@ body { .float-left { float: right; } + +.rst-versions .rst-current-version { + text-align: left; +} +.rst-versions .rst-current-version .fa-book, .rst-versions .rst-current-version .icon-book { + float: right; +} +.rst-other-versions { + text-align: right; +} \ No newline at end of file From bfa7ecd4ee80de5c47a2a132af8c74df7a83c70f Mon Sep 17 00:00:00 2001 From: Ofek Ashery Date: Wed, 25 Nov 2020 09:04:09 +0200 Subject: [PATCH 4/6] Add RTL support for hoverxref --- source/_static/css/frc-rtl.css | 2 +- source/conf.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/_static/css/frc-rtl.css b/source/_static/css/frc-rtl.css index 11a3bc054f..1aaf77c788 100644 --- a/source/_static/css/frc-rtl.css +++ b/source/_static/css/frc-rtl.css @@ -9,7 +9,7 @@ body { .fa:before { transform: scale(-1, 1); } -.rst-content div[class^=highlight] pre { +.rst-content div[class^=highlight] pre, .highlighttable { direction: ltr; } diff --git a/source/conf.py b/source/conf.py index 128fd4e3d8..8e71101e90 100644 --- a/source/conf.py +++ b/source/conf.py @@ -165,7 +165,11 @@ def setup(app): app.add_css_file('css/frc-rtd.css') - if app.config.language in rtl_locale: + + # Right-to-left support + is_rtl = app.config.language in rtl_locale + app.config.hoverxref_tooltip_side = 'left' if is_rtl else 'right' + if is_rtl: app.add_css_file('css/frc-rtl.css') # -- Options for latex generation -------------------------------------------- From a124979a9b2980230cc8e99fbc499139abce9093 Mon Sep 17 00:00:00 2001 From: Ofek Ashery Date: Wed, 25 Nov 2020 13:55:12 +0200 Subject: [PATCH 5/6] Fix reversing inline code --- source/_static/css/frc-rtl.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/_static/css/frc-rtl.css b/source/_static/css/frc-rtl.css index 1aaf77c788..7790b11f61 100644 --- a/source/_static/css/frc-rtl.css +++ b/source/_static/css/frc-rtl.css @@ -12,6 +12,10 @@ body { .rst-content div[class^=highlight] pre, .highlighttable { direction: ltr; } +.rst-content code, .rst-content tt { + direction: ltr; + unicode-bidi: bidi-override; +} .link-bar-container { margin-right: 320px; From 59bb6d92d4f4dd091eff2429406f9f7cf4a787f9 Mon Sep 17 00:00:00 2001 From: Ofek Ashery Date: Thu, 3 Dec 2020 18:12:49 +0200 Subject: [PATCH 6/6] Add a trailing newline Co-authored-by: Austin Shalit --- source/_static/css/frc-rtl.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_static/css/frc-rtl.css b/source/_static/css/frc-rtl.css index 7790b11f61..d67fb91a52 100644 --- a/source/_static/css/frc-rtl.css +++ b/source/_static/css/frc-rtl.css @@ -72,4 +72,4 @@ body { } .rst-other-versions { text-align: right; -} \ No newline at end of file +}