Add selection of Manual version
This commit is contained in:
@ -99,6 +99,16 @@ def get_git_info():
|
||||
pass
|
||||
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
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
@ -108,6 +118,8 @@ version = get_lammps_version()
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = get_git_info()
|
||||
|
||||
git_commit = get_git_commit()
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
@ -389,3 +401,18 @@ breathe_domain_by_extension = { 'h' : 'cpp',
|
||||
'cpp' : 'cpp',
|
||||
'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