2022-06-17 15:50:40 +00:00
|
|
|
|
# Configuration file for the Sphinx documentation builder.
|
|
|
|
|
#
|
|
|
|
|
# This file only contains a selection of the most common options. For a full
|
|
|
|
|
# list see the documentation:
|
|
|
|
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
|
|
|
|
|
|
|
|
# -- Path setup --------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# If extensions (or modules to document with autodoc) are in another directory,
|
|
|
|
|
# add these directories to sys.path here. If the directory is relative to the
|
|
|
|
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
|
|
|
#
|
2024-07-17 05:54:28 +00:00
|
|
|
|
import os
|
2022-06-17 15:50:40 +00:00
|
|
|
|
# import sys
|
|
|
|
|
# sys.path.insert(0, os.path.abspath('.'))
|
|
|
|
|
|
|
|
|
|
# -- Project information -----------------------------------------------------
|
|
|
|
|
|
|
|
|
|
project = 'DragonOS'
|
2025-05-13 10:59:18 +00:00
|
|
|
|
copyright = '2022-2025, DragonOS Community'
|
2023-03-25 06:51:16 +00:00
|
|
|
|
author = 'longjin'
|
2024-09-25 15:53:23 +00:00
|
|
|
|
github_org = 'DragonOS-Community'
|
|
|
|
|
github_repo = 'DragonOS'
|
2022-06-17 15:50:40 +00:00
|
|
|
|
|
|
|
|
|
# The full version, including alpha/beta/rc tags
|
|
|
|
|
release = 'dev'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# -- General configuration ---------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Add any Sphinx extension module names here, as strings. They can be
|
|
|
|
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
|
|
|
|
# ones.
|
2025-05-13 10:59:18 +00:00
|
|
|
|
extensions = [
|
|
|
|
|
'myst_parser',
|
|
|
|
|
'sphinx_multiversion',
|
|
|
|
|
'sphinxcontrib.mermaid',
|
|
|
|
|
'sphinx.ext.extlinks',
|
|
|
|
|
]
|
2022-06-17 15:50:40 +00:00
|
|
|
|
|
|
|
|
|
# Add any paths that contain templates here, relative to this directory.
|
|
|
|
|
templates_path = ['_templates']
|
|
|
|
|
|
|
|
|
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
|
|
|
# for a list of supported languages.
|
|
|
|
|
#
|
|
|
|
|
# This is also used if you do content translation via gettext catalogs.
|
|
|
|
|
# Usually you set "language" from the command line for these cases.
|
|
|
|
|
language = 'zh_CN'
|
2025-05-20 02:44:28 +00:00
|
|
|
|
locale_dirs = ['locale/'] # path is example but recommended.
|
2022-06-17 15:50:40 +00:00
|
|
|
|
|
|
|
|
|
# List of patterns, relative to source directory, that match files and
|
|
|
|
|
# directories to ignore when looking for source files.
|
|
|
|
|
# This pattern also affects html_static_path and html_extra_path.
|
|
|
|
|
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
|
|
|
|
source_suffix = ['.rst', '.md']
|
|
|
|
|
|
|
|
|
|
# -- Options for HTML output -------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
|
|
|
# a list of builtin themes.
|
|
|
|
|
#
|
|
|
|
|
html_theme = 'sphinx_rtd_theme'
|
|
|
|
|
|
2024-09-25 14:53:31 +00:00
|
|
|
|
html_context = dict()
|
|
|
|
|
|
2022-06-17 15:50:40 +00:00
|
|
|
|
# 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".
|
2022-09-08 07:24:48 +00:00
|
|
|
|
html_static_path = ['_static']
|
|
|
|
|
|
2024-09-24 17:36:57 +00:00
|
|
|
|
html_sidebars = {
|
|
|
|
|
'**': [
|
|
|
|
|
'versioning.html',
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-08 07:24:48 +00:00
|
|
|
|
myst_enable_extensions = [
|
2022-09-16 04:59:13 +00:00
|
|
|
|
"amsmath",
|
|
|
|
|
"colon_fence",
|
|
|
|
|
"deflist",
|
|
|
|
|
"dollarmath",
|
|
|
|
|
"fieldlist",
|
|
|
|
|
"html_admonition",
|
|
|
|
|
"html_image",
|
|
|
|
|
"replacements",
|
|
|
|
|
"smartquotes",
|
|
|
|
|
"strikethrough",
|
|
|
|
|
"substitution",
|
2022-09-08 07:24:48 +00:00
|
|
|
|
"tasklist",
|
2024-07-17 05:54:28 +00:00
|
|
|
|
]
|
|
|
|
|
|
2024-09-24 17:36:57 +00:00
|
|
|
|
# sphinx-multiversion 指定哪个分支为 lastest 版本
|
|
|
|
|
smv_latest_version = 'master'
|
|
|
|
|
smv_released_pattern = r'^tags/.*$' # Tags only
|
|
|
|
|
smv_tag_whitelist = r'^(V.*|v.*)$'
|
|
|
|
|
smv_branch_whitelist = "master"
|
2024-07-17 05:54:28 +00:00
|
|
|
|
|
|
|
|
|
# Define the canonical URL if you are using a custom domain on Read the Docs
|
|
|
|
|
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":
|
2024-09-25 14:53:31 +00:00
|
|
|
|
html_context["READTHEDOCS"] = True
|
|
|
|
|
|
|
|
|
|
if os.environ.get("SPHINX_MULTIVERSION_GIT_COMMIT", "") != "":
|
|
|
|
|
html_context["commit"] = os.environ["SPHINX_MULTIVERSION_GIT_COMMIT"]
|
2024-09-25 15:53:23 +00:00
|
|
|
|
elif os.environ.get("CURRENT_GIT_COMMIT_HASH", "") != "":
|
|
|
|
|
html_context["commit"] = os.environ["CURRENT_GIT_COMMIT_HASH"]
|
2024-09-25 14:53:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 截取前 7 位 commit hash,如果长度不足则不截取
|
|
|
|
|
if "commit" in html_context:
|
|
|
|
|
html_context["commit"] = html_context["commit"][:7]
|
2024-09-25 15:53:23 +00:00
|
|
|
|
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/'
|