[DOCS] Added versioning (#453)

This commit is contained in:
Philippe Tillet
2022-02-08 11:28:18 -08:00
committed by GitHub
parent 7b48340ffd
commit 822ddcd14b
2 changed files with 53 additions and 13 deletions

27
docs/_templates/versions.html vendored Normal file
View File

@@ -0,0 +1,27 @@
{%- if current_version %}
<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"> Other Versions</span>
v: {{ current_version.name }}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
{%- if versions.tags %}
<dl>
<dt>Tags</dt>
{%- for item in versions.tags %}
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
{%- endfor %}
</dl>
{%- endif %}
{%- if versions.branches %}
<dl>
<dt>Branches</dt>
{%- for item in versions.branches %}
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
{%- endfor %}
</dl>
{%- endif %}
</div>
</div>
{%- endif %}

View File

@@ -66,25 +66,38 @@ def setup(app):
import sys import sys
import os import os
sys.path.insert(0, os.path.abspath('../python/')) sys.path.insert(0, os.path.abspath('../python/'))
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.autosummary', 'sphinx.ext.coverage', 'sphinx.ext.napoleon'] extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.autosummary', 'sphinx.ext.coverage', 'sphinx.ext.napoleon', 'sphinx_multiversion']
autosummary_generate = True autosummary_generate = True
# versioning config
smv_tag_whitelist = r'^(v1.1.1)$'
smv_branch_whitelist = r'^master$'
smv_remote_whitelist = None
smv_released_pattern = r'^tags/.*$'
smv_outputdir_format = '{ref.name}'
smv_prefer_remote_refs = False
# Sphinx gallery # Sphinx gallery
extensions += ['sphinx_gallery.gen_gallery'] # extensions += ['sphinx_gallery.gen_gallery']
from sphinx_gallery.sorting import FileNameSortKey # from sphinx_gallery.sorting import FileNameSortKey
sphinx_gallery_conf = { # sphinx_gallery_conf = {
'examples_dirs': '../python/tutorials/', # 'examples_dirs': '../python/tutorials/',
'gallery_dirs': 'getting-started/tutorials', # 'gallery_dirs': 'getting-started/tutorials',
'filename_pattern': '', # 'filename_pattern': '',
'ignore_pattern': r'__init__\.py', # 'ignore_pattern': r'__init__\.py',
'within_subsection_order': FileNameSortKey, # 'within_subsection_order': FileNameSortKey,
'reference_url': { # 'reference_url': {
'sphinx_gallery': None, # 'sphinx_gallery': None,
} # }
} # }
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']
html_sidebars = {
'**': [
'_templates/versions.html',
],
}
# The suffix(es) of source filenames. # The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string: # You can specify multiple suffix as a list of string: