From d14d924470a1764b2d0292aedad3873fef03d85d Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Thu, 2 Mar 2023 20:19:50 +0100 Subject: [PATCH] Display Godot version more clearly --- _static/css/custom.css | 1 + _static/js/custom.js | 6 ++--- _templates/breadcrumbs.html | 47 ++++++++++++++++++++++++------------- _templates/layout.html | 1 + _templates/versions.html | 2 +- conf.py | 37 +++++++++++++++-------------- 6 files changed, 57 insertions(+), 37 deletions(-) diff --git a/_static/css/custom.css b/_static/css/custom.css index ac77f206207..b7374e02f3a 100644 --- a/_static/css/custom.css +++ b/_static/css/custom.css @@ -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 { diff --git a/_static/js/custom.js b/_static/js/custom.js index 03ae375db2d..81483b7f1ba 100644 --- a/_static/js/custom.js +++ b/_static/js/custom.js @@ -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); diff --git a/_templates/breadcrumbs.html b/_templates/breadcrumbs.html index 77f1aa9d1cc..d7e3dfd38ee 100644 --- a/_templates/breadcrumbs.html +++ b/_templates/breadcrumbs.html @@ -1,25 +1,40 @@ {%- extends "sphinx_rtd_theme/breadcrumbs.html" %} +{% block breadcrumbs %} +
  • +
    + {{ godot_docs_title | replace("%s", godot_version) }} +
    + +
  • +{% endblock %} + {% block breadcrumbs_aside %} {% if not meta or meta.get('github_url') != 'hide' %} -{{ super() }} - - - - Learn how to contribute! - + + + Learn how to contribute! + + {% endif %} {% endblock %} diff --git a/_templates/layout.html b/_templates/layout.html index 2ecffa5c4f0..65225fbf3c8 100644 --- a/_templates/layout.html +++ b/_templates/layout.html @@ -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 -%} {{ godot_title_prefix }}{{ title|striptags|e }}{{ titlesuffix }} diff --git a/_templates/versions.html b/_templates/versions.html index 50e739a3005..e46ca819a95 100644 --- a/_templates/versions.html +++ b/_templates/versions.html @@ -13,7 +13,7 @@
    Read the Docs - v: {{ display_version }} + v: {{ display_version }}{% if display_version != godot_version %} ({{ godot_version }}){% endif %}
    diff --git a/conf.py b/conf.py index 7d93747f344..e7301576d20 100644 --- a/conf.py +++ b/conf.py @@ -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") @@ -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 = { @@ -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", @@ -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'}) ]