mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-08 14:16:47 +00:00
doc: add commit revision to footer while build with sphinx-multiversion (#939)
Signed-off-by: longjin <longjin@DragonOS.org>
This commit is contained in:
parent
013ffb708f
commit
09dacded09
13
docs/conf.py
13
docs/conf.py
@ -54,6 +54,8 @@ source_suffix = ['.rst', '.md']
|
||||
#
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
|
||||
html_context = dict()
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
@ -91,4 +93,13 @@ html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
|
||||
|
||||
# Tell Jinja2 templates the build is running on Read the Docs
|
||||
if os.environ.get("READTHEDOCS", "") == "True":
|
||||
html_context["READTHEDOCS"] = True
|
||||
html_context["READTHEDOCS"] = True
|
||||
|
||||
if os.environ.get("SPHINX_MULTIVERSION_GIT_COMMIT", "") != "":
|
||||
html_context["commit"] = os.environ["SPHINX_MULTIVERSION_GIT_COMMIT"]
|
||||
|
||||
|
||||
|
||||
# 截取前 7 位 commit hash,如果长度不足则不截取
|
||||
if "commit" in html_context:
|
||||
html_context["commit"] = html_context["commit"][:7]
|
||||
|
@ -1,4 +1,4 @@
|
||||
sphinx==5.0.2
|
||||
myst-parser==0.18.0
|
||||
sphinx-rtd-theme
|
||||
sphinx-multiversion==0.2.4
|
||||
git+https://git.mirrors.dragonos.org.cn/DragonOS-Community/sphinx-multiversion.git@5858b75#egg=sphinx-multiversion
|
||||
|
Loading…
x
Reference in New Issue
Block a user