From 2691ea504ecf2001286f7777071479df94a2d6b8 Mon Sep 17 00:00:00 2001 From: Revisto Date: Thu, 13 Feb 2025 22:15:34 +0330 Subject: [PATCH 01/18] Add support for RTL layout in documentation options --- sphinx/themes/basic/static/documentation_options.js.jinja | 1 + sphinx/themes/basic/theme.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/sphinx/themes/basic/static/documentation_options.js.jinja b/sphinx/themes/basic/static/documentation_options.js.jinja index b66690abd19..5e2895f4f00 100644 --- a/sphinx/themes/basic/static/documentation_options.js.jinja +++ b/sphinx/themes/basic/static/documentation_options.js.jinja @@ -10,4 +10,5 @@ const DOCUMENTATION_OPTIONS = { NAVIGATION_WITH_KEYS: {{ 'true' if theme_navigation_with_keys|tobool else 'false'}}, SHOW_SEARCH_SUMMARY: {{ 'true' if show_search_summary else 'false' }}, ENABLE_SEARCH_SHORTCUTS: {{ 'true' if theme_enable_search_shortcuts|tobool else 'false'}}, + IS_RTL: {{ 'true' if is_rtl else 'false' }}, }; diff --git a/sphinx/themes/basic/theme.toml b/sphinx/themes/basic/theme.toml index f380be0ae64..34277396db1 100644 --- a/sphinx/themes/basic/theme.toml +++ b/sphinx/themes/basic/theme.toml @@ -21,3 +21,4 @@ enable_search_shortcuts = "True" globaltoc_collapse = "true" globaltoc_includehidden = "false" globaltoc_maxdepth = "" +is_rtl = "false" From eecd16eb83bdf2a719dac510f23aff2ff09f7639 Mon Sep 17 00:00:00 2001 From: Revisto Date: Thu, 13 Feb 2025 22:16:14 +0330 Subject: [PATCH 02/18] Add RTL support with new CSS for right-to-left basic layout --- sphinx/themes/basic/static/basic.css.jinja | 2 + sphinx/themes/basic/static/rtl.css.jinja | 189 +++++++++++++++++++++ 2 files changed, 191 insertions(+) create mode 100644 sphinx/themes/basic/static/rtl.css.jinja diff --git a/sphinx/themes/basic/static/basic.css.jinja b/sphinx/themes/basic/static/basic.css.jinja index 4a00f3629f0..6102503d502 100644 --- a/sphinx/themes/basic/static/basic.css.jinja +++ b/sphinx/themes/basic/static/basic.css.jinja @@ -4,6 +4,8 @@ /* -- main layout ----------------------------------------------------------- */ +@import url("rtl.css"); + div.clearer { clear: both; } diff --git a/sphinx/themes/basic/static/rtl.css.jinja b/sphinx/themes/basic/static/rtl.css.jinja new file mode 100644 index 00000000000..0e3068c0287 --- /dev/null +++ b/sphinx/themes/basic/static/rtl.css.jinja @@ -0,0 +1,189 @@ +{% if theme_is_rtl|tobool %} + +@font-face { + font-family: Vazirmatn; + src: url('fonts/vazir/Vazirmatn-Thin.woff2') format('woff2'); + font-weight: 100; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: Vazirmatn; + src: url('fonts/vazir/Vazirmatn-ExtraLight.woff2') format('woff2'); + font-weight: 200; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: Vazirmatn; + rc: url('fonts/vazir/Vazirmatn-Light.woff2') format('woff2'); + font-weight: 300; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: Vazirmatn; + src: url('fonts/vazir/Vazirmatn-Regular.woff2') format('woff2'); + font-weight: 400; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: Vazirmatn; + src: url('fonts/vazir/Vazirmatn-Medium.woff2') format('woff2'); + font-weight: 500; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: Vazirmatn; + src: url('fonts/vazir/Vazirmatn-SemiBold.woff2') format('woff2'); + font-weight: 600; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: Vazirmatn; + src: url('fonts/vazir/Vazirmatn-Bold.woff2') format('woff2'); + font-weight: 700; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: Vazirmatn; + src: url('fonts/vazir/Vazirmatn-ExtraBold.woff2') format('woff2'); + font-weight: 800; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: Vazirmatn; + src: url('fonts/vazir/Vazirmatn-Black.woff2') format('woff2'); + font-weight: 900; + font-style: normal; + font-display: swap; +} + +/* Core RTL layout */ +body { + direction: rtl !important; + font-family: Vazirmatn !important; +} + +/* Layout adjustments */ +div.sphinxsidebar { + float: right !important; + margin-right: -100% !important; +} + +/* Keep right items on the left */ +div.related li.right { + float: left !important; + margin-left: 10px !important; + margin-right: 0 !important; +} + +div.bodywrapper { + margin: 0 {{ theme_sidebarwidth|todim }} 0 0 !important; +} + +/* Text alignments and padding */ +div.body p, +div.body dd, +div.body li, +div.body blockquote { + direction: rtl !important; + text-align: justify !important; +} + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + text-align: right !important; + padding: 3px 10px 3px 0 !important; +} + +/* Lists */ +ul, ol { + padding-right: 30px !important; + padding-left: 0 !important; +} + +/* Form elements */ +div.sphinxsidebar input { + text-align: right !important; +} + +/* Footnotes */ +.footnote-reference { + float: right !important; +} + +.footnote { + direction: rtl !important; + text-align: right !important; +} + +/* Code blocks - keep LTR */ +pre { + direction: ltr !important; + text-align: left !important; + border-right: 4px solid #ac9 !important; + border-left: none !important; +} + +/* Tables */ +th { + text-align: right !important; +} + +table.docutils td { + text-align: right !important; +} + +/* Search */ +div.sphinxsidebar #searchbox input[type="text"] { + float: right !important; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: right !important; +} + +/* Admonitions */ +div.admonition { + padding: 7px 10px 7px 7px !important; +} + +/* References and links */ +a.reference.internal, +a.reference.external { + unicode-bidi: bidi-override !important; +} + +/* Sidebar collapsible button */ +{% if theme_collapsiblesidebar|tobool %} +#sidebarbutton { + float: left !important; + border-right: 1px solid {{ theme_relbarbgcolor }} !important; + border-left: none !important; +} +{% endif %} + +/* Topic boxes and sidebars */ +div.sidebar, +div.topic { + margin: 0 0 0.5em 1em !important; +} +{% endif %} \ No newline at end of file From 4d57e27b1eb8bbfc6b0d2c1fd0a262edfbfe7ead Mon Sep 17 00:00:00 2001 From: Revisto Date: Thu, 13 Feb 2025 22:27:30 +0330 Subject: [PATCH 03/18] Add RTL support for Agogo theme with new CSS file --- sphinx/themes/agogo/static/agogo.css.jinja | 2 + sphinx/themes/agogo/static/rtl.css.jinja | 152 +++++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 sphinx/themes/agogo/static/rtl.css.jinja diff --git a/sphinx/themes/agogo/static/agogo.css.jinja b/sphinx/themes/agogo/static/agogo.css.jinja index d281c744d3c..476c3a1df39 100644 --- a/sphinx/themes/agogo/static/agogo.css.jinja +++ b/sphinx/themes/agogo/static/agogo.css.jinja @@ -2,6 +2,8 @@ * Sphinx stylesheet -- agogo theme. */ +@import url("rtl.css"); + * { margin: 0px; padding: 0px; diff --git a/sphinx/themes/agogo/static/rtl.css.jinja b/sphinx/themes/agogo/static/rtl.css.jinja new file mode 100644 index 00000000000..616cb9805a2 --- /dev/null +++ b/sphinx/themes/agogo/static/rtl.css.jinja @@ -0,0 +1,152 @@ +{% if theme_is_rtl|tobool %} + +/* Core RTL overrides for Agogo theme */ +body { + direction: rtl !important; + text-align: right !important; +} + +/* Header adjustments */ +div.header .headertitle { + text-align: right !important; + letter-spacing: 0 !important; +} + +div.header div.rel { + direction: rtl !important; +} + +p.logo { + float: left !important; +} + +/* Content layout */ +div.document { + float: right !important; +} + +div.body { + {%- if theme_rightsidebar|tobool %} + padding-left: 2em !important; + padding-right: 0 !important; + {%- else %} + padding-right: 2em !important; + padding-left: 0 !important; + {% endif %} +} + +/* Sidebar positioning */ +div.sidebar, +aside.sidebar { + {%- if theme_rightsidebar|tobool %} + float: left !important; + {%- else %} + float: right !important; + {% endif %} +} + +/* Lists and margins */ +div.document ul { + margin-right: 1.5em !important; + margin-left: 0 !important; +} + +div.document dd { + margin-right: 1.2em !important; + margin-left: 0 !important; +} + +/* Admonitions */ +div.admonition { + border-right: 0.2em solid black !important; + border-left: none !important; + padding: 2px 7px 1px 7px !important; +} + +/* Search elements */ +ul.search { + margin: 10px 20px 0 0 !important; +} + +ul.search li { + padding: 5px 20px 5px 0 !important; + background-position: right 7px !important; +} + +/* Table alignments */ +table.indextable td { + text-align: right !important; +} + +/* Footer adjustments */ +div.footer .right { + text-align: left !important; +} + +div.footer .left { + text-align: right !important; +} + +/* Code blocks - keep LTR */ +div.highlight pre { + direction: ltr !important; + text-align: left !important; +} + +/* Header links */ +a.headerlink { + padding-right: .3em !important; + padding-left: 0 !important; +} + +/* Sidebar list adjustments */ +div.sidebar li.toctree-l1 a, +aside.sidebar li.toctree-l1 a { + padding-right: 3px !important; + padding-left: 0 !important; +} + +div.sidebar li.toctree-l2 a, +aside.sidebar li.toctree-l2 a { + margin-right: 1em !important; + margin-left: 0 !important; +} + +div.sidebar li.toctree-l3 a, +aside.sidebar li.toctree-l3 a { + margin-right: 2em !important; + margin-left: 0 !important; +} + +/* Float adjustments */ +.left { + float: right !important; +} + +.right { + float: left !important; +} + +/* Image alignments */ +img.align-left, .figure.align-left, object.align-left { + float: right !important; + margin-left: 1em !important; + margin-right: 0 !important; +} + +img.align-right, .figure.align-right, object.align-right { + float: left !important; + margin-right: 1em !important; + margin-left: 0 !important; +} + +/* Viewcode extension */ +.viewcode-link, .viewcode-back { + float: left !important; +} + +/* Equation numbers */ +span.eqno { + float: left !important; +} +{% endif %} \ No newline at end of file From bcc1783cc24031ed42dfa75df980731db7aba7c6 Mon Sep 17 00:00:00 2001 From: Revisto Date: Thu, 13 Feb 2025 22:42:08 +0330 Subject: [PATCH 04/18] Add RTL support for Epub theme with new CSS file --- sphinx/themes/epub/static/epub.css.jinja | 2 + sphinx/themes/epub/static/rtl.css.jinja | 172 +++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 sphinx/themes/epub/static/rtl.css.jinja diff --git a/sphinx/themes/epub/static/epub.css.jinja b/sphinx/themes/epub/static/epub.css.jinja index 306016bd301..354fe37da42 100644 --- a/sphinx/themes/epub/static/epub.css.jinja +++ b/sphinx/themes/epub/static/epub.css.jinja @@ -2,6 +2,8 @@ * Sphinx stylesheet -- epub theme. */ +@import url("rtl.css"); + /* -- main layout ----------------------------------------------------------- */ {% if theme_writing_mode is defined %} diff --git a/sphinx/themes/epub/static/rtl.css.jinja b/sphinx/themes/epub/static/rtl.css.jinja new file mode 100644 index 00000000000..be5e0b9df0d --- /dev/null +++ b/sphinx/themes/epub/static/rtl.css.jinja @@ -0,0 +1,172 @@ +{% if theme_is_rtl|tobool %} + +/* Core RTL layout for Epub theme */ +body { + direction: rtl !important; + text-align: right !important; +} + +/* Header adjustments */ +div.header .headertitle { + text-align: right !important; + letter-spacing: 0 !important; +} + +div.header div.rel { + direction: rtl !important; +} + +p.logo { + float: left !important; +} + +/* Content layout */ +div.document { + float: right !important; +} + +div.body { + {%- if theme_rightsidebar|tobool %} + padding-left: 2em !important; + padding-right: 0 !important; + {%- else %} + padding-right: 2em !important; + padding-left: 0 !important; + {% endif %} +} + +/* Sidebar positioning - specific to Agogo */ +div.sidebar, +aside.sidebar { + {%- if theme_rightsidebar|tobool %} + float: left !important; + margin: 0 1em 0 0 !important; + {%- else %} + float: right !important; + margin: 0 0 0 1em !important; + {% endif %} +} + +/* Content elements */ +div.body p, +div.body dd, +div.body li, +div.body blockquote { + direction: rtl !important; + text-align: right !important; +} + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + text-align: right !important; + border-bottom-color: {{ theme_headercolor2 }} !important; +} + +/* Lists and margins */ +div.document ul { + margin-right: 1.5em !important; + margin-left: 0 !important; +} + +div.document dd { + margin-right: 1.2em !important; + margin-left: 0 !important; +} + +/* Tables */ +table.docutils td, +table.docutils th { + text-align: right !important; + padding: 1px 5px 1px 8px !important; +} + +/* Admonitions */ +div.admonition { + padding: 7px !important; + border-right: 0.2em solid black !important; + border-left: none !important; +} + +p.admonition-title { + margin: 0 0 5px 10px !important; +} + +/* Code blocks - keep LTR */ +div.highlight pre { + direction: ltr !important; + text-align: left !important; + font-family: {{ theme_codecodefront }} !important; +} + +/* Header links */ +a.headerlink { + padding-right: .3em !important; + padding-left: 0 !important; +} + +/* Search elements */ +ul.search { + margin: 10px 20px 0 0 !important; +} + +ul.search li { + padding: 5px 20px 5px 0 !important; + background-position: right 7px !important; +} + +/* Footer adjustments */ +div.footer-wrapper { + text-align: right !important; +} + +div.footer .right { + text-align: left !important; +} + +div.footer .left { + text-align: right !important; +} + +/* Float adjustments */ +.left { + float: right !important; +} + +.right { + float: left !important; +} + +/* Image alignments */ +img.align-left, +.figure.align-left, +object.align-left { + float: right !important; + margin-left: 1em !important; + margin-right: 0 !important; +} + +img.align-right, +.figure.align-right, +object.align-right { + float: left !important; + margin-right: 1em !important; + margin-left: 0 !important; +} + +/* Field lists */ +dl.field-list > dt { + float: right !important; + clear: right !important; + padding-left: 0.5em !important; + padding-right: 0 !important; +} + +dl.field-list > dd { + margin-right: 9em !important; + margin-left: 0 !important; +} +{% endif %} \ No newline at end of file From 436ccf1d68c47294022cf94a490055ee1290c1eb Mon Sep 17 00:00:00 2001 From: Revisto Date: Thu, 13 Feb 2025 22:42:19 +0330 Subject: [PATCH 05/18] Add RTL support for Nonav theme with new CSS file --- sphinx/themes/nonav/static/nonav.css.jinja | 2 + sphinx/themes/nonav/static/rtl.css.jinja | 157 +++++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 sphinx/themes/nonav/static/rtl.css.jinja diff --git a/sphinx/themes/nonav/static/nonav.css.jinja b/sphinx/themes/nonav/static/nonav.css.jinja index f68ff88dcd6..a905a4ac0f8 100644 --- a/sphinx/themes/nonav/static/nonav.css.jinja +++ b/sphinx/themes/nonav/static/nonav.css.jinja @@ -2,6 +2,8 @@ * Sphinx stylesheet -- nonav theme. */ +@import url("rtl.css"); + /* -- main layout ----------------------------------------------------------- */ div.clearer { diff --git a/sphinx/themes/nonav/static/rtl.css.jinja b/sphinx/themes/nonav/static/rtl.css.jinja new file mode 100644 index 00000000000..f9aa9b5cc7a --- /dev/null +++ b/sphinx/themes/nonav/static/rtl.css.jinja @@ -0,0 +1,157 @@ +{% if theme_is_rtl|tobool %} + +/* Core RTL overrides for Nonav theme */ +body { + direction: rtl !important; + font-family: Vazirmatn !important; + text-align: right !important; +} + +/* Main layout adjustments */ +div.document { + direction: rtl !important; +} + +div.documentwrapper { + direction: rtl !important; +} + +/* Text alignments */ +div.body p, +div.body dd, +div.body li, +div.body blockquote { + direction: rtl !important; + text-align: right !important; +} + +/* Headers alignment */ +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + text-align: right !important; +} + +/* Lists */ +ul, ol { + margin-right: 30px !important; + margin-left: 0 !important; + padding-right: 0 !important; + padding-left: 0 !important; +} + +dd { + margin-right: 30px !important; + margin-left: 0 !important; +} + +/* Tables */ +table.docutils td, +table.docutils th { + text-align: right !important; + padding: 1px 5px 1px 8px !important; +} + +th { + text-align: right !important; + padding-left: 5px !important; + padding-right: 0 !important; +} + +/* Search page */ +ul.search { + margin: 10px 20px 0 0 !important; +} + +ul.search li { + padding: 5px 20px 5px 0 !important; + background-position: right 7px !important; +} + +ul.search li div.context { + margin: 2px 30px 0 0 !important; + text-align: right !important; +} + +/* Admonitions */ +div.admonition { + padding: 7px !important; + border-right: 0.2em solid black !important; + border-left: none !important; +} + +p.admonition-title { + margin: 0 0 5px 10px !important; +} + +/* Code blocks - keep LTR */ +pre { + direction: ltr !important; + text-align: left !important; +} + +/* Field lists */ +dl.field-list > dt { + float: right !important; + clear: right !important; + padding-left: 0.5em !important; + padding-right: 0 !important; +} + +dl.field-list > dd { + margin-right: 9em !important; + margin-left: 0 !important; +} + +/* Sidebars and topics */ +div.sidebar, +aside.sidebar { + float: left !important; + margin: 0 1em 0.5em 0 !important; +} + +/* Footer */ +div.footer { + text-align: left !important; + padding: 3px 0 3px 8px !important; +} + +/* Image alignments */ +img.align-left, +.figure.align-left, +object.align-left { + float: right !important; + margin-left: 1em !important; + margin-right: 0 !important; +} + +img.align-right, +.figure.align-right, +object.align-right { + float: left !important; + margin-right: 1em !important; + margin-left: 0 !important; +} + +/* Equation numbers */ +span.eqno { + float: left !important; +} + +/* Bibliography and citations */ +table.citation { + border-right: solid 1px gray !important; + border-left: none !important; + margin-right: 1px !important; + margin-left: 0 !important; +} + +/* Line blocks */ +.line-block .line-block { + margin-right: 1.5em !important; + margin-left: 0 !important; +} +{% endif %} \ No newline at end of file From 17a8aa4d48764cfc88bcb2c4e5b2607106074eec Mon Sep 17 00:00:00 2001 From: Revisto Date: Thu, 13 Feb 2025 22:46:53 +0330 Subject: [PATCH 06/18] Add RTL support for Scrolls theme with new CSS file --- sphinx/themes/scrolls/static/rtl.css.jinja | 151 ++++++++++++++++++ .../themes/scrolls/static/scrolls.css.jinja | 2 + 2 files changed, 153 insertions(+) create mode 100644 sphinx/themes/scrolls/static/rtl.css.jinja diff --git a/sphinx/themes/scrolls/static/rtl.css.jinja b/sphinx/themes/scrolls/static/rtl.css.jinja new file mode 100644 index 00000000000..1017a30ec19 --- /dev/null +++ b/sphinx/themes/scrolls/static/rtl.css.jinja @@ -0,0 +1,151 @@ +{% if theme_is_rtl|tobool %} + +/* Core RTL layout for Scrolls theme */ +body { + direction: rtl !important; + font-family: Vazirmatn !important; + text-align: right !important; +} + +/* Main layout adjustments */ +div.document { + direction: rtl !important; +} + +div.documentwrapper { + direction: rtl !important; +} + +/* Text alignments */ +div.body p, +div.body dd, +div.body li, +div.body blockquote { + direction: rtl !important; + text-align: right !important; +} + +/* Headers alignment */ +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + text-align: right !important; +} + +/* Lists */ +ul, ol { + margin-right: 30px !important; + margin-left: 0 !important; + padding-right: 0 !important; + padding-left: 0 !important; +} + +dd { + margin-right: 30px !important; + margin-left: 0 !important; +} + +/* Tables */ +table.docutils td, +table.docutils th { + text-align: right !important; + padding: 1px 5px 1px 8px !important; +} + +th { + text-align: right !important; + padding-left: 5px !important; + padding-right: 0 !important; +} + +/* Search page */ +ul.search { + margin: 10px 20px 0 0 !important; +} + +ul.search li { + padding: 5px 20px 5px 0 !important; + background-position: right 7px !important; +} + +ul.search li div.context { + margin: 2px 30px 0 0 !important; + text-align: right !important; +} + +/* Admonitions */ +div.admonition { + padding: 7px !important; + border-right: 0.2em solid black !important; + border-left: none !important; +} + +p.admonition-title { + margin: 0 0 5px 10px !important; +} + +/* Code blocks - keep LTR */ +pre { + direction: ltr !important; + text-align: left !important; +} + +/* Field lists */ +dl.field-list > dt { + float: right !important; + clear: right !important; + padding-left: 0.5em !important; + padding-right: 0 !important; +} + +dl.field-list > dd { + margin-right: 9em !important; + margin-left: 0 !important; +} + +/* Sidebars and topics */ +div.sidebar, +aside.sidebar { + float: left !important; + margin: 0 1em 0.5em 0 !important; +} + +/* Image alignments */ +img.align-left, +.figure.align-left, +object.align-left { + float: right !important; + margin-left: 1em !important; + margin-right: 0 !important; +} + +img.align-right, +.figure.align-right, +object.align-right { + float: left !important; + margin-right: 1em !important; + margin-left: 0 !important; +} + +/* Equation numbers */ +span.eqno { + float: left !important; +} + +/* Bibliography and citations */ +table.citation { + border-right: solid 1px gray !important; + border-left: none !important; + margin-right: 1px !important; + margin-left: 0 !important; +} + +/* Line blocks */ +.line-block .line-block { + margin-right: 1.5em !important; + margin-left: 0 !important; +} +{% endif %} \ No newline at end of file diff --git a/sphinx/themes/scrolls/static/scrolls.css.jinja b/sphinx/themes/scrolls/static/scrolls.css.jinja index 401449b8d9d..1578d6f752d 100644 --- a/sphinx/themes/scrolls/static/scrolls.css.jinja +++ b/sphinx/themes/scrolls/static/scrolls.css.jinja @@ -2,6 +2,8 @@ * Sphinx stylesheet -- scrolls theme. */ +@import url("rtl.css"); + body { background-color: #222; margin: 0; From 86c713512bd6e25376b440649c860141e24309d1 Mon Sep 17 00:00:00 2001 From: Revisto Date: Thu, 13 Feb 2025 22:50:28 +0330 Subject: [PATCH 07/18] Add RTL support for Traditional theme with new CSS file --- .../themes/traditional/static/rtl.css.jinja | 168 ++++++++++++++++++ .../traditional/static/traditional.css.jinja | 2 + 2 files changed, 170 insertions(+) create mode 100644 sphinx/themes/traditional/static/rtl.css.jinja diff --git a/sphinx/themes/traditional/static/rtl.css.jinja b/sphinx/themes/traditional/static/rtl.css.jinja new file mode 100644 index 00000000000..313c478c9b9 --- /dev/null +++ b/sphinx/themes/traditional/static/rtl.css.jinja @@ -0,0 +1,168 @@ +{% if theme_is_rtl|tobool %} + +/* Core RTL layout for Traditional theme */ +body { + direction: rtl !important; + font-family: Vazirmatn, avantgarde, sans-serif !important; +} + +/* Layout adjustments */ +div.documentwrapper { + float: right !important; +} + +div.bodywrapper { + margin: 0 0 0 {{ theme_sidebarwidth|todim }} !important; +} + +div.sphinxsidebar { + float: left !important; + margin-right: -100% !important; + margin-left: 0 !important; +} + +/* Navigation and related */ +div.related ul { + padding: 0 10px 0 0 !important; +} + +div.related li.right { + float: left !important; + margin-left: 5px !important; + margin-right: 0 !important; +} + +/* Text alignments */ +div.body p, +div.body dd, +div.body li { + text-align: right !important; +} + +div.body td { + text-align: right !important; + padding: 0 0 2px 8px !important; +} + +/* Headers */ +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + text-align: right !important; +} + +/* Lists and margins */ +ul.fakelist { + margin: 10px 20px 10px 0 !important; +} + +dd { + margin: 3px 30px 10px 0 !important; +} + +/* Sidebar adjustments */ +div.sphinxsidebarwrapper { + margin: 10px 0 10px 15px !important; +} + +div.sphinxsidebar ul { + margin-right: 15px !important; + margin-left: 0 !important; +} + +/* Search elements */ +ul.search { + margin: 10px 20px 0 0 !important; +} + +ul.search li { + padding: 5px 20px 5px 0 !important; + background-position: right 7px !important; +} + +ul.search li div.context { + margin: 2px 30px 0 0 !important; + text-align: right !important; +} + +/* Form elements */ +form dt { + float: right !important; + margin-left: 10px !important; + margin-right: 0 !important; +} + +/* Code blocks - keep LTR */ +pre { + direction: ltr !important; + text-align: left !important; +} + +/* Tables */ +th { + text-align: right !important; + padding-left: 5px !important; + padding-right: 0 !important; +} + +/* Admonitions */ +div.admonition { + padding: 7px !important; +} + +p.admonition-title { + margin: 0 0 5px 10px !important; +} + +/* View code links */ +.viewcode-link, .viewcode-back { + float: left !important; +} + +/* Topic boxes */ +nav.contents, +aside.topic, +div.topic { + direction: rtl !important; +} + +/* Equation numbers */ +span.eqno { + float: left !important; +} + +/* Header links */ +a.headerlink { + padding: 0 4px !important; +} + +/* Line blocks */ +.line-block .line-block { + margin: 0 1.5em 0 0 !important; +} + +/* Index tables */ +table.indextable td { + text-align: right !important; +} + +table.indextable > tbody > tr > td > ul { + padding-right: 0 !important; +} + +/* Field lists */ +.field-list ul { + padding-right: 1em !important; + padding-left: 0 !important; +} + +/* Print styles */ +@media print { + div.documentwrapper { + direction: rtl !important; + } +} +{% endif %} \ No newline at end of file diff --git a/sphinx/themes/traditional/static/traditional.css.jinja b/sphinx/themes/traditional/static/traditional.css.jinja index c5e829786d0..ed0b004aa79 100644 --- a/sphinx/themes/traditional/static/traditional.css.jinja +++ b/sphinx/themes/traditional/static/traditional.css.jinja @@ -2,6 +2,8 @@ * Sphinx stylesheet -- traditional docs.python.org theme. */ +@import url("rtl.css"); + body { color: #000; margin: 0; From 7d677a10ce56275f8de2894a75d2b7a7d81b7908 Mon Sep 17 00:00:00 2001 From: Revisto Date: Thu, 13 Feb 2025 23:11:42 +0330 Subject: [PATCH 08/18] Add RTL support documentation for themes --- doc/usage/theming.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/usage/theming.rst b/doc/usage/theming.rst index a596acfe0eb..12e7e2d0ed3 100644 --- a/doc/usage/theming.rst +++ b/doc/usage/theming.rst @@ -192,6 +192,16 @@ These themes are: .. versionadded:: 3.2 + - **is_rtl** (true or false): Enable right-to-left (RTL) text direction. + Use this for languages that are read right-to-left (like Farsi, Arabic, + Hebrew, etc). When enabled, the theme will: + + - Change text direction to RTL + - Mirror layout components + - Keep code blocks in LTR direction + + Defaults to ``False``. + **alabaster** `Alabaster theme`_ is a modified "Kr" Sphinx theme from @kennethreitz (especially as used in his Requests project), which was itself originally From 043534115a19f00f4310aff11dff1139c784dd01 Mon Sep 17 00:00:00 2001 From: Revisto Date: Thu, 13 Feb 2025 23:19:32 +0330 Subject: [PATCH 09/18] Closes #10385: Add RTL support for Sphinx themes - Add is_rtl theme option for right-to-left text direction - Implement automatic layout mirroring for RTL languages - Keep code blocks in LTR direction --- CHANGES.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 9f7b8f91eba..f9e2e67fe27 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -111,6 +111,10 @@ Features added * #13326: Remove hardcoding from handling :class:`~sphinx.addnodes.productionlist` nodes in all writers, to improve flexibility. Patch by Adam Turner. +* #10385: Add RTL (right-to-left) support for all Sphinx themes via ``is_rtl`` + theme option. Includes automatic layout mirroring, and bidirectional text + support. + Patch by Revisto. Bugs fixed ---------- From 08b2cd5b8b327283f4df1e7215f23a565d5de1e9 Mon Sep 17 00:00:00 2001 From: Revisto Date: Thu, 13 Feb 2025 23:28:09 +0330 Subject: [PATCH 10/18] Add Alireza Shabani to AUTHORS.rst as contributor --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index f57795d4fa7..5a8bd3cd689 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -24,6 +24,7 @@ Contributors * Alastair Houghton -- Apple Help builder * Alex Gaynor -- linkcheck retry on errors * Alexander Todorov -- inheritance_diagram tests and improvements +* Alireza Shabani -- RTL support * Andi Albrecht -- agogo theme * Antonio Valentino -- qthelp builder, docstring inheritance * Antti Kaihola -- doctest extension (skipif option) From 7d37adca899833098b325b50091ce0dfc8b0e0aa Mon Sep 17 00:00:00 2001 From: Revisto Date: Thu, 13 Feb 2025 23:44:31 +0330 Subject: [PATCH 11/18] Fix trailing whitespace in theme documentation --- doc/usage/theming.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/usage/theming.rst b/doc/usage/theming.rst index 12e7e2d0ed3..2d84bdb5169 100644 --- a/doc/usage/theming.rst +++ b/doc/usage/theming.rst @@ -193,9 +193,9 @@ These themes are: .. versionadded:: 3.2 - **is_rtl** (true or false): Enable right-to-left (RTL) text direction. - Use this for languages that are read right-to-left (like Farsi, Arabic, + Use this for languages that are read right-to-left (like Farsi, Arabic, Hebrew, etc). When enabled, the theme will: - + - Change text direction to RTL - Mirror layout components - Keep code blocks in LTR direction From c0aaec6639ca6798ba38d9463ab1e70e412e7f54 Mon Sep 17 00:00:00 2001 From: Revisto Date: Thu, 13 Feb 2025 23:46:25 +0330 Subject: [PATCH 12/18] Fix trailing whitespace in CHANGES.rst --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index f9e2e67fe27..d914cbd18df 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -112,7 +112,7 @@ Features added nodes in all writers, to improve flexibility. Patch by Adam Turner. * #10385: Add RTL (right-to-left) support for all Sphinx themes via ``is_rtl`` - theme option. Includes automatic layout mirroring, and bidirectional text + theme option. Includes automatic layout mirroring, and bidirectional text support. Patch by Revisto. From dc3c2e3d453433e40537add6cc5de40384bbec4d Mon Sep 17 00:00:00 2001 From: Revisto Date: Sat, 15 Feb 2025 13:35:34 +0330 Subject: [PATCH 13/18] Fix grammar in CHANGES.rst RTL Support - Add "the" before "is_rtl" - Fix line wrapping in CHANGES.rst entry --- CHANGES.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index d914cbd18df..6c3c48c175a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -111,9 +111,8 @@ Features added * #13326: Remove hardcoding from handling :class:`~sphinx.addnodes.productionlist` nodes in all writers, to improve flexibility. Patch by Adam Turner. -* #10385: Add RTL (right-to-left) support for all Sphinx themes via ``is_rtl`` - theme option. Includes automatic layout mirroring, and bidirectional text - support. +* #10385: Add RTL (right-to-left) support for all Sphinx themes via the ``is_rtl`` + theme option. Includes automatic layout mirroring, and bidirectional text support. Patch by Revisto. Bugs fixed From bf24eef4286327c1e2f0513b2606e408510f49b3 Mon Sep 17 00:00:00 2001 From: Revisto Date: Sat, 15 Feb 2025 13:37:14 +0330 Subject: [PATCH 14/18] Update author name in CHANGES.rst - Change "Revisto" to "Alireza Shabani" --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 6c3c48c175a..8e4f5a513f2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -113,7 +113,7 @@ Features added Patch by Adam Turner. * #10385: Add RTL (right-to-left) support for all Sphinx themes via the ``is_rtl`` theme option. Includes automatic layout mirroring, and bidirectional text support. - Patch by Revisto. + Patch by Alireza Shabani. Bugs fixed ---------- From b5f2e67010a83200f6dd7d258ddcc2d6c6437809 Mon Sep 17 00:00:00 2001 From: Revisto Date: Sat, 15 Feb 2025 13:39:08 +0330 Subject: [PATCH 15/18] Add versionadded directive for is_rtl in theming documentation --- doc/usage/theming.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/usage/theming.rst b/doc/usage/theming.rst index 2d84bdb5169..7a6bb958936 100644 --- a/doc/usage/theming.rst +++ b/doc/usage/theming.rst @@ -202,6 +202,8 @@ These themes are: Defaults to ``False``. + .. versionadded:: 8.2.0 + **alabaster** `Alabaster theme`_ is a modified "Kr" Sphinx theme from @kennethreitz (especially as used in his Requests project), which was itself originally From 01ae4843f9f3c92ce670ffc7cd25646ef9e0b1ac Mon Sep 17 00:00:00 2001 From: Revisto Date: Sat, 15 Feb 2025 14:07:21 +0330 Subject: [PATCH 16/18] Remove redundant RTL overrides from themes --- sphinx/themes/agogo/static/rtl.css.jinja | 1 - sphinx/themes/basic/static/rtl.css.jinja | 1 - sphinx/themes/nonav/static/rtl.css.jinja | 1 - sphinx/themes/traditional/static/rtl.css.jinja | 10 ---------- 4 files changed, 13 deletions(-) diff --git a/sphinx/themes/agogo/static/rtl.css.jinja b/sphinx/themes/agogo/static/rtl.css.jinja index 616cb9805a2..e7c8d1f1ae1 100644 --- a/sphinx/themes/agogo/static/rtl.css.jinja +++ b/sphinx/themes/agogo/static/rtl.css.jinja @@ -60,7 +60,6 @@ div.document dd { div.admonition { border-right: 0.2em solid black !important; border-left: none !important; - padding: 2px 7px 1px 7px !important; } /* Search elements */ diff --git a/sphinx/themes/basic/static/rtl.css.jinja b/sphinx/themes/basic/static/rtl.css.jinja index 0e3068c0287..87c2f7ebad0 100644 --- a/sphinx/themes/basic/static/rtl.css.jinja +++ b/sphinx/themes/basic/static/rtl.css.jinja @@ -182,7 +182,6 @@ a.reference.external { {% endif %} /* Topic boxes and sidebars */ -div.sidebar, div.topic { margin: 0 0 0.5em 1em !important; } diff --git a/sphinx/themes/nonav/static/rtl.css.jinja b/sphinx/themes/nonav/static/rtl.css.jinja index f9aa9b5cc7a..9d1a60d086b 100644 --- a/sphinx/themes/nonav/static/rtl.css.jinja +++ b/sphinx/themes/nonav/static/rtl.css.jinja @@ -78,7 +78,6 @@ ul.search li div.context { /* Admonitions */ div.admonition { - padding: 7px !important; border-right: 0.2em solid black !important; border-left: none !important; } diff --git a/sphinx/themes/traditional/static/rtl.css.jinja b/sphinx/themes/traditional/static/rtl.css.jinja index 313c478c9b9..a59a599a0d1 100644 --- a/sphinx/themes/traditional/static/rtl.css.jinja +++ b/sphinx/themes/traditional/static/rtl.css.jinja @@ -108,11 +108,6 @@ th { padding-right: 0 !important; } -/* Admonitions */ -div.admonition { - padding: 7px !important; -} - p.admonition-title { margin: 0 0 5px 10px !important; } @@ -134,11 +129,6 @@ span.eqno { float: left !important; } -/* Header links */ -a.headerlink { - padding: 0 4px !important; -} - /* Line blocks */ .line-block .line-block { margin: 0 1.5em 0 0 !important; From 886ba964d18e5a24233180873e2859c913b8a516 Mon Sep 17 00:00:00 2001 From: Revisto Date: Sun, 16 Feb 2025 04:23:01 +0330 Subject: [PATCH 17/18] Remove unused Vazirmatn font-family from RTL themes --- sphinx/themes/basic/static/rtl.css.jinja | 73 ------------------- sphinx/themes/nonav/static/rtl.css.jinja | 1 - sphinx/themes/scrolls/static/rtl.css.jinja | 1 - .../themes/traditional/static/rtl.css.jinja | 1 - 4 files changed, 76 deletions(-) diff --git a/sphinx/themes/basic/static/rtl.css.jinja b/sphinx/themes/basic/static/rtl.css.jinja index 87c2f7ebad0..d4229d90c4d 100644 --- a/sphinx/themes/basic/static/rtl.css.jinja +++ b/sphinx/themes/basic/static/rtl.css.jinja @@ -1,81 +1,8 @@ {% if theme_is_rtl|tobool %} -@font-face { - font-family: Vazirmatn; - src: url('fonts/vazir/Vazirmatn-Thin.woff2') format('woff2'); - font-weight: 100; - font-style: normal; - font-display: swap; -} - -@font-face { - font-family: Vazirmatn; - src: url('fonts/vazir/Vazirmatn-ExtraLight.woff2') format('woff2'); - font-weight: 200; - font-style: normal; - font-display: swap; -} - -@font-face { - font-family: Vazirmatn; - rc: url('fonts/vazir/Vazirmatn-Light.woff2') format('woff2'); - font-weight: 300; - font-style: normal; - font-display: swap; -} - -@font-face { - font-family: Vazirmatn; - src: url('fonts/vazir/Vazirmatn-Regular.woff2') format('woff2'); - font-weight: 400; - font-style: normal; - font-display: swap; -} - -@font-face { - font-family: Vazirmatn; - src: url('fonts/vazir/Vazirmatn-Medium.woff2') format('woff2'); - font-weight: 500; - font-style: normal; - font-display: swap; -} - -@font-face { - font-family: Vazirmatn; - src: url('fonts/vazir/Vazirmatn-SemiBold.woff2') format('woff2'); - font-weight: 600; - font-style: normal; - font-display: swap; -} - -@font-face { - font-family: Vazirmatn; - src: url('fonts/vazir/Vazirmatn-Bold.woff2') format('woff2'); - font-weight: 700; - font-style: normal; - font-display: swap; -} - -@font-face { - font-family: Vazirmatn; - src: url('fonts/vazir/Vazirmatn-ExtraBold.woff2') format('woff2'); - font-weight: 800; - font-style: normal; - font-display: swap; -} - -@font-face { - font-family: Vazirmatn; - src: url('fonts/vazir/Vazirmatn-Black.woff2') format('woff2'); - font-weight: 900; - font-style: normal; - font-display: swap; -} - /* Core RTL layout */ body { direction: rtl !important; - font-family: Vazirmatn !important; } /* Layout adjustments */ diff --git a/sphinx/themes/nonav/static/rtl.css.jinja b/sphinx/themes/nonav/static/rtl.css.jinja index 9d1a60d086b..21d5287dff0 100644 --- a/sphinx/themes/nonav/static/rtl.css.jinja +++ b/sphinx/themes/nonav/static/rtl.css.jinja @@ -3,7 +3,6 @@ /* Core RTL overrides for Nonav theme */ body { direction: rtl !important; - font-family: Vazirmatn !important; text-align: right !important; } diff --git a/sphinx/themes/scrolls/static/rtl.css.jinja b/sphinx/themes/scrolls/static/rtl.css.jinja index 1017a30ec19..31668bb8b47 100644 --- a/sphinx/themes/scrolls/static/rtl.css.jinja +++ b/sphinx/themes/scrolls/static/rtl.css.jinja @@ -3,7 +3,6 @@ /* Core RTL layout for Scrolls theme */ body { direction: rtl !important; - font-family: Vazirmatn !important; text-align: right !important; } diff --git a/sphinx/themes/traditional/static/rtl.css.jinja b/sphinx/themes/traditional/static/rtl.css.jinja index a59a599a0d1..2aa64850c25 100644 --- a/sphinx/themes/traditional/static/rtl.css.jinja +++ b/sphinx/themes/traditional/static/rtl.css.jinja @@ -3,7 +3,6 @@ /* Core RTL layout for Traditional theme */ body { direction: rtl !important; - font-family: Vazirmatn, avantgarde, sans-serif !important; } /* Layout adjustments */ From dbd3ea4196262be7d6cd8d9e4804cf28bf5c86e6 Mon Sep 17 00:00:00 2001 From: Revisto Date: Sun, 16 Feb 2025 04:47:14 +0330 Subject: [PATCH 18/18] Reduce duplication and trailing whitespace in RTL CSS themes --- sphinx/themes/agogo/static/rtl.css.jinja | 21 +++-- sphinx/themes/basic/static/rtl.css.jinja | 85 ++++++++++--------- sphinx/themes/epub/static/rtl.css.jinja | 57 ++++++------- sphinx/themes/nonav/static/rtl.css.jinja | 44 ++++------ .../themes/traditional/static/rtl.css.jinja | 37 ++++---- 5 files changed, 116 insertions(+), 128 deletions(-) diff --git a/sphinx/themes/agogo/static/rtl.css.jinja b/sphinx/themes/agogo/static/rtl.css.jinja index e7c8d1f1ae1..bb6e427a55d 100644 --- a/sphinx/themes/agogo/static/rtl.css.jinja +++ b/sphinx/themes/agogo/static/rtl.css.jinja @@ -1,8 +1,12 @@ {% if theme_is_rtl|tobool %} /* Core RTL overrides for Agogo theme */ -body { +body, +div.header div.rel { direction: rtl !important; +} + +body { text-align: right !important; } @@ -12,10 +16,6 @@ div.header .headertitle { letter-spacing: 0 !important; } -div.header div.rel { - direction: rtl !important; -} - p.logo { float: left !important; } @@ -127,20 +127,25 @@ aside.sidebar li.toctree-l3 a { } /* Image alignments */ -img.align-left, .figure.align-left, object.align-left { +img.align-left, +.figure.align-left, +object.align-left { float: right !important; margin-left: 1em !important; margin-right: 0 !important; } -img.align-right, .figure.align-right, object.align-right { +img.align-right, +.figure.align-right, +object.align-right { float: left !important; margin-right: 1em !important; margin-left: 0 !important; } /* Viewcode extension */ -.viewcode-link, .viewcode-back { +.viewcode-link, +.viewcode-back { float: left !important; } diff --git a/sphinx/themes/basic/static/rtl.css.jinja b/sphinx/themes/basic/static/rtl.css.jinja index d4229d90c4d..538d0a74899 100644 --- a/sphinx/themes/basic/static/rtl.css.jinja +++ b/sphinx/themes/basic/static/rtl.css.jinja @@ -1,54 +1,76 @@ {% if theme_is_rtl|tobool %} /* Core RTL layout */ -body { +body, +div.document, +div.documentwrapper, +div.body p, +div.body dd, +div.body li, +div.body blockquote { direction: rtl !important; } +/* Text alignments */ +body, +div.body p, +div.body dd, +div.body li, +div.body blockquote, +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6, +th, +table.docutils td { + text-align: right !important; +} + /* Layout adjustments */ div.sphinxsidebar { float: right !important; margin-right: -100% !important; } -/* Keep right items on the left */ -div.related li.right { - float: left !important; - margin-left: 10px !important; - margin-right: 0 !important; -} - div.bodywrapper { margin: 0 {{ theme_sidebarwidth|todim }} 0 0 !important; } -/* Text alignments and padding */ -div.body p, -div.body dd, -div.body li, -div.body blockquote { - direction: rtl !important; - text-align: justify !important; -} - +/* Headers padding */ div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { - text-align: right !important; padding: 3px 10px 3px 0 !important; } /* Lists */ -ul, ol { +ul, +ol { padding-right: 30px !important; padding-left: 0 !important; } -/* Form elements */ -div.sphinxsidebar input { +/* Left-aligned elements */ +div.related li.right, +#sidebarbutton { + float: left !important; +} + +div.related li.right { + margin-left: 10px !important; + margin-right: 0 !important; +} + +/* Form and search elements */ +div.sphinxsidebar input, +div.sphinxsidebar #searchbox input[type="text"], +div.sphinxsidebar #searchbox input[type="submit"] { + float: right !important; text-align: right !important; } @@ -70,31 +92,13 @@ pre { border-left: none !important; } -/* Tables */ -th { - text-align: right !important; -} - -table.docutils td { - text-align: right !important; -} - -/* Search */ -div.sphinxsidebar #searchbox input[type="text"] { - float: right !important; -} - -div.sphinxsidebar #searchbox input[type="submit"] { - float: right !important; -} - /* Admonitions */ div.admonition { padding: 7px 10px 7px 7px !important; } /* References and links */ -a.reference.internal, +a.reference.internal, a.reference.external { unicode-bidi: bidi-override !important; } @@ -102,7 +106,6 @@ a.reference.external { /* Sidebar collapsible button */ {% if theme_collapsiblesidebar|tobool %} #sidebarbutton { - float: left !important; border-right: 1px solid {{ theme_relbarbgcolor }} !important; border-left: none !important; } diff --git a/sphinx/themes/epub/static/rtl.css.jinja b/sphinx/themes/epub/static/rtl.css.jinja index be5e0b9df0d..b46c2bb5617 100644 --- a/sphinx/themes/epub/static/rtl.css.jinja +++ b/sphinx/themes/epub/static/rtl.css.jinja @@ -1,21 +1,36 @@ {% if theme_is_rtl|tobool %} /* Core RTL layout for Epub theme */ -body { +body, +div.header div.rel, +div.body p, +div.body dd, +div.body li, +div.body blockquote, +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { direction: rtl !important; text-align: right !important; } +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + border-bottom-color: {{ theme_headercolor2 }} !important; +} + /* Header adjustments */ div.header .headertitle { - text-align: right !important; letter-spacing: 0 !important; } -div.header div.rel { - direction: rtl !important; -} - p.logo { float: left !important; } @@ -47,25 +62,6 @@ aside.sidebar { {% endif %} } -/* Content elements */ -div.body p, -div.body dd, -div.body li, -div.body blockquote { - direction: rtl !important; - text-align: right !important; -} - -div.body h1, -div.body h2, -div.body h3, -div.body h4, -div.body h5, -div.body h6 { - text-align: right !important; - border-bottom-color: {{ theme_headercolor2 }} !important; -} - /* Lists and margins */ div.document ul { margin-right: 1.5em !important; @@ -78,9 +74,8 @@ div.document dd { } /* Tables */ -table.docutils td, +table.docutils td, table.docutils th { - text-align: right !important; padding: 1px 5px 1px 8px !important; } @@ -141,16 +136,16 @@ div.footer .left { } /* Image alignments */ -img.align-left, -.figure.align-left, +img.align-left, +.figure.align-left, object.align-left { float: right !important; margin-left: 1em !important; margin-right: 0 !important; } -img.align-right, -.figure.align-right, +img.align-right, +.figure.align-right, object.align-right { float: left !important; margin-right: 1em !important; diff --git a/sphinx/themes/nonav/static/rtl.css.jinja b/sphinx/themes/nonav/static/rtl.css.jinja index 21d5287dff0..86bc85e6f6c 100644 --- a/sphinx/themes/nonav/static/rtl.css.jinja +++ b/sphinx/themes/nonav/static/rtl.css.jinja @@ -1,30 +1,21 @@ {% if theme_is_rtl|tobool %} /* Core RTL overrides for Nonav theme */ -body { - direction: rtl !important; - text-align: right !important; -} - -/* Main layout adjustments */ -div.document { - direction: rtl !important; -} - -div.documentwrapper { - direction: rtl !important; -} - -/* Text alignments */ -div.body p, -div.body dd, -div.body li, +body, +div.document, +div.documentwrapper, +div.body p, +div.body dd, +div.body li, div.body blockquote { direction: rtl !important; - text-align: right !important; } -/* Headers alignment */ +body, +div.body p, +div.body dd, +div.body li, +div.body blockquote, div.body h1, div.body h2, div.body h3, @@ -35,7 +26,8 @@ div.body h6 { } /* Lists */ -ul, ol { +ul, +ol { margin-right: 30px !important; margin-left: 0 !important; padding-right: 0 !important; @@ -48,7 +40,7 @@ dd { } /* Tables */ -table.docutils td, +table.docutils td, table.docutils th { text-align: right !important; padding: 1px 5px 1px 8px !important; @@ -118,16 +110,16 @@ div.footer { } /* Image alignments */ -img.align-left, -.figure.align-left, +img.align-left, +.figure.align-left, object.align-left { float: right !important; margin-left: 1em !important; margin-right: 0 !important; } -img.align-right, -.figure.align-right, +img.align-right, +.figure.align-right, object.align-right { float: left !important; margin-right: 1em !important; diff --git a/sphinx/themes/traditional/static/rtl.css.jinja b/sphinx/themes/traditional/static/rtl.css.jinja index 2aa64850c25..d8ee7925e19 100644 --- a/sphinx/themes/traditional/static/rtl.css.jinja +++ b/sphinx/themes/traditional/static/rtl.css.jinja @@ -1,7 +1,10 @@ {% if theme_is_rtl|tobool %} -/* Core RTL layout for Traditional theme */ -body { +/* Core RTL layout */ +body, +nav.contents, +aside.topic, +div.topic { direction: rtl !important; } @@ -32,18 +35,9 @@ div.related li.right { } /* Text alignments */ -div.body p, -div.body dd, -div.body li { - text-align: right !important; -} - -div.body td { - text-align: right !important; - padding: 0 0 2px 8px !important; -} - -/* Headers */ +div.body p, +div.body dd, +div.body li, div.body h1, div.body h2, div.body h3, @@ -53,6 +47,11 @@ div.body h6 { text-align: right !important; } +div.body td { + text-align: right !important; + padding: 0 0 2px 8px !important; +} + /* Lists and margins */ ul.fakelist { margin: 10px 20px 10px 0 !important; @@ -112,17 +111,11 @@ p.admonition-title { } /* View code links */ -.viewcode-link, .viewcode-back { +.viewcode-link, +.viewcode-back { float: left !important; } -/* Topic boxes */ -nav.contents, -aside.topic, -div.topic { - direction: rtl !important; -} - /* Equation numbers */ span.eqno { float: left !important;