Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions python_docs_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ <h3>{{ _('Navigation') }}</h3>
<script type="text/javascript" src="{{ pathto('_static/themetoggle.js', 1) }}"></script>
{%- endif -%}
{%- endif -%}
{%- if theme_is_rtl|lower == "true" %}
<script>
document.documentElement.dir = 'rtl';
document.documentElement.lang = '{{ language }}';
</script>
{%- endif %}
{{ super() }}
{%- endblock -%}

Expand Down
120 changes: 79 additions & 41 deletions python_docs_theme/static/pydoctheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ div.related a:hover {
}

.switchers > div {
margin-right: 5px;
margin-inline-end: 5px;
}

div.related ul::after {
Expand All @@ -117,6 +117,19 @@ div.related ul::after {
display: block;
}

html[dir='rtl'] div.related ul {
padding: 0 10px 0 0;
}

html[dir='rtl'] div.related ul li.right {
Comment thread
sepehr-rs marked this conversation as resolved.
Outdated
float: left;
}

html[dir='rtl'] div.related ul li {
float: right;
padding-inline: 0.3em;
}

.inline-search,
form.inline-search input {
display: inline;
Expand All @@ -130,6 +143,7 @@ form.inline-search input[type='submit'] {

div.document {
display: flex;
flex-direction: row;
/* Don't let long code literals extend beyond the right side of the screen */
overflow-wrap: break-word;
}
Expand All @@ -142,6 +156,9 @@ span.pre {
div.sphinxsidebar {
display: flex;
width: min(25vw, 350px);
flex-shrink: 0;
margin: 0;
order: 0;
float: none;
position: sticky;
top: 0;
Expand All @@ -159,7 +176,13 @@ div.sphinxsidebar h4 {
}

div.bodywrapper {
margin-left: min(25vw, 350px);
margin-inline-start: 0;
}

div.documentwrapper {
flex: 1;
min-width: 0;
order: 1;
}

div.sphinxsidebarwrapper {
Expand Down Expand Up @@ -202,8 +225,9 @@ div.sphinxsidebar input[type='text'] {
align-items: center;
width: 12px;
min-width: 12px;
border-radius: 0 5px 5px 0;
border-left: none;
border-start-end-radius: 5px;
border-end-end-radius: 5px;
border-inline-start: none;
}

#sidebarbutton:hover {
Expand All @@ -214,8 +238,13 @@ div.body {
padding: 0 0 0 1.2em;
}

html[dir='rtl'] div.body {
padding: 0 1.2em 0 0;
direction: rtl;
Comment thread
sepehr-rs marked this conversation as resolved.
Outdated
}

div.body p, div.body dd, div.body li, div.body blockquote {
text-align: left;
text-align: start;
line-height: 1.6;
}
div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 {
Expand All @@ -233,6 +262,10 @@ div.body hr {
height: 1px;
}

div.body pre, div.body code, div.highlight {
direction: ltr;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also affects signatures, no? Does that not make it inconvenient, with the propose opposite?

}

div.body pre {
border-radius: 3px;
border: 1px solid #ac9;
Expand All @@ -251,19 +284,10 @@ div.body {
}

div.code-block-caption {
background-color: #eee;
Comment thread
sepehr-rs marked this conversation as resolved.
border: 1px solid #ac9;
border-bottom: none;
border-radius: 3px 3px 0 0;
padding: 0.3em 0.6em;
font-size: 90%;
color: #333;

Comment thread
StanFromIreland marked this conversation as resolved.
& + div pre {
border-top-left-radius: 0 !important;
border-top-right-radius: 0 !important;
}

& + div .copybutton {
border-top-right-radius: 0 !important;
}
Expand Down Expand Up @@ -402,7 +426,7 @@ table.docutils th {

table p,
table li {
text-align: left !important;
text-align: start !important;
}

table.docutils th {
Expand All @@ -416,9 +440,9 @@ table.footnote td {

div.footer {
line-height: 150%;
text-align: right;
text-align: end; /* was: text-align: right */
Comment thread
sepehr-rs marked this conversation as resolved.
Outdated
width: auto;
margin-right: 10px;
margin-inline-end: 10px; /* was: margin-right */
}

div.footer a {
Expand Down Expand Up @@ -483,11 +507,11 @@ dl > dt span ~ em,
}

.toctree-wrapper ul {
padding-left: 20px;
padding-inline-start: 20px;
}

.theme-selector {
margin-left: .5em;
margin-inline-start: .5em;
}

div.genindex-jumpbox,
Expand All @@ -506,17 +530,17 @@ div.genindex-jumpbox a {
cursor: pointer;
position: absolute;
top: 0;
right: 0;
right: 0; /* physical right; always, even in RTL, since code is LTR */
font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
font-size: 80%;
padding-left: .5em;
padding-right: .5em;
height: 100%;
max-height: min(100%, 2.4em);
border-radius: 0 3px 0 0;
border-radius: 0 3px 0 0; /* physical — top-right corner, always */
color: #000;
background-color: #fff;
border: 1px solid #ac9; /* follows div.body pre */
border: 1px solid #ac9;
display: none;
}

Expand Down Expand Up @@ -583,7 +607,7 @@ div.genindex-jumpbox a {
width: 100%;
position: fixed;
top: 0;
left: 0;
inset-inline-start: 0;
box-shadow: rgba(0, 0, 0, 0.25) 0 0 2px 0;
z-index: 1;
}
Expand All @@ -604,8 +628,11 @@ div.genindex-jumpbox a {
padding: .25rem;
align-items: stretch;
}
html[dir='rtl'] .nav-items-wrapper {
flex-direction: row-reverse;
}
.nav-logo {
margin-right: 1rem;
margin-inline-end: 1rem;
flex-shrink: 0;
align-self: center;
}
Expand All @@ -614,7 +641,7 @@ div.genindex-jumpbox a {
width: 20px;
}
.version_switcher_placeholder {
margin-right: 1rem;
margin-inline-end: 1rem;
}
.version_switcher_placeholder > select {
height: 100%;
Expand All @@ -627,22 +654,30 @@ div.genindex-jumpbox a {
}
.nav-content .search input[type=search] {
border: 0;
padding-left: 24px;
padding-inline-start: 24px; /* was: padding-left */
width: 100%;
flex: 1;
}
html[dir='rtl'] .nav-content .search input[type=search] {
padding-inline-start: 4px;
padding-inline-end: 24px;
}
.nav-content .search input[type=submit] {
height: 100%;
box-shadow: none;
border: 0;
border-left: 1px solid #a9a9a9;
border-inline-start: 1px solid #a9a9a9;
cursor: pointer;
margin-right: 0;
margin-inline-end: 0;
}
.nav-content .search svg {
Comment thread
sepehr-rs marked this conversation as resolved.
position: absolute;
align-self: center;
padding-left: 4px;
padding-inline-start: 4px;
}
html[dir='rtl'] .nav-content .search svg {
padding-inline-start: 0;
padding-inline-end: 4px;
}
.toggler__input {
display: none;
Expand All @@ -656,6 +691,9 @@ div.genindex-jumpbox a {
padding: 8px;
flex-shrink: 0;
}
html[dir='rtl'] .toggler__label {
order: 1;
}
.toggler__label:hover, .toggler__label:focus {
background-color: rgba(127 127 127 / 50%);
}
Expand All @@ -674,7 +712,7 @@ div.genindex-jumpbox a {
width: 100%;
background: inherit;
position: absolute;
left: 0;
inset-inline-start: 0;
top: -8px;
}
.toggler__label > span::after {
Expand All @@ -695,16 +733,16 @@ div.genindex-jumpbox a {
}
.toggler__input:checked ~ .menu-wrapper {
visibility: visible;
left: 0;
inset-inline-start: 0; /* was: left: 0 */
}

/* Sliding side menu */
.menu-wrapper {
display: block;
position: fixed;
top: 0;
transition: left 400ms ease;
left: -310px;
transition: inset-inline-start 400ms ease;
inset-inline-start: -310px;
width: 300px;
height: 100%;
background-color: #eee;
Expand All @@ -714,7 +752,7 @@ div.genindex-jumpbox a {
}
.menu-wrapper.open {
visibility: visible;
left: 0;
inset-inline-start: 0;
}
.menu {
padding: 40px 10px 30px 20px;
Expand Down Expand Up @@ -742,10 +780,10 @@ div.genindex-jumpbox a {
list-style: none;
line-height: 1.4;
overflow-wrap: break-word;
padding-left: 0;
padding-inline-start: 0;
}
.menu ul ul {
margin-left: 20px;
margin-inline-start: 20px;
list-style: square;
}
.menu ul li {
Expand Down Expand Up @@ -801,26 +839,26 @@ div.versionadded,
div.versionchanged,
div.deprecated,
div.deprecated-removed {
border-left: 3px solid;
border-inline-start: 3px solid;
padding: 0 1rem;
}

div.versionadded {
border-left-color: var(--versionadded-border);
border-inline-start-color: var(--versionadded-border);
}

div.versionchanged {
border-left-color: var(--versionchanged-border);
border-inline-start-color: var(--versionchanged-border);
}

div.deprecated,
div.deprecated-removed,
div.versionremoved {
border-left-color: var(--deprecated-border);
border-inline-start-color: var(--deprecated-border);
}

div.soft-deprecated {
border-left-color: var(--soft-deprecated-border);
border-inline-start-color: var(--soft-deprecated-border);
}

div.versionadded .versionmodified {
Expand Down
1 change: 1 addition & 0 deletions python_docs_theme/theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ headbgcolor = "white"
headlinkcolor = "#aaaaaa"
codebgcolor = "#eeffcc"
codetextcolor = "#333333"
is_rtl = "false"

hosted_on = ""
issues_url = ""
Expand Down
Loading