docs: implement versioning system and enhance documentation structure

This commit is contained in:
ob-yalian
2026-04-24 15:48:54 +08:00
parent a487e67e1c
commit 91e1a978e8
14 changed files with 845 additions and 45 deletions
+20 -4
View File
@@ -24,6 +24,15 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '..', '_ext'))
import recommonmark
from recommonmark.transform import AutoStructify
from versioning import (
build_version_context,
get_asset_path,
get_conf_root,
get_content_root,
get_extra_paths,
get_static_paths,
get_templates_paths,
)
# import sphinx_book_theme
# import sphinx_rtd_theme
@@ -35,6 +44,9 @@ from recommonmark.transform import AutoStructify
html_theme = 'sphinx_rtd_theme'
# html_theme = "furo"
content_root = get_content_root(__file__)
conf_root = get_conf_root(__file__)
# -- Project information -----------------------------------------------------
project = 'OrbbecSDK V2 ROS2 Wrapper'
@@ -57,6 +69,7 @@ extensions = ['recommonmark',
'sphinx_copybutton',
'sphinx.ext.autosectionlabel',
'language_switch',
'version_switch',
'section_search',
# 'myst_parser',
]
@@ -67,7 +80,7 @@ source_suffix = ['.rst', 'rest', '.md', '.MD']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = get_templates_paths(conf_root)
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -89,16 +102,16 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# html_favicon = "source/_static/orbbec_logo2.png"
#html_logo = "source/_static/orbbec-light_no_colour.svg"
html_favicon = "source/_static/orbbec_footerlogo_3d_world.svg"
html_favicon = get_asset_path(conf_root, "source/_static/orbbec_footerlogo_3d_world.svg", "source/_static/orbbec_footerlogo_3d_world.svg")
# html_logo = "source/_static/orbbec_footerlogo_3d_world.svg"
# html_favicon = "source/_static/orbbec_footerlogo_3d_world.svg"
# 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".
html_static_path = ['source/_static','source/image']
html_static_path = get_static_paths(conf_root, content_root)
html_extra_path = ['source/image']
html_extra_path = get_extra_paths(content_root)
html_theme_options = {
# 'analytics_id': 'G-EVD5Z6G6NH',
@@ -137,6 +150,9 @@ html_theme_options = {
# #不需要添加_static目录,加了会不起作用
html_css_files = ["custom.css"]
html_context = {
"docs_versioning": build_version_context(language),
}
# 与文档无关的其他资源的路径,由于无需构建此文件夹的文件,会自动忽略
# 默认情况下,此路径下的文件会输出到生成的html的根目录