From bf9ccc84274ed002008d11f7fb101cd6d8320adf Mon Sep 17 00:00:00 2001 From: Nikita Nemkin Date: Sat, 1 Feb 2025 20:33:31 +0500 Subject: Help: Theme improvements * Push the footer to the bottom of the page (for short pages). * Remove the link from the sidebar "Table of Contents" header. * Remove text justification from TOCs and tables. * Adjust logo position in the header. * Restructure the navigation bar from CMake >> [version] Documentation >> Page to CMake [version] >> Documentation >> Page --- Utilities/Sphinx/static/cmake.css | 29 ++++++++++++++++++++++++++++- Utilities/Sphinx/templates/layout.html | 19 ++++++++----------- Utilities/Sphinx/templates/localtoc.html | 8 ++++++++ 3 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 Utilities/Sphinx/templates/localtoc.html diff --git a/Utilities/Sphinx/static/cmake.css b/Utilities/Sphinx/static/cmake.css index 909b58a..b4dcb32 100644 --- a/Utilities/Sphinx/static/cmake.css +++ b/Utilities/Sphinx/static/cmake.css @@ -1,6 +1,28 @@ /* Import the Sphinx theme style. */ @import url("default.css"); +/* Navbar logo */ +li.rootlink > img { + vertical-align: middle; + margin-top: -5px; +} + +/* Push the footer to the bottom of the page. */ +body { + display: flex; + flex-direction: column; + min-height: 100svh; +} + +div.document { + flex-grow: 1; +} + +div.bodywrapper, +div.body { + height: 100%; +} + /* Wrap sidebar content even within words so that long document names do not escape sidebar borders. */ div.sphinxsidebarwrapper { @@ -17,6 +39,12 @@ div.sphinxsidebarwrapper { background-color: #dfdfdf; } +/* Un-justify some elements. */ +div.body table.docutils p, +div.body nav.contents p { + text-align: left; +} + /* Apply
 style (from classic.css) to signature directive argument. */
 .signature .sig {
   padding: 5px;
@@ -73,7 +101,6 @@ div.outdated {
   padding-right: 2px;
   padding-top: 5px;
   text-align: center;
-  width: 100%;
 }
 
 /* Revert style to the inherited (normal text) for `:guide:` links */
diff --git a/Utilities/Sphinx/templates/layout.html b/Utilities/Sphinx/templates/layout.html
index 8fb7c42..e783a2d 100644
--- a/Utilities/Sphinx/templates/layout.html
+++ b/Utilities/Sphinx/templates/layout.html
@@ -1,19 +1,16 @@
 {% extends "!layout.html" %}
 {% block rootrellink %}
-  
  • - -
  • -
  • - CMake{{ reldelim1 }} +
  • - {%- if versionswitch is defined %} - {{ release }} {% trans %}Documentation{% endtrans %}{{ reldelim1 }} - {%- else %} - {{ shorttitle|e }}{{ reldelim1 }} - {%- endif %}
  • {% endblock %} diff --git a/Utilities/Sphinx/templates/localtoc.html b/Utilities/Sphinx/templates/localtoc.html new file mode 100644 index 0000000..0065fe7 --- /dev/null +++ b/Utilities/Sphinx/templates/localtoc.html @@ -0,0 +1,8 @@ +{# Sphinx sidebar template: local table of contents. + Overridden to remove the "#" link from the "Table of Contents". #} +{%- if display_toc %} +
    +

    {{ _('Table of Contents') }}

    + {{ toc }} +
    +{%- endif %} -- cgit v0.12