Add selection of Manual version
This commit is contained in:
@ -138,10 +138,6 @@
|
|||||||
{% if READTHEDOCS and current_version %}
|
{% if READTHEDOCS and current_version %}
|
||||||
{%- set nav_version = current_version %}
|
{%- set nav_version = current_version %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if nav_version %}
|
|
||||||
<div class="lammps_version">Version: <b>{{ nav_version }}</b></div>
|
|
||||||
<div class="lammps_release">git info: {{ release }}</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% include "searchbox.html" %}
|
{% include "searchbox.html" %}
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
{% if READTHEDOCS %}
|
{% if READTHEDOCS or display_manual_versions %}
|
||||||
{# Add rst-badge after rst-versions for small badge style. #}
|
{# Add rst-badge after rst-versions for small badge style. #}
|
||||||
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
|
<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="rst-current-version" data-toggle="rst-current-version">
|
||||||
<span class="fa fa-book"> Read the Docs</span>
|
<span class="fa fa-book"> Version</span>
|
||||||
v: {{ current_version }}
|
{{ current_version }}
|
||||||
<span class="fa fa-caret-down"></span>
|
<span class="fa fa-caret-down"></span>
|
||||||
</span>
|
</span>
|
||||||
<div class="rst-other-versions">
|
<div class="rst-other-versions">
|
||||||
@ -20,14 +20,8 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
{# Translators: The phrase "Read the Docs" is not translated #}
|
<dt>Git Info</dt>
|
||||||
<dt>{{ _('On Read the Docs') }}</dt>
|
<dd><a href="https://github.com/lammps/lammps/tree/{{ git_commit }}" target="_blank">{{ release }}</a></dd>
|
||||||
<dd>
|
|
||||||
<a href="//{{ PRODUCTION_DOMAIN }}/projects/{{ slug }}/?fromdocs={{ slug }}">{{ _('Project Home') }}</a>
|
|
||||||
</dd>
|
|
||||||
<dd>
|
|
||||||
<a href="//{{ PRODUCTION_DOMAIN }}/builds/{{ slug }}/?fromdocs={{ slug }}">{{ _('Builds') }}</a>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -99,6 +99,16 @@ def get_git_info():
|
|||||||
pass
|
pass
|
||||||
return git_n_date
|
return git_n_date
|
||||||
|
|
||||||
|
def get_git_commit():
|
||||||
|
import subprocess,time
|
||||||
|
try:
|
||||||
|
commit = subprocess.run(['git','rev-parse','HEAD'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
||||||
|
if commit.returncode == 0:
|
||||||
|
return commit.stdout.decode()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return ''
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
# built documents.
|
# built documents.
|
||||||
@ -108,6 +118,8 @@ version = get_lammps_version()
|
|||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = get_git_info()
|
release = get_git_info()
|
||||||
|
|
||||||
|
git_commit = get_git_commit()
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
#language = None
|
#language = None
|
||||||
@ -389,3 +401,18 @@ breathe_domain_by_extension = { 'h' : 'cpp',
|
|||||||
'cpp' : 'cpp',
|
'cpp' : 'cpp',
|
||||||
'c' : 'c',
|
'c' : 'c',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# allows showing multiple versions
|
||||||
|
try:
|
||||||
|
html_context
|
||||||
|
except NameError:
|
||||||
|
html_context = dict()
|
||||||
|
|
||||||
|
html_context['display_manual_versions'] = True
|
||||||
|
html_context['current_version'] = version
|
||||||
|
html_context['git_commit'] = git_commit
|
||||||
|
html_context['versions'] = [
|
||||||
|
('latest', 'https://docs.lammps.org/'),
|
||||||
|
('8 Apr 2021', 'https://lammps.sandia.gov/doc/')
|
||||||
|
]
|
||||||
|
html_context['downloads'] = [('PDF', 'Manual.pdf')]
|
||||||
|
|||||||
Reference in New Issue
Block a user