From cde8341265e6e266969429e6f1b0168d90206a90 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Tue, 18 Nov 2025 16:53:15 +0800 Subject: refactor: Refactor code structure for improved readability and maintainability --- docs/Makefile | 26 ++++++++++++ docs/_static/logo.png | Bin 0 -> 235361 bytes docs/_static/workspace.png | Bin 0 -> 1720722 bytes docs/requirements.txt | 8 ++++ docs/source/CONTRIBUTING.md | 2 + docs/source/changelog.md | 13 ++++++ docs/source/conf.py | 98 ++++++++++++++++++++++++++++++++++++++++++++ docs/source/index.md | 46 +++++++++++++++++++++ docs/source/license.md | 21 ++++++++++ 9 files changed, 214 insertions(+) create mode 100644 docs/Makefile create mode 100644 docs/_static/logo.png create mode 100644 docs/_static/workspace.png create mode 100644 docs/requirements.txt create mode 100644 docs/source/CONTRIBUTING.md create mode 100644 docs/source/changelog.md create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.md create mode 100644 docs/source/license.md (limited to 'docs') diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..c7af502 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,26 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = ./source +BUILDDIR = _build +SPHINXINTL ?= sphinx-intl +lang ?= zh_CN + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +# update translation command +translate: + @$(SPHINXINTL) update -p ./build/gettext -l $(lang) $(O) \ No newline at end of file diff --git a/docs/_static/logo.png b/docs/_static/logo.png new file mode 100644 index 0000000..8b5a14c Binary files /dev/null and b/docs/_static/logo.png differ diff --git a/docs/_static/workspace.png b/docs/_static/workspace.png new file mode 100644 index 0000000..204dac8 Binary files /dev/null and b/docs/_static/workspace.png differ diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..d276c4d --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,8 @@ +furo>=2023.3.27 +sphinx-autobuild>=2021.3.14 +myst-parser>=0.18.1 +sphinx>=5.3.0 +infini +tomli +sphinx_design +sphinx-intl>=2.1.0 \ No newline at end of file diff --git a/docs/source/CONTRIBUTING.md b/docs/source/CONTRIBUTING.md new file mode 100644 index 0000000..e75758c --- /dev/null +++ b/docs/source/CONTRIBUTING.md @@ -0,0 +1,2 @@ +```{include} ../../CONTRIBUTING.md +``` \ No newline at end of file diff --git a/docs/source/changelog.md b/docs/source/changelog.md new file mode 100644 index 0000000..769b66e --- /dev/null +++ b/docs/source/changelog.md @@ -0,0 +1,13 @@ + + +```{include} ../../CHANGELOG.md +``` \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..14d3ed9 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,98 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +import GRPS +import os, sys + +if sys.version_info >= (3, 11): + import tomllib +else: + import tomli as tomllib + +DATA = None +PYPROJECT = os.path.join("..", "..", "pyproject.toml") +with open(PYPROJECT, "r", encoding="utf8") as f: + pyproject = f.read() + DATA = tomllib.loads(pyproject) +PROJECT_VERSION = DATA["project"]["version"] +PROJECT_NAME = DATA["project"]["name"] +AUTHOR_TABLE = DATA["project"]["authors"] +AUTHORS = ",".join([f"{aut['name']}" for aut in AUTHOR_TABLE]) + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = PROJECT_NAME +release = PROJECT_VERSION +copyright = ( + "2023-PRESENT, HydroRoll-Team." +) +author = AUTHORS + +html_title = "GRPS" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.viewcode", + "sphinx.ext.todo", + "sphinx.ext.napoleon", + "sphinx.ext.autosummary", + "sphinx.ext.extlinks", + "myst_parser", +] + +templates_path = ["_templates"] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] +extlinks = { + "issue": ("https://github.com/HydroRoll-Team/infini/%s", "issue %s"), + "doc": ("https://infini.hydroroll.team/zh-cn/latest/%s", "pages/%s"), +} +source_suffix = { + ".rst": "restructuredtext", + ".txt": "markdown", + ".md": "markdown", +} + +# locale_dirs = ["../locales/"] # path is example but recommended. +gettext_compact = False # optional. +gettext_uuid = True # optional. + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "furo" +html_static_path = ["../_static"] +_html_logo = ( + "https://files.hydroroll.team/hotlink-ok/files/image/logo.png" +) +html_favicon = _html_logo + +html_css_files = [ + "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/fontawesome.min.css", + "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/brands.min.css", +] + +html_theme_options = { + "source_repository": "https://github.com/HydroRoll-Team/GRPS/", + "source_branch": "master", + "source_directory": "docs/source/", + "footer_icons": [ + { + "name": "GitHub", + "url": "https://github.com/HydroRoll-Team/GRPS/", + "html": "", + "class": "fa-brands fa-github", + }, + { + "name": "Pypi", + "url": "https://pypi.org/project/GRPS/", + "html": "", + "class": "fa-brands fa-python", + }, + ], +} diff --git a/docs/source/index.md b/docs/source/index.md new file mode 100644 index 0000000..5c32c61 --- /dev/null +++ b/docs/source/index.md @@ -0,0 +1,46 @@ +--- +hide-toc: true +--- + +# GRPS + +```{include} ../../README.md +:start-after: +:end-before: +``` + +```{toctree} +:hidden: + +简述 +``` + +```{toctree} +:hidden: + +快速开始 +核心模块: core +生成器: generator +处理器: handler +注入模块: injector +拦截器: interceptor +包引用: internal +注册器: register +工作流: workflow +``` + +```{toctree} +:caption: API 接口 +:hidden: + +阅读源码 +``` + +```{toctree} +:caption: 开发手册 +:hidden: + +社区贡献指引 +变更日志 +协议 +``` diff --git a/docs/source/license.md b/docs/source/license.md new file mode 100644 index 0000000..3c74706 --- /dev/null +++ b/docs/source/license.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 HydroRoll-Team & Noctisynth, org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. -- cgit v1.2.3-70-g09d2