Skip to content

Commit

Permalink
feat(docs): enable docs preview
Browse files Browse the repository at this point in the history
  • Loading branch information
HsiangNianian committed Feb 28, 2024
1 parent 357db22 commit 67a4e90
Show file tree
Hide file tree
Showing 26 changed files with 357 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.10"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf
- epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ license = "MIT"
documentation = "https://docs.hydroroll.team/"
homepage = "https://hydroroll.team/"
repository = "https://github.com/HydroRoll-Team/HydroRoll"
authors = ["HsiangNianian <i@jyunko.c"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
Expand Down
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
:width: 60
:align: right

.. start-index
跨平台、多模态、高度自定义的骰系开发框架
==================================

Expand All @@ -26,6 +28,8 @@
- 🎢 渐进式学习框架,从编写简单的 nivis reply脚本,到编写满足小需求的 lua、python脚本,再到成为世界主编写自己的规则包模块,甚至训练水系模型,层层递进,轻松学习。
- 🔓 更多特性等你发掘!

.. end-index
安装与使用
-----

Expand Down
26 changes: 26 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -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 = .
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)
Binary file added docs/_static/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
furo>=2023.3.27
sphinx-autobuild>=2021.3.14
myst-parser>=0.18.1
sphinx>=5.3.0
tomli
sphinx_design
sphinx-intl>=2.1.0
13 changes: 13 additions & 0 deletions docs/source/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--
Version codenames style:
date "+## %Y.%m.%d -- {adjective} {colorname}" | pbcopy
https://patternbasedwriting.com/elementary_writing_success/list-4800-adjectives/
https://en.wikipedia.org/wiki/Lists_of_colors
-->

```{include} ../../CHANGELOG.md
```
97 changes: 97 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# 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 infini
import os, sys

if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib

DATA = None
PYPROJECT = os.path.join("..", "..", "Cargo.toml")
with open(PYPROJECT, "r", encoding="utf8") as f:
pyproject = f.read()
DATA = tomllib.loads(pyproject)
PROJECT_VERSION = DATA["package"]["version"]
PROJECT_NAME = DATA["package"]["name"]
AUTHOR_TABLE = DATA["package"]["authors"]
AUTHORS = ",".join([f"{aut}" for aut in AUTHOR_TABLE])

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "HydroRoll" # PROJECT_NAME
release = PROJECT_VERSION # "latest"
copyright = "2023-PRESENT, HydroRoll-Team."
author = AUTHORS # "Hsiang Nianian"

# html_title = "HydroRoll Docs"

# -- 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/HydroRoll/%s", "issue %s"),
"doc": ("https://docs.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://cdn.jsdelivr.net/gh/HydroRoll-Team/HydroRoll@main/docs/_static/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 = {
"announcement": "<em><a href='#'>documentation</a> is still under construction now, welcome any <a href='contributing.html'>contribution</a>!</em>",
"source_repository": "https://github.com/HydroRoll-Team/HydroRoll/",
"source_branch": "main",
"source_directory": "docs/source/",
"footer_icons": [
{
"name": "GitHub",
"url": "https://github.com/HydroRoll-Team/HydroRoll/",
"html": "",
"class": "fa-brands fa-github",
},
{
"name": "Pypi",
"url": "https://pypi.org/project/hydro_roll/",
"html": "",
"class": "fa-brands fa-python",
},
],
}
40 changes: 40 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
hide-toc: true
---

.. include:: ../../README.rst
:start-after: start-index
:end-before: end-index


.. .. toctree::
.. :hidden:
.. :caption: 用户手册
.. 第一步
.. 使用脚手架
.. 更多的配置
.. webui 基础
.. NIVIS 基本语法
.. OneRoll 语法概览
.. webui 进阶
.. 最佳实践
.. .. toctree::
.. :hidden:
.. :caption: 开发手册
.. 成为脚本插件作者
.. 成为规则包作者
.. 成为模型作者
.. API 文档
.. 开发建议
.. .. toctree::
.. :hidden:
.. :caption: Thanks and Credits
.. 社区贡献指南
.. 变更日志
.. 协议
7 changes: 7 additions & 0 deletions docs/source/pages/api/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini
======

.. toctree::
:maxdepth: 4

infini
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.core.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.core module
==================

.. automodule:: infini.core
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.exceptions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.exceptions module
========================

.. automodule:: infini.exceptions
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.generator.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.generator module
=======================

.. automodule:: infini.generator
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.handler.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.handler module
=====================

.. automodule:: infini.handler
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.input.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.input module
===================

.. automodule:: infini.input
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.interceptor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.interceptor module
=========================

.. automodule:: infini.interceptor
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.internal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.internal module
======================

.. automodule:: infini.internal
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.loader.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.loader module
====================

.. automodule:: infini.loader
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.logging.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.logging module
=====================

.. automodule:: infini.logging
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.output.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.output module
====================

.. automodule:: infini.output
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.queue.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.queue module
===================

.. automodule:: infini.queue
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.register.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.register module
======================

.. automodule:: infini.register
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/pages/api/infini.router.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
infini.router module
====================

.. automodule:: infini.router
:members:
:undoc-members:
:show-inheritance:
31 changes: 31 additions & 0 deletions docs/source/pages/api/infini.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
infini package
==============

Submodules
----------

.. toctree::
:maxdepth: 4

infini.core
infini.exceptions
infini.generator
infini.handler
infini.input
infini.interceptor
infini.internal
infini.loader
infini.logging
infini.output
infini.queue
infini.register
infini.router
infini.typing

Module contents
---------------

.. automodule:: infini
:members:
:undoc-members:
:show-inheritance:
Loading

0 comments on commit 67a4e90

Please sign in to comment.