sphinxnotes-project 1.0a45__tar.gz → 1.0a47__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/.cruft.json +4 -2
  2. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/.github/workflows/lint.yml +3 -1
  3. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/.github/workflows/pages.yml +2 -0
  4. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/.github/workflows/pypi.yml +4 -2
  5. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/.github/workflows/release.yml +3 -1
  6. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/.github/workflows/test.yml +8 -5
  7. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/.gitignore +2 -0
  8. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/.pre-commit-config.yaml +2 -0
  9. sphinxnotes_project-1.0a47/AGENTS.md +40 -0
  10. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/MANIFEST.in +0 -1
  11. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/Makefile +0 -1
  12. {sphinxnotes_project-1.0a45/src/sphinxnotes_project.egg-info → sphinxnotes_project-1.0a47}/PKG-INFO +1 -11
  13. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/README.rst +0 -1
  14. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/docs/Makefile +0 -1
  15. sphinxnotes_project-1.0a47/docs/_images/.gitkeep +1 -0
  16. sphinxnotes_project-1.0a47/docs/_static/.gitkeep +1 -0
  17. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/docs/changelog.rst +0 -1
  18. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/docs/conf.py +4 -1
  19. sphinxnotes_project-1.0a47/docs/conf.rst +12 -0
  20. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/docs/index.rst +1 -1
  21. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/docs/make.bat +38 -37
  22. sphinxnotes_project-1.0a47/docs/requirements.txt +18 -0
  23. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/docs/sphinxnotes_any.rst +4 -0
  24. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/pyproject.toml +0 -16
  25. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/ruff.toml +0 -1
  26. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes/project/__init__.py +1 -0
  27. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes/project/meta.py +1 -1
  28. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes/project/sphinxnotes_any.py +22 -1
  29. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes/project/sphinxnotes_render_ext.py +22 -0
  30. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes/project/templates/autoconfval.rst +1 -8
  31. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes/project/templates/example.rst +3 -2
  32. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47/src/sphinxnotes_project.egg-info}/PKG-INFO +1 -11
  33. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes_project.egg-info/SOURCES.txt +3 -0
  34. sphinxnotes_project-1.0a47/src/sphinxnotes_project.egg-info/requires.txt +13 -0
  35. sphinxnotes_project-1.0a47/tests/__init__.py +1 -0
  36. sphinxnotes_project-1.0a45/docs/_images/.gitkeep +0 -0
  37. sphinxnotes_project-1.0a45/docs/_static/.gitkeep +0 -0
  38. sphinxnotes_project-1.0a45/src/sphinxnotes_project.egg-info/requires.txt +0 -23
  39. sphinxnotes_project-1.0a45/tests/__init__.py +0 -0
  40. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/.github/workflows/tag.yml +0 -0
  41. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/LICENSE +0 -0
  42. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/docs/_static/custom.css +0 -0
  43. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/docs/_static/sphinx-notes.png +0 -0
  44. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/setup.cfg +0 -0
  45. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes/project/py.typed +0 -0
  46. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes/project/templates/autoobj.rst +0 -0
  47. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes/project/templates/internal-only.rst +0 -0
  48. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes/project/templates/version.rst +0 -0
  49. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes/project/utils/__init__.py +0 -0
  50. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes_project.egg-info/dependency_links.txt +0 -0
  51. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/src/sphinxnotes_project.egg-info/top_level.txt +0 -0
  52. {sphinxnotes_project-1.0a45 → sphinxnotes_project-1.0a47}/tests/test_always_pass.py +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "template": "https://github.com/sphinx-notes/cookiecutter",
3
- "commit": "4c6b17aec1a4b8ddca95c4882c6bed2bc230d595",
3
+ "commit": "463b120aec3391878cf9453ca26280bf5258c08d",
4
4
  "checkout": null,
5
5
  "context": {
6
6
  "cookiecutter": {
@@ -12,6 +12,8 @@
12
12
  "version": "0.1",
13
13
  "github_owner": "sphinx-notes",
14
14
  "github_repo": "project",
15
+ "generated_file_header": "This file is generated from sphinx-notes/cookiecutter.",
16
+ "dont_edit_header": "DO NOT EDIT.",
15
17
  "pypi_name": "sphinxnotes-project",
16
18
  "pypi_owner": "SilverRainZ",
17
19
  "is_python_project": true,
@@ -20,7 +22,7 @@
20
22
  "sphinx_version": "7.0",
21
23
  "development_status": "3 - Alpha",
22
24
  "_template": "https://github.com/sphinx-notes/cookiecutter",
23
- "_commit": "4c6b17aec1a4b8ddca95c4882c6bed2bc230d595"
25
+ "_commit": "233a8daa4e276a9559975a51178f29e7079dcafd"
24
26
  }
25
27
  },
26
28
  "directory": null
@@ -1,3 +1,5 @@
1
+ # This file is generated from sphinx-notes/cookiecutter.
2
+
1
3
  name: Ruff
2
4
  on: [ push, pull_request ]
3
5
 
@@ -5,5 +7,5 @@ jobs:
5
7
  ruff:
6
8
  runs-on: ubuntu-latest
7
9
  steps:
8
- - uses: actions/checkout@v4
10
+ - uses: actions/checkout@v6
9
11
  - uses: chartboost/ruff-action@v1
@@ -1,3 +1,5 @@
1
+ # This file is generated from sphinx-notes/cookiecutter.
2
+
1
3
  name: Deploy Sphinx documentation to Pages
2
4
 
3
5
  # Runs on pushes targeting the default branch
@@ -1,3 +1,5 @@
1
+ # This file is generated from sphinx-notes/cookiecutter.
2
+
1
3
  name: Publish package distributions to PyPI
2
4
 
3
5
  on:
@@ -14,8 +16,8 @@ jobs:
14
16
  permissions:
15
17
  id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
16
18
  steps:
17
- - uses: actions/checkout@v4
18
- - uses: actions/setup-python@v5
19
+ - uses: actions/checkout@v6
20
+ - uses: actions/setup-python@v6
19
21
  - run: pip install build twine && make dist
20
22
  - uses: pypa/gh-action-pypi-publish@release/v1
21
23
  with:
@@ -1,3 +1,5 @@
1
+ # This file is generated from sphinx-notes/cookiecutter.
2
+
1
3
  name: Publish Github Release
2
4
 
3
5
  on:
@@ -11,7 +13,7 @@ jobs:
11
13
  permissions:
12
14
  contents: write
13
15
  steps:
14
- - uses: actions/checkout@v4
16
+ - uses: actions/checkout@v6
15
17
  - uses: ncipollo/release-action@v1
16
18
  with:
17
19
  body: |
@@ -1,3 +1,5 @@
1
+ # This file is generated from sphinx-notes/cookiecutter.
2
+
1
3
  name: Test
2
4
  on:
3
5
  push:
@@ -8,8 +10,8 @@ jobs:
8
10
  test:
9
11
  runs-on: ubuntu-latest
10
12
  steps:
11
- - uses: actions/checkout@v2
12
- - uses: actions/setup-python@v5
13
+ - uses: actions/checkout@v6
14
+ - uses: actions/setup-python@v6
13
15
  with:
14
16
  python-version-file: 'pyproject.toml'
15
17
  - run: python3 -m pip install .[test]
@@ -17,9 +19,10 @@ jobs:
17
19
  doctest:
18
20
  runs-on: ubuntu-latest
19
21
  steps:
20
- - uses: actions/checkout@v2
21
- - uses: actions/setup-python@v5
22
+ - uses: actions/checkout@v6
23
+ - uses: actions/setup-python@v6
22
24
  with:
23
25
  python-version-file: 'pyproject.toml'
24
- - run: python3 -m pip install .[docs]
26
+ - run: python3 -m pip install .[test]
27
+ - run: python3 -m pip install -r docs/requirements.txt
25
28
  - run: make doctest
@@ -1,3 +1,5 @@
1
+ # This file is generated from sphinx-notes/cookiecutter.
2
+
1
3
  # Byte-compiled / optimized / DLL files
2
4
  __pycache__/
3
5
  *.py[cod]
@@ -1,3 +1,5 @@
1
+ # This file is generated from sphinx-notes/cookiecutter.
2
+
1
3
  repos:
2
4
  - repo: https://github.com/astral-sh/ruff-pre-commit
3
5
  rev: v0.14.11
@@ -0,0 +1,40 @@
1
+ <!-- This file is generated from sphinx-notes/cookiecutter. -->
2
+
3
+ ## 基本说明
4
+
5
+ 这是一个由 SphinxNotes 开发的 Sphinx Extension,由 `sphinxnotes/cookiecutter` 生成,很多基础文件来自模板。
6
+
7
+ ## 首先阅读
8
+
9
+ - 开始了解项目时,优先阅读 `docs/index.rst`。
10
+ - 如果任务和文档、Sphinx 配置或示例有关,继续阅读 `docs/` 下的其他文件
11
+
12
+ ## 通用知识
13
+
14
+ - 使用 `make` 会构建 `docs/` 下的文档,文档自依赖当前项目,因此文档构建成功也意味着项目基本能正常构建
15
+ - `docs/_build` 存放构建好的文档,`make clean` 清除所有构建结果
16
+ - `make test` 运行测试,测试位于 `tests/`,可能的 e2e 测试位于 `tests/test_e2e.py`
17
+ - `make doctest` 运行 Sphinx 文档测试
18
+ - `make install` 使用 `pip install --user` 将项目安装到本地,跨项目测试时常用
19
+ - `make tmpl-*` 用于模板同步,参看 "模板同步" 小节
20
+
21
+ ## 关于 SphinxNotes 项目
22
+
23
+ - 同为 `sphinxnotes` 项目的其他仓库通常位于当前项目的上一级目录
24
+ - 如果你在阅读代码时遇到本地依赖、模板来源或跨仓库复用关系,可以直接读取这些本地仓库文件,不必先猜测实现,也不必优先去远程搜索。
25
+ - 当我提到 "所有项目" 的时候,请从当前项目的上一级目录的 `cookiecutter/project-list.txt` 获取项目列表
26
+ - `docs/conf.py` 往往会直接从源码树导入当前项目,因此排查文档构建问题时,要同时检查运行时依赖和文档依赖。
27
+
28
+ ## 模板同步
29
+
30
+ - 先确认任务是当前项目问题,还是模板问题;如果是模板问题,优先在 `sphinxnotes/cookiecutter` 中修复。
31
+ - 模板变更完成后,优先使用 `make tmpl-update` 把改动同步回项目,而不是手工重复修改生成文件。
32
+ - 如果 `make tmpl-update` 产生 `.rej`、冲突或三方合并失败,优先尝试 `make tmpl-apply-rej`,再手工解决冲突。
33
+ - 手工解决冲突时,重点检查 `README.rst`、`pyproject.toml`、`.github/workflows/`、`docs/conf.py`、`docs/requirements.txt` 这些常见受影响文件。
34
+ - 当模板同步结果确认无误后,优先使用 `make tmpl-update-done` 完成后续收尾步骤。
35
+
36
+ ### 修改约定
37
+
38
+ - 修改模板生成文件时,保留原有注释,除非模板本身已经统一移除了这些注释。
39
+ - 遇到 `CUSTOM ... START` / `END` 这类用户自定义区块时,必须保留这些锚点,并尽量保留区块中的用户内容。
40
+ - 如果模板更新和项目内手工修改发生冲突,优先保护用户自定义内容,再整理模板变更。
@@ -1,5 +1,4 @@
1
1
  # This file is generated from sphinx-notes/cookiecutter.
2
- # You need to consider modifying the TEMPLATE or modifying THIS FILE.
3
2
 
4
3
  include LICENSE
5
4
  include README.rst
@@ -1,5 +1,4 @@
1
1
  # This file is generated from sphinx-notes/cookiecutter.
2
- # You need to consider modifying the TEMPLATE or modifying THIS FILE.
3
2
 
4
3
  LANG = en_US.UTF-8
5
4
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sphinxnotes-project
3
- Version: 1.0a45
3
+ Version: 1.0a47
4
4
  Summary: A Sphinx extension that provides useful directives for creating project documentation
5
5
  Author: Shengyu Zhang
6
6
  Maintainer: Shengyu Zhang
@@ -34,19 +34,9 @@ Requires-Dist: ruff>=0.11.10; extra == "dev"
34
34
  Requires-Dist: pre-commit; extra == "dev"
35
35
  Provides-Extra: test
36
36
  Requires-Dist: pytest; extra == "test"
37
- Provides-Extra: docs
38
- Requires-Dist: furo; extra == "docs"
39
- Requires-Dist: sphinx_design; extra == "docs"
40
- Requires-Dist: sphinx_copybutton; extra == "docs"
41
- Requires-Dist: sphinxcontrib-gtagjs; extra == "docs"
42
- Requires-Dist: sphinx-sitemap; extra == "docs"
43
- Requires-Dist: sphinxext-opengraph; extra == "docs"
44
- Requires-Dist: sphinx-last-updated-by-git; extra == "docs"
45
- Requires-Dist: sphinxnotes-comboroles; extra == "docs"
46
37
  Dynamic: license-file
47
38
 
48
39
  .. This file is generated from sphinx-notes/cookiecutter.
49
- You need to consider modifying the TEMPLATE or modifying THIS FILE.
50
40
 
51
41
  ===================
52
42
  sphinxnotes-project
@@ -1,5 +1,4 @@
1
1
  .. This file is generated from sphinx-notes/cookiecutter.
2
- You need to consider modifying the TEMPLATE or modifying THIS FILE.
3
2
 
4
3
  ===================
5
4
  sphinxnotes-project
@@ -1,5 +1,4 @@
1
1
  # This file is generated from sphinx-notes/cookiecutter.
2
- # You need to consider modifying the TEMPLATE or modifying THIS FILE.
3
2
 
4
3
  # Minimal makefile for Sphinx documentation
5
4
 
@@ -0,0 +1 @@
1
+ # This file is generated from sphinx-notes/cookiecutter.
@@ -0,0 +1 @@
1
+ # This file is generated from sphinx-notes/cookiecutter.
@@ -1,5 +1,4 @@
1
1
  .. This file is generated from sphinx-notes/cookiecutter.
2
- You need to consider modifying the TEMPLATE or modifying THIS FILE.
3
2
 
4
3
  ==========
5
4
  Change Log
@@ -1,5 +1,4 @@
1
1
  # This file is generated from sphinx-notes/cookiecutter.
2
- # You need to consider modifying the TEMPLATE or modifying THIS FILE.
3
2
 
4
3
  # Configuration file for the Sphinx documentation builder.
5
4
  #
@@ -91,6 +90,9 @@ gtagjs_ids = ['G-E4SNX0WZYV']
91
90
  extensions.append('sphinx.ext.autodoc')
92
91
  autoclass_content = 'init'
93
92
  autodoc_typehints = 'description'
93
+ autodoc_default_options = {
94
+ 'member-order': 'bysource',
95
+ }
94
96
 
95
97
  extensions.append('sphinx.ext.intersphinx')
96
98
  intersphinx_mapping = {}
@@ -109,6 +111,7 @@ comboroles_roles = {
109
111
  'parsed_literal': (['literal'], True),
110
112
  }
111
113
 
114
+
112
115
  # -- Eat your own dog food --------------------------------------------------
113
116
 
114
117
  # If extensions (or modules to document with autodoc) are in another directory,
@@ -0,0 +1,12 @@
1
+ =============
2
+ Configuration
3
+ =============
4
+
5
+ The extension provides the following configuration:
6
+
7
+ .. autoconfval:: project_example_style
8
+
9
+ Controls the default value of the :rst:dir:`example` directive's
10
+ ``:style:`` option.
11
+
12
+ Supported values are ``grid`` and ``tab``. The default is ``grid``.
@@ -1,5 +1,4 @@
1
1
  .. This file is generated from sphinx-notes/cookiecutter.
2
- You need to consider modifying the TEMPLATE or modifying THIS FILE.
3
2
 
4
3
  ===================
5
4
  sphinxnotes-project
@@ -75,6 +74,7 @@ Contents
75
74
  .. toctree::
76
75
  :caption: Contents
77
76
 
77
+ conf
78
78
  sphinxnotes_any
79
79
  changelog
80
80
 
@@ -1,37 +1,38 @@
1
- REM This file is generated from sphinx-notes/cookiecutter. DO NOT EDIT.
2
-
3
- @ECHO OFF
4
-
5
- pushd %~dp0
6
-
7
- REM Command file for Sphinx documentation
8
-
9
- if "%SPHINXBUILD%" == "" (
10
- set SPHINXBUILD=python -msphinx
11
- )
12
- set SOURCEDIR=.
13
- set BUILDDIR=_build
14
-
15
- if "%1" == "" goto help
16
-
17
- %SPHINXBUILD% >NUL 2>NUL
18
- if errorlevel 9009 (
19
- echo.
20
- echo.The Sphinx module was not found. Make sure you have Sphinx installed,
21
- echo.then set the SPHINXBUILD environment variable to point to the full
22
- echo.path of the 'sphinx-build' executable. Alternatively you may add the
23
- echo.Sphinx directory to PATH.
24
- echo.
25
- echo.If you don't have Sphinx installed, grab it from
26
- echo.http://sphinx-doc.org/
27
- exit /b 1
28
- )
29
-
30
- %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
31
- goto end
32
-
33
- :help
34
- %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
35
-
36
- :end
37
- popd
1
+ REM This file is generated from sphinx-notes/cookiecutter.
2
+ REM DO NOT EDIT.
3
+
4
+ @ECHO OFF
5
+
6
+ pushd %~dp0
7
+
8
+ REM Command file for Sphinx documentation
9
+
10
+ if "%SPHINXBUILD%" == "" (
11
+ set SPHINXBUILD=python -msphinx
12
+ )
13
+ set SOURCEDIR=.
14
+ set BUILDDIR=_build
15
+
16
+ if "%1" == "" goto help
17
+
18
+ %SPHINXBUILD% >NUL 2>NUL
19
+ if errorlevel 9009 (
20
+ echo.
21
+ echo.The Sphinx module was not found. Make sure you have Sphinx installed,
22
+ echo.then set the SPHINXBUILD environment variable to point to the full
23
+ echo.path of the 'sphinx-build' executable. Alternatively you may add the
24
+ echo.Sphinx directory to PATH.
25
+ echo.
26
+ echo.If you don't have Sphinx installed, grab it from
27
+ echo.http://sphinx-doc.org/
28
+ exit /b 1
29
+ )
30
+
31
+ %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
32
+ goto end
33
+
34
+ :help
35
+ %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
36
+
37
+ :end
38
+ popd
@@ -0,0 +1,18 @@
1
+ # This file is generated from sphinx-notes/cookiecutter.
2
+
3
+ # Documentation build dependencies.
4
+ # Keep these out of pyproject optional-dependencies to avoid resolver issues.
5
+ furo
6
+ sphinx_copybutton
7
+ sphinxcontrib-gtagjs
8
+ sphinx-sitemap
9
+ sphinxext-opengraph
10
+ sphinx-last-updated-by-git
11
+ sphinxnotes-comboroles
12
+
13
+ # NOTE: Not used by docs (docs import extension from ../src),
14
+ # only to resolve its optional dependencies.
15
+ sphinxnotes-project
16
+
17
+ # CUSTOM DOCS DEPENDENCIES START
18
+ # CUSTOM DOCS DEPENDENCIES END
@@ -13,3 +13,7 @@ The ``example`` Object
13
13
  ======================
14
14
 
15
15
  .. autoobj:: any:example
16
+
17
+ The default value of the ``:style:`` option can be controlled by the
18
+ :confval:`project_example_style` config, which accepts ``grid`` and ``tab``
19
+ and defaults to ``grid``.
@@ -1,5 +1,4 @@
1
1
  # This file is generated from sphinx-notes/cookiecutter.
2
- # You need to consider modifying the TEMPLATE or modifying THIS FILE.
3
2
 
4
3
  # This file is used to configure your project.
5
4
  # Read more about the various options under:
@@ -61,21 +60,6 @@ dev = [
61
60
  test = [
62
61
  "pytest",
63
62
  ]
64
- docs = [
65
- "furo",
66
- "sphinx_design",
67
- "sphinx_copybutton",
68
- "sphinxcontrib-gtagjs",
69
- "sphinx-sitemap",
70
- "sphinxext-opengraph",
71
- "sphinx-last-updated-by-git",
72
-
73
- # Dependencies of sphinxnotes projcts.
74
- "sphinxnotes-comboroles",
75
-
76
- # CUSTOM DOCS DEPENDENCIES START
77
- # CUSTOM DOCS DEPENDENCIES END
78
- ]
79
63
 
80
64
  [project.urls]
81
65
  homepage = "https://sphinx.silverrainz.me/project"
@@ -1,5 +1,4 @@
1
1
  # This file is generated from sphinx-notes/cookiecutter.
2
- # You need to consider modifying the TEMPLATE or modifying THIS FILE.
3
2
 
4
3
  exclude = [
5
4
  "docs/conf.py",
@@ -21,6 +21,7 @@ def setup(app: Sphinx):
21
21
  meta.pre_setup(app)
22
22
 
23
23
  from . import sphinxnotes_any, sphinxnotes_render_ext
24
+
24
25
  sphinxnotes_any.setup(app)
25
26
  sphinxnotes_render_ext.setup(app)
26
27
 
@@ -1,5 +1,5 @@
1
1
  # This file is generated from sphinx-notes/cookiecutter.
2
- # DO NOT EDIT!!!
2
+ # DO NOT EDIT.
3
3
 
4
4
  ################################################################################
5
5
  # Project meta infos.
@@ -14,6 +14,9 @@ from __future__ import annotations
14
14
  from typing import TYPE_CHECKING
15
15
  from os import path
16
16
 
17
+ from sphinx.config import ENUM
18
+ from sphinx.errors import ConfigError
19
+
17
20
  if TYPE_CHECKING:
18
21
  from sphinx.application import Sphinx
19
22
  from sphinx.config import Config
@@ -37,6 +40,14 @@ def _read_template_file(name: str) -> str:
37
40
  return open(_get_template_file(name), 'r').read()
38
41
 
39
42
 
43
+ def _validate_project_example_style(style: str) -> str:
44
+ if style not in {'tab', 'grid'}:
45
+ raise ConfigError(
46
+ 'The "project_example_style" config value must be "tab" or "grid".'
47
+ )
48
+ return style
49
+
50
+
40
51
  ANY_OBJECT_TYPES = {
41
52
  'version': {
42
53
  'schema': {
@@ -61,11 +72,15 @@ ANY_OBJECT_TYPES = {
61
72
  'templates': {
62
73
  'obj': _read_template_file('example'),
63
74
  },
64
- }
75
+ },
65
76
  }
66
77
 
67
78
 
68
79
  def _config_inited(app: Sphinx, config: Config) -> None:
80
+ config.project_example_style = _validate_project_example_style(
81
+ config.project_example_style
82
+ )
83
+
69
84
  if v := config.any_object_types:
70
85
  v.update(ANY_OBJECT_TYPES)
71
86
  else:
@@ -75,5 +90,11 @@ def _config_inited(app: Sphinx, config: Config) -> None:
75
90
 
76
91
  def setup(app: Sphinx):
77
92
  app.setup_extension('sphinxnotes.any')
93
+ app.add_config_value(
94
+ 'project_example_style',
95
+ 'grid',
96
+ 'env',
97
+ types=ENUM('tab', 'grid'),
98
+ )
78
99
  # Should have priority over sphinxnotes.any's "config-inited" callback.
79
100
  app.connect('config-inited', _config_inited, priority=400)
@@ -9,14 +9,35 @@ See also https://sphinx.silverrainz.me/render/.
9
9
  :copyright: Copyright 2025 Shengyu Zhang
10
10
  :license: BSD, see LICENSE for details.
11
11
  """
12
+
12
13
  from __future__ import annotations
13
14
  from typing import TYPE_CHECKING
14
15
 
16
+ from sphinx.config import ENUM
17
+ from sphinxnotes.render import filter
18
+
15
19
  from .sphinxnotes_any import _read_template_file
16
20
 
17
21
  if TYPE_CHECKING:
22
+ from collections.abc import Iterable
18
23
  from sphinx.application import Sphinx
19
24
  from sphinx.config import Config
25
+ from sphinx.environment import BuildEnvironment
26
+
27
+
28
+ def _format_autoconfval_types(valid_types) -> list[str]:
29
+ if isinstance(valid_types, ENUM):
30
+ return [f'``{c!r}``' for c in sorted(valid_types._candidates)] # pyright: ignore[reportPrivateUsage]
31
+ return [f':py:`{t.__name__}`' for t in valid_types]
32
+
33
+
34
+ @filter('autoconfval_types')
35
+ def autoconfval_types(_: BuildEnvironment):
36
+ def _filter(valid_types) -> Iterable[str]:
37
+ return _format_autoconfval_types(valid_types)
38
+
39
+ return _filter
40
+
20
41
 
21
42
  DATA_DEFINE_DIRECTIVES = {
22
43
  'autoconfval': {
@@ -47,6 +68,7 @@ DATA_DEFINE_DIRECTIVES = {
47
68
  },
48
69
  }
49
70
 
71
+
50
72
  def _config_inited(app: Sphinx, config: Config) -> None:
51
73
  if v := config.render_ext_data_define_directives:
52
74
  v.update(DATA_DEFINE_DIRECTIVES)
@@ -3,15 +3,8 @@
3
3
  .. role:: py(code)
4
4
  :language: Python
5
5
 
6
- {% set types = [] %}
7
- {% for t in opt.valid_types %}
8
- {# "<class 'str'>" → "str" #}
9
- {% set t = t | string %}
10
- {% do types.append(t[8:-2]) %}
11
- {% endfor %}
12
-
13
6
  .. confval:: {{ name }}
14
- :type: {{ types | roles('py') | join(',') }}
7
+ :type: {{ opt.valid_types | autoconfval_types | join(', ') }}
15
8
  :default: :py:`{{ opt.default | pprint }}`
16
9
 
17
10
  {%- for line in opt.description.split('\n') %}
@@ -1,4 +1,5 @@
1
- {% if not style or style == 'tab' %}
1
+ {% set effective_style = style or load_extra('env').config.project_example_style %}
2
+ {% if effective_style == 'tab' %}
2
3
  .. tab-set::
3
4
 
4
5
  .. tab-item:: Result
@@ -14,7 +15,7 @@
14
15
  {% for line in content.split('\n') -%}
15
16
  {{ line }}
16
17
  {% endfor %}
17
- {% elif style == 'grid' %}
18
+ {% elif effective_style == 'grid' %}
18
19
  .. grid:: 1 1 2 2
19
20
  :gutter: 1
20
21
  :margin: 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sphinxnotes-project
3
- Version: 1.0a45
3
+ Version: 1.0a47
4
4
  Summary: A Sphinx extension that provides useful directives for creating project documentation
5
5
  Author: Shengyu Zhang
6
6
  Maintainer: Shengyu Zhang
@@ -34,19 +34,9 @@ Requires-Dist: ruff>=0.11.10; extra == "dev"
34
34
  Requires-Dist: pre-commit; extra == "dev"
35
35
  Provides-Extra: test
36
36
  Requires-Dist: pytest; extra == "test"
37
- Provides-Extra: docs
38
- Requires-Dist: furo; extra == "docs"
39
- Requires-Dist: sphinx_design; extra == "docs"
40
- Requires-Dist: sphinx_copybutton; extra == "docs"
41
- Requires-Dist: sphinxcontrib-gtagjs; extra == "docs"
42
- Requires-Dist: sphinx-sitemap; extra == "docs"
43
- Requires-Dist: sphinxext-opengraph; extra == "docs"
44
- Requires-Dist: sphinx-last-updated-by-git; extra == "docs"
45
- Requires-Dist: sphinxnotes-comboroles; extra == "docs"
46
37
  Dynamic: license-file
47
38
 
48
39
  .. This file is generated from sphinx-notes/cookiecutter.
49
- You need to consider modifying the TEMPLATE or modifying THIS FILE.
50
40
 
51
41
  ===================
52
42
  sphinxnotes-project
@@ -1,6 +1,7 @@
1
1
  .cruft.json
2
2
  .gitignore
3
3
  .pre-commit-config.yaml
4
+ AGENTS.md
4
5
  LICENSE
5
6
  MANIFEST.in
6
7
  Makefile
@@ -16,8 +17,10 @@ ruff.toml
16
17
  docs/Makefile
17
18
  docs/changelog.rst
18
19
  docs/conf.py
20
+ docs/conf.rst
19
21
  docs/index.rst
20
22
  docs/make.bat
23
+ docs/requirements.txt
21
24
  docs/sphinxnotes_any.rst
22
25
  docs/_images/.gitkeep
23
26
  docs/_static/.gitkeep
@@ -0,0 +1,13 @@
1
+ Sphinx>=7.0
2
+ sphinxnotes-any>=3.0b0
3
+ sphinx_design
4
+
5
+ [dev]
6
+ build
7
+ twine
8
+ cruft
9
+ ruff>=0.11.10
10
+ pre-commit
11
+
12
+ [test]
13
+ pytest
@@ -0,0 +1 @@
1
+ # This file is generated from sphinx-notes/cookiecutter.
File without changes
File without changes
@@ -1,23 +0,0 @@
1
- Sphinx>=7.0
2
- sphinxnotes-any>=3.0b0
3
- sphinx_design
4
-
5
- [dev]
6
- build
7
- twine
8
- cruft
9
- ruff>=0.11.10
10
- pre-commit
11
-
12
- [docs]
13
- furo
14
- sphinx_design
15
- sphinx_copybutton
16
- sphinxcontrib-gtagjs
17
- sphinx-sitemap
18
- sphinxext-opengraph
19
- sphinx-last-updated-by-git
20
- sphinxnotes-comboroles
21
-
22
- [test]
23
- pytest
File without changes