Merge "Adds starlingxdocs_plus theme for version button"

This commit is contained in:
Zuul 2021-03-10 16:07:15 +00:00 committed by Gerrit Code Review
commit fad2ab40ae
5 changed files with 87 additions and 7 deletions

View File

@ -0,0 +1,26 @@
import openstackdocstheme as osdt
def _html_page_context(app, pagename, templatename, context, doctree):
context['this_version']=app.config.starlingxdocs_plus_this_version
context['other_versions']=app.config.starlingxdocs_plus_other_versions
context['bug_project'] = app.config.starlingxdocs_plus_bug_project
context['bug_tag'] = app.config.starlingxdocs_plus_bug_tag
def setup(app):
app.add_html_theme(
'openstackdocs',
osdt.__path__[0] + '/theme/openstackdocs',
)
app.add_html_theme(
'starlingxdocs',
osdt.__path__[0] + '/theme/starlingxdocs',
)
app.add_config_value('starlingxdocs_plus_this_version','','env')
app.add_config_value('starlingxdocs_plus_other_versions', [], 'env')
app.add_config_value('starlingxdocs_plus_repo_name','','env')
app.add_config_value('starlingxdocs_plus_project','','env')
app.add_config_value('starlingxdocs_plus_auto_name', False, 'env')
app.add_config_value('starlingxdocs_plus_bug_project','','env')
app.add_config_value('starlingxdocs_plus_bug_tag','','env')
app.connect('html-page-context', _html_page_context)
app.add_css_file("custom.css")

View File

@ -0,0 +1,3 @@
.version-dropdown-content {
top: 12px;
}

View File

@ -0,0 +1,2 @@
[theme]
inherit = starlingxdocs

View File

@ -0,0 +1,33 @@
<div class="row">
<div class="col-lg-8">
{%- if theme_sidebar_dropdown == 'os_docs' %}
<h2>{{ title }}</h2>
{% else %}
<h2>StarlingX API Documentation</h2>
{%- endif %}
</div>
<div class="docs-actions">
{%- block otherversions %}
{%- if other_versions %}
<div class="version-dropdown">
<span>{{ _('version') }}</span>
<div class="version-dropdown-content">
<p><a href="." rel="nofollow">{{ this_version }}</a></p>
{%- for ver in other_versions: %}
<p><a href="{{pathto(ver[1], 1) }}" rel="nofollow">{{ ver[0] }}</a></p>
{%- endfor %}
</div>
</div>
{%- endif %}
{%- endblock %}
{% if prev %}
<a href="{{ prev.link|e }}"><i class="fa fa-angle-double-left" data-toggle="tooltip" data-placement="top" title="Previous: {{ prev.title|striptags }}"></i></a>
{% endif %}
{% if next %}
<a href="{{ next.link|e }}"><i class="fa fa-angle-double-right" data-toggle="tooltip" data-placement="top" title="Next: {{ next.title|striptags }}"></i></a>
{% endif %}
{%- if bug_project %}
<a id="logABugLink1" href="" target="_blank" title="Found an error? Report a bug against this page"><i class="fa fa-bug" data-toggle="tooltip" data-placement="top" title="Report a Bug"></i></a>
{% endif %}
</div>
</div>

View File

@ -14,6 +14,7 @@
#
import os
import sys
sys.path.insert(0,os.path.abspath('_themes'))
# sys.path.insert(0, os.path.abspath('.'))
@ -34,7 +35,8 @@ author = 'StarlingX'
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'openstackdocstheme',
# 'openstackdocstheme',
'starlingxdocs_plus'
]
# Add any paths that contain templates here, relative to this directory.
@ -65,11 +67,12 @@ exclude_patterns = []
pygments_style = 'native'
# General information about the project.
openstackdocs_repo_name = 'openstack/stx-docs'
openstackdocs_project = 'StarlingX'
openstackdocs_auto_name = False
openstackdocs_bug_project = 'starlingx'
openstackdocs_bug_tag = 'stx.docs'
# Legacy openstackdocstheme variables
# openstackdocs_repo_name = 'openstack/stx-docs'
# openstackdocs_project = 'StarlingX'
# openstackdocs_auto_name = False
# openstackdocs_bug_project = 'starlingx'
# openstackdocs_bug_tag = 'stx.docs'
# Common substitution strings such as organization, product
@ -82,7 +85,8 @@ rst_prolog = open('./shared/strings.txt', 'r').read()
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'starlingxdocs'
html_theme_path = ['_themes']
html_theme = 'starlingxdocs_plus'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@ -165,3 +169,15 @@ texinfo_documents = [
author, 'stx-docs', 'One line description of project.',
'Miscellaneous'),
]
# -- Options for starlingxdocs_plus theme output -----------------------------
# General information about the project.
starlingxdocs_plus_repo_name = 'openstack/stx-docs'
starlingxdocs_plus_project = 'StarlingX'
starlingxdocs_plus_auto_name = False
starlingxdocs_plus_bug_project = 'starlingx'
starlingxdocs_plus_bug_tag = 'stx.docs'
starlingxdocs_plus_this_version = "latest"
# starlingxdocs_plus_other_versions = [("even later","even-later"),("sooner","sooner")]
starlingxdocs_plus_other_versions = []