Skip to content

Commit

Permalink
Display Godot version more clearly
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriSizov committed Mar 2, 2023
1 parent 956810f commit d14d924
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 37 deletions.
1 change: 1 addition & 0 deletions _static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,7 @@ p + .classref-constant {
overflow-y: auto;
overflow-x: hidden;
max-height: calc(100% - 348px);
padding-bottom: 24px;
}
@media screen and (max-width: 768px) {
.wy-nav-side {
Expand Down
6 changes: 3 additions & 3 deletions _static/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ const registerOnScrollEvent = (function(){
// The number of pixels the user must scroll by before the logo is completely hidden.
const scrollTopPixels = 84;
// The target margin to be applied to the navigation bar when the logo is hidden.
const menuTopMargin = 88;
const menuTopMargin = 70;
// The max-height offset when the logo is completely visible.
const menuHeightOffset_default = 180;
const menuHeightOffset_default = 162;
// The max-height offset when the logo is completely hidden.
const menuHeightOffset_fixed = 98;
const menuHeightOffset_fixed = 80;
// The distance between the two max-height offset values above; used for intermediate values.
const menuHeightOffset_diff = (menuHeightOffset_default - menuHeightOffset_fixed);

Expand Down
47 changes: 31 additions & 16 deletions _templates/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
{%- extends "sphinx_rtd_theme/breadcrumbs.html" %}

{% block breadcrumbs %}
<li>
<div style="font-size: 105%;font-weight: 600;">
{{ godot_docs_title | replace("%s", godot_version) }}
</div>
<ul class="wy-breadcrumbs">
{{ super() }}
</ul>
</li>
{% endblock %}

{% block breadcrumbs_aside %}
{% if not meta or meta.get('github_url') != 'hide' %}
{{ super() }}

<style>
.godot-edit-guidelines {
font-size: 14px;
float: right;
clear: both;
padding-top: 4px;
}
<li style="float: right; text-align: right;">
<ul>
{{ super() }}
</ul>

@media screen and (max-width: 480px) {
<style>
.godot-edit-guidelines {
display: none;
font-size: 14px;
float: right;
clear: both;
padding-top: 4px;
}

@media screen and (max-width: 480px) {
.godot-edit-guidelines {
display: none;
}
}
}
</style>
<a class="godot-edit-guidelines" href="https://docs.godotengine.org/en/latest/contributing/documentation/index.html#writing-documentation">
Learn how to contribute!
</a>
</style>
<a class="godot-edit-guidelines" href="https://docs.godotengine.org/en/latest/contributing/documentation/index.html#writing-documentation">
Learn how to contribute!
</a>
</li>
{% endif %}
{% endblock %}
1 change: 1 addition & 0 deletions _templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "!layout.html" -%}
{# Refer to https://github.com/readthedocs/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/layout.html #}

{% block htmltitle -%}
<title>{{ godot_title_prefix }}{{ title|striptags|e }}{{ titlesuffix }}</title>
Expand Down
2 changes: 1 addition & 1 deletion _templates/versions.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Read the Docs</span>
v: {{ display_version }}
v: {{ display_version }}{% if display_version != godot_version %} ({{ godot_version }}){% endif %}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
Expand Down
37 changes: 20 additions & 17 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,20 @@
# Language / i18n

supported_languages = {
"en": "Godot Engine (%s) documentation in English",
"de": "Godot Engine (%s) Dokumentation auf Deutsch",
"es": "Documentación de Godot Engine (%s) en español",
"fr": "Documentation de Godot Engine (%s) en français",
"fi": "Godot Engine (%s) dokumentaatio suomeksi",
"it": "Godot Engine (%s) documentazione in italiano",
"ja": "Godot Engine (%s)の日本語のドキュメント",
"ko": "Godot Engine (%s) 문서 (한국어)",
"pl": "Dokumentacja Godot Engine (%s) w języku polskim",
"pt_BR": "Documentação da Godot Engine (%s) em Português Brasileiro",
"ru": "Документация Godot Engine (%s) на русском языке",
"uk": "Документація до Godot Engine (%s) українською мовою",
"zh_CN": "Godot Engine (%s) 简体中文文档",
"zh_TW": "Godot Engine (%s) 正體中文 (台灣) 文件",
"en": "Godot Engine %s documentation in English",
"de": "Godot Engine %s Dokumentation auf Deutsch",
"es": "Documentación de Godot Engine %s en español",
"fr": "Documentation de Godot Engine %s en français",
"fi": "Godot Engine %s dokumentaatio suomeksi",
"it": "Godot Engine %s documentazione in italiano",
"ja": "Godot Engine %sの日本語のドキュメント",
"ko": "Godot Engine %s 문서 (한국어)",
"pl": "Dokumentacja Godot Engine %s w języku polskim",
"pt_BR": "Documentação da Godot Engine %s em Português Brasileiro",
"ru": "Документация Godot Engine %s на русском языке",
"uk": "Документація до Godot Engine %s українською мовою",
"zh_CN": "Godot Engine %s 简体中文文档",
"zh_TW": "Godot Engine %s 正體中文 (台灣) 文件",
}

language = os.getenv("READTHEDOCS_LANGUAGE", "en")
Expand Down Expand Up @@ -155,9 +155,11 @@
"logo_only": True,
# Collapse navigation (False makes it tree-like)
"collapse_navigation": False,
# Hide the documentation version name/number under the logo
"display_version": False,
}

html_title = supported_languages[language] % version
html_title = supported_languages[language] % ( "(" + version + ")" )

# VCS options: https://docs.readthedocs.io/en/latest/vcs.html#github
html_context = {
Expand All @@ -168,6 +170,7 @@
"conf_py_path": "/", # Path in the checkout to the docs root
"godot_inject_language_links": True,
"godot_docs_supported_languages": list(supported_languages.keys()),
"godot_docs_title": supported_languages[language],
"godot_docs_basepath": "https://docs.godotengine.org/",
"godot_docs_suffix": ".html",
"godot_default_lang": "en",
Expand Down Expand Up @@ -195,14 +198,14 @@
html_css_files = [
'css/algolia.css',
'https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css',
"css/custom.css?9", # Increment the number at the end when the file changes to bust the cache.
"css/custom.css?10", # Increment the number at the end when the file changes to bust the cache.
]

if not on_rtd:
html_css_files.append("css/dev.css")

html_js_files = [
"js/custom.js?5", # Increment the number at the end when the file changes to bust the cache.
"js/custom.js?6", # Increment the number at the end when the file changes to bust the cache.
('https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js', {'defer': 'defer'}),
('js/algolia.js', {'defer': 'defer'})
]
Expand Down

0 comments on commit d14d924

Please sign in to comment.