docs(feat): finish documentation

Go also https://docs.staringplanet.top/primitive-type later to see the
docs later.
This commit is contained in:
2026-02-10 12:55:16 +08:00
parent 6dc9bafc3f
commit 7aa947fce0
16 changed files with 885 additions and 3 deletions

20
docs/Makefile Normal file
View File

@@ -0,0 +1,20 @@
# 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
# 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)

35
docs/make.bat Normal file
View File

@@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

11
docs/serve_docs.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
LANG_CODE=$1
if [ -n "$LANG_CODE" ]; then
echo "Starting docs preview for language: $LANG_CODE..."
sphinx-autobuild -D language="$LANG_CODE" --port 8000 source/ "build/html_$LANG_CODE/"
else
echo "Starting docs preview in English (en_US)..."
sphinx-autobuild --port 8000 source/ build/html/
fi

49
docs/source/api.rst Normal file
View File

@@ -0,0 +1,49 @@
Code References
===============
Read this page to know how to use primitive-type library.
At present, all methods, type aliases could be imported from path ``primitive_type`` immediately.
Type Aliases
------------
.. automodule:: primitive_type.types
.. note::
Real API path: ``primitive_type.types``
.. currentmodule:: primitive_type.types
.. autotype:: Primitive
.. autotype:: PrimitiveMap
Type Checker
------------
.. automodule:: primitive_type.checker
.. note::
Real API path: ``primitive_type.checker``
.. currentmodule:: primitive_type.checker
.. autofunction:: is_primitive
.. autofunction:: is_nested_dict
Type Converter
--------------
.. automodule:: primitive_type.converter
.. note::
Real API path: ``primitive_type.converter``
.. currentmodule:: primitive_type.converter
.. autoclass:: ConvertError
.. autofunction:: get_primitive_object

140
docs/source/conf.py Normal file
View File

@@ -0,0 +1,140 @@
# 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 Python modules ---------------------------------------------------
import datetime
import os
import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from sphinx.application import Sphinx
sys.path.insert(0, os.path.abspath(os.path.join("..", "..")))
import primitive_type
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = "primitive-type"
copyright = f"{datetime.datetime.now().year}, CleMooling"
author = "CleMooling"
release = primitive_type.__version__
# -- General configuration ---------------------------------------------------
# https://docs.readthedocs.com/platform/stable/reference/environment-variables.html#envvar-READTHEDOCS
RTD: bool = os.environ.get("READTHEDOCS", "").lower() == "true"
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosectionlabel",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx_copybutton",
"sphinx_prompt",
"sphinxcontrib.jquery",
"sphinx_inline_tabs",
"sphinxcontrib.mermaid",
"sphinx_design",
"sphinxcontrib.asciinema",
]
source_suffix = [".rst"]
templates_path = ["_templates"]
exclude_patterns = ["build", "Thumbs.db", ".DS_Store"]
# def setup(app: 'Sphinx'):
# from typing import List
# from sphinx_prompt import PromptDirective
# class PromptWithVersion(PromptDirective):
# content: List[str]
# def run(self):
# self.assert_has_content()
# for i in range(len(self.content)):
# self.content[i] = self.content[i].replace('@@VERSION@@', release)
# return super().run()
# app.add_directive('prompt-version', PromptWithVersion)
# autodoc_setup(app)
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = "sphinx_rtd_theme"
html_static_path = ["../static"]
html_search_language = "en"
html_css_files = [
# Save the table width
# override wide tables in RTD theme
# https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html
"css/theme_overrides.css",
# Tweak styles of the sphinx_inline_tabs extension
"css/codeblock_tab.css",
# Tweak styles of the readthedocs addons
# https://docs.readthedocs.io/en/stable/addons.html
"css/rtd_addon.css",
]
html_js_files = [
("https://cdn.jsdelivr.net/npm/@docsearch/js@3", {"defer": "defer"}),
("js/readthedoc-flyout.js", {"defer": "defer"}),
]
# Show a deeper toctree in the sidebar
# https://stackoverflow.com/questions/27669376/show-entire-toctree-in-read-the-docs-sidebar
html_theme_options = {
"navigation_depth": 6,
"logo_only": True,
}
# html_logo = ''
# -- Options for sphinx-intl -------------------------------------------------
# available languages: en_US, zh_CN
language: str = os.environ.get("READTHEDOCS_LANGUAGE", "en_US")
# po files will be created in this directory
# path is example but recommended.
locale_dirs = ["locales"]
gettext_compact = False # optional
# -- Options for sphinx.ext.autodoc -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
autodoc_member_order = "bysource"
autodoc_inherit_docstrings = False # so overridden methods won't pop up
add_module_names = False
# -- Options for sphinx.ext.autosectionlabel -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/autosectionlabel.html
autosectionlabel_prefix_document = True
# -- Options for sphinx.ext.intersphinx -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html
intersphinx_mapping = {
# curl https://docs.python.org/3/objects.inv -o python3-objects.inv
"python": (
"https://docs.python.org/3",
None if RTD else (None, "./python3-objects.inv"),
), # always fetch from internet in rtd env
}
# disable all auto external document references
# implicit ref for general std domain is bad
intersphinx_disabled_reftypes = ["std:*"]
intersphinx_timeout = 30
def autodoc_setup(app: "Sphinx"):
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#event-autodoc-skip-member
def autodoc_skip_member_handler(app_, what, name, obj, skip, options):
return skip
app.connect("autodoc-skip-member", autodoc_skip_member_handler)

80
docs/source/dev.rst Normal file
View File

@@ -0,0 +1,80 @@
Develop
=======
If you would like to participate in the development of this project or create your own fork, you can read this page to learn how to use `uv <https://docs.astral.sh/uv>`__ to manage the development environment.
Download the code
-----------------
The source code is mainly storaged at a self hosted `Gitea <https://about.gitea.com>`__ server `<https://gitfub.cv>`__ .
.. note::
Repo is not in GitHub!
Clone the code to your local develop environment by the command:
.. code-block:: shell
git clone https://gitfub.cv/CleMooling/primitive-type.git
Or if SSH configured fine:
.. code-block:: shell
git clone git@gitfub.cv:CleMooling/primitive-type.git
Sync the uv environment
-----------------------
If you just want to do tests, use:
.. code-block:: shell
uv sync
Then, activate the virtual environment managed by uv:
.. code-block:: shell
source .venv/bin/<activate_script>
.. note::
If you are using `bash <https://www.gnu.org/software/bash>`__ , the script is named ``activate``;
If you are using `fish <https://fishshell.com>`__ , the script is named ``activate.fish``;
If you are using `zsh <https://www.zsh.org>`__ , the script is named ``activate.zsh``.
Now you can do any test you like.
If you want to run the tests built-in, execute:
.. code-block:: shell
python -m unittest discover tests
or:
.. code-block:: shell
uv run python -m unittest discover tests
if outside the uv environment.
If you want to actually participate in the development of this project or fork yourself and develop, you should run:
.. code-block:: shell
uv sync --all-groups
It will sync all needed python packages, including packages that are being used to build the docs.
Then you can edit anything.
Finally
-------
Thanks for reading this documentation! I'll keep updating it to ensure the correctness.

29
docs/source/index.rst Normal file
View File

@@ -0,0 +1,29 @@
.. primitive-type documentation master file, created by
sphinx-quickstart on Tue Feb 10 10:03:15 2026.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
primitive-type documentation
============================
Here is the documentation of primitive-type.
primitive-type is a Python library, you can check a value or object if the type of it is primitive, or convert it to other primitive type.
See the `Code References <api.html>`__ for more details.
.. toctree::
:maxdepth: 2
:caption: Home
Code References<api.rst>
Develop<dev.rst>
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@@ -0,0 +1,192 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2026, CleMooling
# This file is distributed under the same license as the primitive-type
# package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: primitive-type \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-10 11:37+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: zh_CN\n"
"Language-Team: zh_CN <LL@li.org>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.18.0\n"
#: ../../source/api.rst:3
msgid "Code References"
msgstr "代码参考"
#: ../../source/api.rst:5
msgid "Read this page to know how to use primitive-type library."
msgstr "阅读此页面以了解如何使用 primitive-type 库。"
#: ../../source/api.rst:7
msgid ""
"At present, all methods, type aliases could be imported from path "
"``primitive_type`` immediately."
msgstr "目前,所有的方法、类型别名都可以从路径 ``primitive_type`` 直接导入。"
#: ../../source/api.rst:10
msgid "Type Aliases"
msgstr "类型别名"
#: of primitive_type.types:1
msgid "Type aliases for primitive types."
msgstr "原始类型的类型别名。"
#: ../../source/api.rst:16
msgid "Real API path: ``primitive_type.types``"
msgstr "实际 API 路径:``primitive_type.types``"
#: of primitive_type.types.Primitive:1
msgid "Type alias for primitive values."
msgstr "原始值的类型别名。"
#: of primitive_type.types.Primitive:3
msgid ""
"Including: :class:`str`, :class:`int`, :class:`float`, :class:`bool`, and"
" :obj:`None`."
msgstr "包括::class:`str`, :class:`int`, :class:`float`, :class:`bool`, and :obj:`None`."
#: of primitive_type.types.PrimitiveMap:1
msgid "Type alias for a mapping of string keys to primitive values."
msgstr "字符串键到原始值的映射的类型别名。"
#: of primitive_type.types.PrimitiveMap:3
msgid ""
"This dictionary represents a collection of metadata or attributes where "
"each value is guaranteed to be a :data:`Primitive` type, ensuring type "
"safety and ease of serialization."
msgstr "此字典表示元数据或属性的集合,其中每个值都保证为 :data:`Primitive` 类型,从而确保类型安全并易于序列化。"
#: ../../source/api.rst:24
msgid "Type Checker"
msgstr "类型检查"
#: of primitive_type.checker:1
msgid "Utils for checking objects."
msgstr "检查对象的一些工具。"
#: ../../source/api.rst:30
msgid "Real API path: ``primitive_type.checker``"
msgstr "实际 API 路径:``primitive_type.checker``"
#: of primitive_type.checker.is_primitive:1
msgid "Check an object if it's a primitive object."
msgstr "检查一个对象是不是一个原始对象。"
#: ../../source/api.rst
msgid "Parameters"
msgstr "参数"
#: of primitive_type.checker.is_primitive:3
msgid "Any instance for checking."
msgstr "任何要检查的实例。"
#: ../../source/api.rst
msgid "Returns"
msgstr "返回"
#: of primitive_type.checker.is_primitive:5
msgid "* :obj:`True` -- If the object is primitive * :obj:`False` -- Otherwise."
msgstr "* :obj:`True` -- 如果这个对象是原始的。 * :obj:`False` -- 反之。"
#: of primitive_type.checker.is_primitive:6
msgid ":obj:`True` -- If the object is primitive"
msgstr ":obj:`True` -- 如果这个对象是原始的。"
#: of primitive_type.checker.is_nested_dict:7
#: primitive_type.checker.is_primitive:7
msgid ":obj:`False` -- Otherwise."
msgstr ":obj:`False` -- 反之。"
#: of primitive_type.checker.is_nested_dict:1
msgid "Check a dict if it has nested structures."
msgstr "检查一个字典是否含有嵌套结构。"
#: of primitive_type.checker.is_nested_dict:3
msgid "Any dict object for checking."
msgstr "任何要检查的字典对象。"
#: of primitive_type.checker.is_nested_dict:5
msgid ""
"* :obj:`True` -- If the dict has nested structures. * :obj:`False` -- "
"Otherwise."
msgstr "* :obj:`True` -- 如果这个字典含有嵌套结构。 * :obj:`False` -- 反之。"
#: of primitive_type.checker.is_nested_dict:6
msgid ":obj:`True` -- If the dict has nested structures."
msgstr ":obj:`True` -- 如果这个字典含有嵌套结构。"
#: ../../source/api.rst:38
msgid "Type Converter"
msgstr "类型转换"
#: of primitive_type.converter:1
msgid "A quick and simple converter to convert the type of an object."
msgstr "一个快速简单的类型转换器,可用于转换单个对象的类型。"
#: ../../source/api.rst:44
msgid "Real API path: ``primitive_type.converter``"
msgstr "实际 API 路径:``primitive_type.converter``"
#: of primitive_type.converter.ConvertError:1
msgid "An exception should happens when conversion failed."
msgstr "一个应在类型转换失败时被抛出的错误。"
#: of primitive_type.converter.get_primitive_object:1
msgid "Get a primitive object from a given value."
msgstr "从给定的一个值中获取一个原始对象。"
#: of primitive_type.converter.get_primitive_object:3
msgid "The given value wants to be converted."
msgstr "需要被转换(类型)的给定对象。"
#: of primitive_type.converter.get_primitive_object:4
msgid ""
"The target type of object that finally converted out. Default to "
":obj:`None` as disabled."
msgstr "对象最终要转换出的目标类型。默认为 :obj:`None` 以禁用(即自动推断)。"
#: of primitive_type.converter.get_primitive_object:6
msgid ""
"* :class:`str` -- If given value is a normal string, or convert to if "
"type specified. * :class:`int` -- The origin object or convert to. * "
":class:`float` -- The origin object or convert to. * :class:`bool` -- The"
" origin object or convert to. * :obj:`None` -- Only when given value is "
":obj:`None`."
msgstr "* :class:`str` -- 如果给定的值是一个普通字符串,或者指定了转换类型。 * :class:`int` -- 原始的或转换出的对象。 * :class:`float` -- 原始的或转换出的对象。 * :class:`bool` -- 原始的或转换出的对象。 * :obj:`None` -- 仅在给定的对象为 :obj:`None` 时。"
#: of primitive_type.converter.get_primitive_object:7
msgid ""
":class:`str` -- If given value is a normal string, or convert to if type "
"specified."
msgstr ":class:`str` -- 如果给定的值是一个普通字符串,或者指定了转换类型。"
#: of primitive_type.converter.get_primitive_object:8
msgid ":class:`int` -- The origin object or convert to."
msgstr ":class:`int` -- 原始的或转换出的对象。"
#: of primitive_type.converter.get_primitive_object:9
msgid ":class:`float` -- The origin object or convert to."
msgstr ":class:`float` -- 原始的或转换出的对象。"
#: of primitive_type.converter.get_primitive_object:10
msgid ":class:`bool` -- The origin object or convert to."
msgstr ":class:`bool` -- 原始的或转换出的对象。"
#: of primitive_type.converter.get_primitive_object:11
msgid ":obj:`None` -- Only when given value is :obj:`None`."
msgstr ":obj:`None` -- 仅在给定的对象为 :obj:`None` 时。"
#~ msgid "Entrypoint of this package."
#~ msgstr ""

View File

@@ -0,0 +1,127 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2026, CleMooling
# This file is distributed under the same license as the primitive-type
# package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: primitive-type \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-10 12:30+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: zh_CN\n"
"Language-Team: zh_CN <LL@li.org>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.18.0\n"
#: ../../source/dev.rst:3
msgid "Develop"
msgstr "开发"
#: ../../source/dev.rst:5
msgid ""
"If you would like to participate in the development of this project or "
"create your own fork, you can read this page to learn how to use `uv "
"<https://docs.astral.sh/uv>`__ to manage the development environment."
msgstr "如果你想要参与这个项目的开发,或是创建你自己的分支,你可以阅读此页以学习如何使用 `uv <https://docs.astral.sh/uv>`__ 来管理开发环境。"
#: ../../source/dev.rst:8
msgid "Download the code"
msgstr "下载代码"
#: ../../source/dev.rst:10
msgid ""
"The source code is mainly storaged at a self hosted `Gitea "
"<https://about.gitea.com>`__ server `<https://gitfub.cv>`__ ."
msgstr "源代码主要存储在一个自建的 `Gitea <https://about.gitea.com>`__ 服务器 `<https://gitfub.cv>`__ 。"
#: ../../source/dev.rst:14
msgid "Repo is not in GitHub!"
msgstr "(源码)仓库不在 GitHub"
#: ../../source/dev.rst:16
msgid "Clone the code to your local develop environment by the command:"
msgstr "使用这个命令,复制代码到你的本地开发环境中:"
#: ../../source/dev.rst:22
msgid "Or if SSH configured fine:"
msgstr "或者用 SSH 如果已配置好:"
#: ../../source/dev.rst:29
msgid "Sync the uv environment"
msgstr "同步 uv 环境"
#: ../../source/dev.rst:31
msgid "If you just want to do tests, use:"
msgstr "如果你只是想进行测试,使用:"
#: ../../source/dev.rst:37
msgid "Then, activate the virtual environment managed by uv:"
msgstr "然后,激活 uv 管理的虚拟环境:"
#: ../../source/dev.rst:45
msgid ""
"If you are using `bash <https://www.gnu.org/software/bash>`__ , the "
"script is named ``activate``;"
msgstr "如果你使用 `bash <https://www.gnu.org/software/bash>`__ 则脚本activate_script名为 ``activate``。"
#: ../../source/dev.rst:47
msgid ""
"If you are using `fish <https://fishshell.com>`__ , the script is named "
"``activate.fish``;"
msgstr "如果你使用 `fish <https://fishshell.com>`__ 则脚本activate_script名为 ``activate.fish``。"
#: ../../source/dev.rst:49
msgid ""
"If you are using `zsh <https://www.zsh.org>`__ , the script is named "
"``activate.zsh``."
msgstr "如果你使用 `zsh <https://www.zsh.org>`__ 则脚本activate_script名为 ``activate.zsh``。"
#: ../../source/dev.rst:51
msgid "Now you can do any test you like."
msgstr "现在你可以执行任何你想要的测试了。"
#: ../../source/dev.rst:53
msgid "If you want to run the tests built-in, execute:"
msgstr "如果你想运行内置的测试,执行:"
#: ../../source/dev.rst:59
msgid "or:"
msgstr "或者:"
#: ../../source/dev.rst:65
msgid "if outside the uv environment."
msgstr "如果在 uv 环境之外。"
#: ../../source/dev.rst:67
msgid ""
"If you want to actually participate in the development of this project or"
" fork yourself and develop, you should run:"
msgstr "如果你想实际参与这个项目的开发或自行分支,你应该运行:"
#: ../../source/dev.rst:73
msgid ""
"It will sync all needed python packages, including packages that are "
"being used to build the docs."
msgstr "这将同步所有 Python 包,包括构建文档要用到的包。"
#: ../../source/dev.rst:75
msgid "Then you can edit anything."
msgstr "然后你可以开始随意编辑(代码)。"
#: ../../source/dev.rst:78
msgid "Finally"
msgstr "结语"
#: ../../source/dev.rst:80
msgid ""
"Thanks for reading this documentation! I'll keep updating it to ensure "
"the correctness."
msgstr "感谢阅读这些文档!我会持续更新以确保准确性。"

View File

@@ -0,0 +1,79 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2026, CleMooling
# This file is distributed under the same license as the primitive-type
# package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: primitive-type \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-10 12:30+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: zh_CN\n"
"Language-Team: zh_CN <LL@li.org>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.18.0\n"
#: ../../source/index.rst:16
msgid "Code References"
msgstr "代码参考"
#: ../../source/index.rst:16
msgid "Develop"
msgstr "开发"
#: ../../source/index.rst:16
msgid "Home"
msgstr "主页"
#: ../../source/index.rst:7
msgid "primitive-type documentation"
msgstr "primitive-type 文档"
#: ../../source/index.rst:9
msgid "Here is the documentation of primitive-type."
msgstr "这里是 primitive-type 的文档。"
#: ../../source/index.rst:11
msgid ""
"primitive-type is a Python library, you can check a value or object if "
"the type of it is primitive, or convert it to other primitive type."
msgstr "primitive-type 是一个 Python 库,你可以用来检查一个值或者对象是不是原始类型,或将其转换为其他原始类型。"
#: ../../source/index.rst:13
msgid "See the `Code References <api.html>`__ for more details."
msgstr "查看 `代码参考 <api.html>`__ 以获取更多详情。"
#: ../../source/index.rst:24
msgid "Indices and tables"
msgstr "目录和索引"
#: ../../source/index.rst:26
msgid ":ref:`genindex`"
msgstr ""
#: ../../source/index.rst:27
msgid ":ref:`modindex`"
msgstr ""
#: ../../source/index.rst:28
msgid ":ref:`search`"
msgstr ""
#~ msgid "Contents:"
#~ msgstr ""
#~ msgid ""
#~ "Add your content using ``reStructuredText``"
#~ " syntax. See the `reStructuredText "
#~ "<https://www.sphinx-"
#~ "doc.org/en/master/usage/restructuredtext/index.html>`_ "
#~ "documentation for details."
#~ msgstr ""

17
docs/static/css/codeblock_tab.css vendored Normal file
View File

@@ -0,0 +1,17 @@
/* tweak tab size */
:root {
--tabs--padding-x: 1em;
}
.tab-set > label {
padding: 0.3em var(--tabs--padding-x) 0.3em;
}
/* remove duplicated border line */
.tab-content {
box-shadow: none;
}
/* make the tab text unselectable */
.tab-label {
user-select: none;
}

4
docs/static/css/rtd_addon.css vendored Normal file
View File

@@ -0,0 +1,4 @@
/* Remove the ugly switch menu */
.wy-side-nav-search > div.switch-menus {
display: none;
}

65
docs/static/css/theme_overrides.css vendored Normal file
View File

@@ -0,0 +1,65 @@
/* override table width restrictions */
@media screen and (min-width: 767px) {
.wy-table-responsive table td,
.wy-table-responsive table th {
/* !important prevents the common CSS stylesheets from overriding
this as on RTD they are loaded after this stylesheet */
white-space: normal !important;
}
.wy-table-responsive {
margin-bottom: 24px;
max-width: 100%;
overflow: visible !important;
}
}
/* +50px width for the main doc container nav */
.wy-nav-content {
max-width: 850px !important;
}
/* prevent keyword in codeblock in docstring from being italic */
html.writer-html4 .rst-content dl:not(.docutils) .k,
html.writer-html5
.rst-content
dl[class]:not(.option-list):not(.field-list):not(.footnote):not(
.glossary
):not(.simple)
.k {
font-style: inherit !important;
}
/* ofc */
.highlight {
tab-size: 4;
}
/* remove the bottom margin for tabs from sphinx_inline_tabs */
.tab-set {
margin: 0;
}
/* better inline codeblocks */
.rst-content code,
.rst-content tt,
code {
background: rgba(
251,
251,
251
); /* don't use pure white, that's too shiny */
}
/*
render multi-line cell of tables correctly
https://github.com/readthedocs/sphinx_rtd_theme/issues/1241
*/
.rst-content table.docutils td:first-child,
.rst-content table.docutils th:first-child,
.rst-content table.field-list td:first-child,
.rst-content table.field-list th:first-child,
.wy-table td:first-child,
.wy-table th:first-child {
border-left-width: 1px;
}

19
docs/static/js/readthedoc-flyout.js vendored Normal file
View File

@@ -0,0 +1,19 @@
function waitForElement(selector, callback) {
if (document.querySelector(selector)) {
callback();
} else {
setTimeout(function () {
waitForElement(selector, callback);
}, 100);
}
}
window.addEventListener("load", () => {
waitForElement("readthedocs-flyout", () => {
let flyout = document.querySelector("readthedocs-flyout").shadowRoot;
let target = flyout.querySelector("header");
target.addEventListener("click", (e) => {
e.stopPropagation();
});
});
});

4
docs/update_i18n.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
make gettext
echo "Currently support zh_CN only."
sphinx-intl update -p build/gettext -l zh_CN