mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-08 14:16:47 +00:00
doc: 添加在github上编辑的按钮,以及扩展footer (#940)
Signed-off-by: longjin <longjin@DragonOS.org>
This commit is contained in:
parent
09dacded09
commit
920bda5958
@ -8,6 +8,20 @@ SPHINXBUILD ?= sphinx-build
|
|||||||
SOURCEDIR = .
|
SOURCEDIR = .
|
||||||
BUILDDIR = _build
|
BUILDDIR = _build
|
||||||
|
|
||||||
|
LANGUAGE = zh_CN
|
||||||
|
|
||||||
|
SPHINXOPTS += -D language=$(LANGUAGE)
|
||||||
|
|
||||||
|
export CURRENT_GIT_COMMIT_HASH := $(shell git rev-parse --short HEAD)
|
||||||
|
|
||||||
|
GIT_STATUS := $(shell git status --porcelain --untracked-files=no)
|
||||||
|
|
||||||
|
ifeq ($(strip $(GIT_STATUS)),)
|
||||||
|
export CURRENT_GIT_COMMIT_DIRTY = 0
|
||||||
|
else
|
||||||
|
export CURRENT_GIT_COMMIT_DIRTY = 1
|
||||||
|
endif
|
||||||
|
|
||||||
# Put it first so that "make" without argument is like "make help".
|
# Put it first so that "make" without argument is like "make help".
|
||||||
help:
|
help:
|
||||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
@ -21,4 +35,4 @@ help:
|
|||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
html-multiversion:
|
html-multiversion:
|
||||||
rm -rf ./$(BUILDDIR) && sphinx-multiversion "$(SOURCEDIR)" ./$(BUILDDIR)/html && cp -rf ./$(BUILDDIR)/html/master/* ./$(BUILDDIR)/html/
|
rm -rf ./$(BUILDDIR) && CURRENT_GIT_COMMIT_DIRTY=0 sphinx-multiversion $(SPHINXOPTS) "$(SOURCEDIR)" ./$(BUILDDIR)/html && cp -rf ./$(BUILDDIR)/html/master/* ./$(BUILDDIR)/html/
|
||||||
|
8
docs/_templates/footer.html
vendored
Normal file
8
docs/_templates/footer.html
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{% extends "!footer.html" %}
|
||||||
|
|
||||||
|
{% block extrafooter %}
|
||||||
|
<div>
|
||||||
|
<br>
|
||||||
|
官网 <a href="https://dragonos.org">https://dragonos.org</a> | 论坛 <a href="https://bbs.dragonos.org.cn">https://bbs.dragonos.org.cn</a> | <a href="https://dragonos.org">赞助DragonOS,成就未来!</a>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
15
docs/conf.py
15
docs/conf.py
@ -19,6 +19,8 @@ import os
|
|||||||
project = 'DragonOS'
|
project = 'DragonOS'
|
||||||
copyright = '2022-2024, DragonOS Community'
|
copyright = '2022-2024, DragonOS Community'
|
||||||
author = 'longjin'
|
author = 'longjin'
|
||||||
|
github_org = 'DragonOS-Community'
|
||||||
|
github_repo = 'DragonOS'
|
||||||
|
|
||||||
# The full version, including alpha/beta/rc tags
|
# The full version, including alpha/beta/rc tags
|
||||||
release = 'dev'
|
release = 'dev'
|
||||||
@ -97,9 +99,20 @@ if os.environ.get("READTHEDOCS", "") == "True":
|
|||||||
|
|
||||||
if os.environ.get("SPHINX_MULTIVERSION_GIT_COMMIT", "") != "":
|
if os.environ.get("SPHINX_MULTIVERSION_GIT_COMMIT", "") != "":
|
||||||
html_context["commit"] = os.environ["SPHINX_MULTIVERSION_GIT_COMMIT"]
|
html_context["commit"] = os.environ["SPHINX_MULTIVERSION_GIT_COMMIT"]
|
||||||
|
elif os.environ.get("CURRENT_GIT_COMMIT_HASH", "") != "":
|
||||||
|
html_context["commit"] = os.environ["CURRENT_GIT_COMMIT_HASH"]
|
||||||
|
|
||||||
|
|
||||||
# 截取前 7 位 commit hash,如果长度不足则不截取
|
# 截取前 7 位 commit hash,如果长度不足则不截取
|
||||||
if "commit" in html_context:
|
if "commit" in html_context:
|
||||||
html_context["commit"] = html_context["commit"][:7]
|
html_context["commit"] = html_context["commit"][:7]
|
||||||
|
if os.environ.get("CURRENT_GIT_COMMIT_DIRTY", "") == "1":
|
||||||
|
html_context["commit"] += "-dirty"
|
||||||
|
|
||||||
|
|
||||||
|
# -- Set GitHub URL for Edit on GitHub links ---
|
||||||
|
html_context['display_github'] = True
|
||||||
|
html_context['github_user'] = github_org
|
||||||
|
html_context['github_repo'] = github_repo
|
||||||
|
html_context['github_version'] = html_context['commit'] if 'commit' in html_context else 'master'
|
||||||
|
html_context['conf_py_path'] = '/docs/'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user