sphinxnotes-render 1.0b5__tar.gz → 1.0b6__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 (92) hide show
  1. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/.cruft.json +4 -2
  2. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/.github/workflows/lint.yml +3 -1
  3. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/.github/workflows/pages.yml +2 -0
  4. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/.github/workflows/pypi.yml +4 -2
  5. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/.github/workflows/release.yml +3 -1
  6. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/.github/workflows/test.yml +8 -5
  7. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/.gitignore +2 -0
  8. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/.pre-commit-config.yaml +2 -0
  9. sphinxnotes_render-1.0b6/AGENTS.md +40 -0
  10. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/MANIFEST.in +0 -1
  11. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/Makefile +0 -1
  12. {sphinxnotes_render-1.0b5/src/sphinxnotes_render.egg-info → sphinxnotes_render-1.0b6}/PKG-INFO +1 -13
  13. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/README.rst +0 -1
  14. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/Makefile +0 -1
  15. sphinxnotes_render-1.0b6/docs/_images/.gitkeep +1 -0
  16. sphinxnotes_render-1.0b6/docs/_static/.gitkeep +1 -0
  17. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/api.rst +19 -7
  18. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/changelog.rst +0 -1
  19. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/conf.py +5 -1
  20. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/ext.rst +22 -1
  21. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/index.rst +0 -1
  22. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/make.bat +38 -37
  23. sphinxnotes_render-1.0b6/docs/requirements.txt +20 -0
  24. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/tmpl.rst +40 -26
  25. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/pyproject.toml +0 -18
  26. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/ruff.toml +0 -1
  27. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/__init__.py +17 -2
  28. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/ctx.py +5 -2
  29. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/ctxnodes.py +70 -62
  30. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/data.py +3 -3
  31. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/ext/extractx.py +2 -6
  32. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/extractx.py +27 -20
  33. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/jinja.py +52 -16
  34. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/markup.py +25 -5
  35. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/meta.py +1 -1
  36. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/pipeline.py +11 -17
  37. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/sources.py +5 -2
  38. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/utils/__init__.py +44 -18
  39. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6/src/sphinxnotes_render.egg-info}/PKG-INFO +1 -13
  40. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes_render.egg-info/SOURCES.txt +4 -0
  41. sphinxnotes_render-1.0b6/src/sphinxnotes_render.egg-info/requires.txt +16 -0
  42. sphinxnotes_render-1.0b6/tests/__init__.py +1 -0
  43. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-extra-context/conf.py +2 -0
  44. sphinxnotes_render-1.0b6/tests/roots/test-extra-context-params/conf.py +23 -0
  45. sphinxnotes_render-1.0b6/tests/roots/test-extra-context-params/index.rst +8 -0
  46. sphinxnotes_render-1.0b6/tests/test_ctx.py +24 -0
  47. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/test_e2e.py +9 -0
  48. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/test_extractx.py +25 -4
  49. sphinxnotes_render-1.0b5/docs/_images/.gitkeep +0 -0
  50. sphinxnotes_render-1.0b5/docs/_static/.gitkeep +0 -0
  51. sphinxnotes_render-1.0b5/src/sphinxnotes_render.egg-info/requires.txt +0 -28
  52. sphinxnotes_render-1.0b5/tests/__init__.py +0 -0
  53. sphinxnotes_render-1.0b5/tests/test_ctx.py +0 -60
  54. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/LICENSE +0 -0
  55. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/_static/custom.css +0 -0
  56. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/_static/sphinx-notes.png +0 -0
  57. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/conf.rst +0 -0
  58. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/dsl.rst +0 -0
  59. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/docs/usage.rst +0 -0
  60. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/setup.cfg +0 -0
  61. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/ext/__init__.py +0 -0
  62. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/ext/adhoc.py +0 -0
  63. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/ext/derive.py +0 -0
  64. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/ext/filters.py +0 -0
  65. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/py.typed +0 -0
  66. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/template.py +0 -0
  67. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/utils/ctxproxy.py +0 -0
  68. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes/render/utils/freestyle.py +0 -0
  69. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes_render.egg-info/dependency_links.txt +0 -0
  70. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/src/sphinxnotes_render.egg-info/top_level.txt +0 -0
  71. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/conftest.py +0 -0
  72. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-base-context-directive-example/conf.py +0 -0
  73. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-base-context-directive-example/index.rst +0 -0
  74. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-base-data-define-directive-example/conf.py +0 -0
  75. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-base-data-define-directive-example/index.rst +0 -0
  76. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-data-define/conf.py +0 -0
  77. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-data-define/index.rst +0 -0
  78. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-derive/conf.py +0 -0
  79. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-derive/index.rst +0 -0
  80. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-extra-context/cat.json +0 -0
  81. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-extra-context/index.rst +0 -0
  82. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-extra-context-rebuild/conf.py +0 -0
  83. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-extra-context-rebuild/index.rst +0 -0
  84. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-filter-example/conf.py +0 -0
  85. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-filter-example/index.rst +0 -0
  86. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-strict-data-define-directive-example/conf.py +0 -0
  87. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-strict-data-define-directive-example/index.rst +0 -0
  88. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-strictdir-card/conf.py +0 -0
  89. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/roots/test-strictdir-card/index.rst +0 -0
  90. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/test_always_pass.py +0 -0
  91. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/test_data.py +0 -0
  92. {sphinxnotes_render-1.0b5 → sphinxnotes_render-1.0b6}/tests/test_jinja.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": "1.0b4",
13
13
  "github_owner": "sphinx-notes",
14
14
  "github_repo": "data",
15
+ "generated_file_header": "This file is generated from sphinx-notes/cookiecutter.",
16
+ "dont_edit_header": "DO NOT EDIT.",
15
17
  "pypi_name": "sphinxnotes-render",
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-render
3
- Version: 1.0b5
3
+ Version: 1.0b6
4
4
  Summary: Define, constrain, and render data in Sphinx documentation
5
5
  Author: Shengyu Zhang
6
6
  Maintainer: Shengyu Zhang
@@ -34,23 +34,11 @@ Requires-Dist: pre-commit; extra == "dev"
34
34
  Provides-Extra: test
35
35
  Requires-Dist: pytest; extra == "test"
36
36
  Requires-Dist: schema; 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-project; extra == "docs"
46
- Requires-Dist: sphinxnotes-comboroles; extra == "docs"
47
- Requires-Dist: schema; extra == "docs"
48
37
  Provides-Extra: ext
49
38
  Requires-Dist: schema; extra == "ext"
50
39
  Dynamic: license-file
51
40
 
52
41
  .. This file is generated from sphinx-notes/cookiecutter.
53
- You need to consider modifying the TEMPLATE or modifying THIS FILE.
54
42
 
55
43
  ==================
56
44
  sphinxnotes-render
@@ -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-render
@@ -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.
@@ -18,22 +18,22 @@ Base Role Classes
18
18
 
19
19
  .. autoclass:: sphinxnotes.render.BaseContextRole
20
20
  :show-inheritance:
21
- :members: process_pending_node, queue_pending_node, queue_context, current_context, current_template
21
+ :members: process_pending_node, queue_pending_node, current_context, current_template
22
22
 
23
23
  .. autoclass:: sphinxnotes.render.BaseDataDefineRole
24
24
  :show-inheritance:
25
- :members: process_pending_node, queue_pending_node, queue_context, current_schema, current_template
25
+ :members: process_pending_node, queue_pending_node, current_schema, current_template
26
26
 
27
27
  Base Directive Classes
28
28
  ----------------------
29
29
 
30
30
  .. autoclass:: sphinxnotes.render.BaseContextDirective
31
31
  :show-inheritance:
32
- :members: process_pending_node, queue_pending_node, queue_context, current_raw_data, current_context, current_template
32
+ :members: process_pending_node, queue_pending_node, current_context, current_template
33
33
 
34
34
  .. autoclass:: sphinxnotes.render.BaseDataDefineDirective
35
35
  :show-inheritance:
36
- :members: process_pending_node, queue_pending_node, queue_context, current_raw_data, current_schema, current_template
36
+ :members: process_pending_node, queue_pending_node, current_raw_data, current_schema, current_template
37
37
 
38
38
  .. autoclass:: sphinxnotes.render.StrictDataDefineDirective
39
39
  :show-inheritance:
@@ -104,11 +104,21 @@ See :doc:`tmpl` for built-in extra-context names such as ``doc`` and
104
104
  :members:
105
105
  :undoc-members:
106
106
 
107
+ .. autoclass:: sphinxnotes.render.ExtraContextRegistry
108
+ :members:
109
+ :inherited-members:
110
+ :undoc-members:
111
+ :class-doc-from: both
112
+
107
113
  Filters
108
114
  =======
109
115
 
110
116
  .. autodecorator:: sphinxnotes.render.filter
111
117
 
118
+ .. autoclass:: sphinxnotes.render.JinjaRegistry
119
+ :members:
120
+ :undoc-members:
121
+
112
122
  Data, Field and Schema
113
123
  ======================
114
124
 
@@ -131,11 +141,9 @@ Data, Field and Schema
131
141
  :members: name, attrs, content
132
142
  :undoc-members:
133
143
 
134
- .. autoclass:: sphinxnotes.render.data.Registry
144
+ .. autoclass:: sphinxnotes.render.DataRegistry
135
145
  :members:
136
146
 
137
- .. autotype:: sphinxnotes.render.data.ByOptionStore
138
-
139
147
  Registry
140
148
  ========
141
149
 
@@ -148,3 +156,7 @@ or add new extra context) by adding new items to
148
156
  .. autoclass:: sphinxnotes.render.Registry
149
157
 
150
158
  .. autoproperty:: data
159
+
160
+ .. autoproperty:: extra_context
161
+
162
+ .. autoproperty:: jinja
@@ -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
  extensions.append('sphinxnotes.project')
113
116
  primary_domain = 'any'
114
117
 
@@ -161,6 +164,7 @@ def setup(app):
161
164
 
162
165
  sys.path.insert(0, test_roots)
163
166
  __import__('test-extra-context.conf').conf.setup(app)
167
+ __import__('test-extra-context-params.conf').conf.setup(app)
164
168
  __import__('test-base-context-directive-example.conf').conf.setup(app)
165
169
  __import__('test-base-data-define-directive-example.conf').conf.setup(app)
166
170
  __import__('test-strict-data-define-directive-example.conf').conf.setup(app)
@@ -70,7 +70,10 @@ Extra contexts are registered by a
70
70
  :py:deco:`sphinxnotes.render.extra_context` class decorator.
71
71
 
72
72
  The decorated class must be a subclass of
73
- :py:class:`~sphinxnotes.render.ExtraContext`.
73
+ :py:class:`~sphinxnotes.render.ExtraContext`. The ``generate()`` method
74
+ accepts the ``ExtraContextRequest`` as the first argument, plus any
75
+ positional and keyword arguments passed by the template via
76
+ ``load_extra()``.
74
77
 
75
78
  .. literalinclude:: ../tests/roots/test-extra-context/conf.py
76
79
  :language: python
@@ -88,6 +91,24 @@ The decorated class must be a subclass of
88
91
 
89
92
  {{ load_extra('cat').name }}
90
93
 
94
+ To accept custom parameters in your extra context, add ``*args`` and
95
+ ``**kwargs`` to the ``generate()`` method signature:
96
+
97
+ .. literalinclude:: ../tests/roots/test-extra-context-params/conf.py
98
+ :language: python
99
+ :start-after: [literalinclude start]
100
+ :end-before: [literalinclude end]
101
+
102
+ .. example::
103
+ :style: grid
104
+
105
+ .. data.render::
106
+
107
+ {% set docs = load_extra('all_docs', 3) %}
108
+ {% for doc in docs %}
109
+ - :doc:`{{ doc }}`
110
+ {% endfor %}
111
+
91
112
  .. _ext-filters:
92
113
 
93
114
  Extending ilters
@@ -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-render
@@ -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,20 @@
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-project
12
+ sphinxnotes-comboroles
13
+
14
+ # NOTE: Not used by docs (docs import extension from ../src),
15
+ # only to resolve its optional dependencies.
16
+ sphinxnotes-render
17
+
18
+ # CUSTOM DOCS DEPENDENCIES START
19
+ schema # python dict schema validation
20
+ # CUSTOM DOCS DEPENDENCIES END
@@ -153,13 +153,19 @@ extension defines the schema through the :rst:dir:`data.schema` directive or
153
153
  Extra Context
154
154
  -------------
155
155
 
156
- Extra context provides access to pre-prepared structured data from external
157
- sources (such as Sphinx application, JSON file, and etc.). Unlike main context
158
- which comes from the directive/role itself, extra context lets you fetch data
159
- that was prepared beforehand.
156
+ .. glossary::
157
+
158
+ Extra Context
159
+ Extra context provides access to pre-prepared structured data from external
160
+ sources (such as Sphinx application, JSON file, and etc.). Unlike main context
161
+ which comes from the directive/role itself, extra context lets you fetch data
162
+ that was prepared beforehand.
160
163
 
161
- Extra contexts are generated on demand. Load them in the template using the
162
- ``load_extra()`` function.
164
+ ``load_extra``
165
+ Extra contexts are generated on demand. Load them in the template using the
166
+ ``load_extra()`` function. You can also pass positional and keyword arguments
167
+ to ``load_extra()``, which are forwarded to the extra context's
168
+ ``generate()`` method.
163
169
 
164
170
  .. example::
165
171
  :style: grid
@@ -170,6 +176,12 @@ Extra contexts are generated on demand. Load them in the template using the
170
176
 
171
177
  Document Title: "{{ doc.title }}"
172
178
 
179
+ .. data.render::
180
+
181
+ {% set docs = load_extra('all_docs', count=3) %}
182
+
183
+ {{ docs | join(', ') }}
184
+
173
185
  Built-in Extra Contexts
174
186
  ~~~~~~~~~~~~~~~~~~~~~~~
175
187
 
@@ -267,35 +279,37 @@ following filters:
267
279
 
268
280
  __ https://jinja.palletsprojects.com/en/stable/templates/#builtin-filters
269
281
 
270
- ``roles``
271
- Produces role markup from a sequence of strings.
282
+ .. glossary::
272
283
 
273
- .. example::
274
- :style: grid
284
+ ``roles``
285
+ Produces role markup from a sequence of strings.
275
286
 
276
- .. data.render::
287
+ .. example::
288
+ :style: grid
277
289
 
278
- {%
279
- set text = ['index', 'usage']
280
- | roles('doc')
281
- | join(', ')
282
- %}
290
+ .. data.render::
283
291
 
284
- :Text: ``{{ text }}``
285
- :Rendered: {{ text }}
292
+ {%
293
+ set text = ['index', 'usage']
294
+ | roles('doc')
295
+ | join(', ')
296
+ %}
286
297
 
287
- ``jsonify``
288
- Convert value to JSON.
298
+ :Text: ``{{ text }}``
299
+ :Rendered: {{ text }}
289
300
 
290
- .. example::
291
- :style: grid
301
+ ``jsonify``
302
+ Convert value to JSON.
292
303
 
293
- .. data.render::
304
+ .. example::
305
+ :style: grid
306
+
307
+ .. data.render::
294
308
 
295
- {% set text = {'name': 'mimi'} %}
309
+ {% set text = {'name': 'mimi'} %}
296
310
 
297
- :Strify: ``{{ text }}``
298
- :JSONify: ``{{ text | jsonify | replace('\n', '')}}``
311
+ :Strify: ``{{ text }}``
312
+ :JSONify: ``{{ text | jsonify | replace('\n', '')}}``
299
313
 
300
314
  .. seealso:: :ref:`ext-filters`
301
315
 
@@ -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,23 +60,6 @@ test = [
61
60
  "pytest",
62
61
  "schema", # python dict schema validation
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-project",
75
- "sphinxnotes-comboroles",
76
-
77
- # CUSTOM DOCS DEPENDENCIES START
78
- "schema", # python dict schema validation
79
- # CUSTOM DOCS DEPENDENCIES END
80
- ]
81
63
  ext = [
82
64
  "schema", # python dict schema validation
83
65
  ]
@@ -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",