sphinxnotes-project 1.0a48__tar.gz → 1.0a50__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 (50) hide show
  1. {sphinxnotes_project-1.0a48/src/sphinxnotes_project.egg-info → sphinxnotes_project-1.0a50}/PKG-INFO +2 -1
  2. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/pyproject.toml +1 -0
  3. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/sphinxnotes_any.py +2 -15
  4. sphinxnotes_project-1.0a50/src/sphinxnotes/project/templates/example.rst +50 -0
  5. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50/src/sphinxnotes_project.egg-info}/PKG-INFO +2 -1
  6. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes_project.egg-info/requires.txt +1 -0
  7. sphinxnotes_project-1.0a48/src/sphinxnotes/project/templates/example.rst +0 -39
  8. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/.cruft.json +0 -0
  9. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/.github/workflows/lint.yml +0 -0
  10. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/.github/workflows/pages.yml +0 -0
  11. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/.github/workflows/pypi.yml +0 -0
  12. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/.github/workflows/release.yml +0 -0
  13. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/.github/workflows/tag.yml +0 -0
  14. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/.github/workflows/test.yml +0 -0
  15. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/.gitignore +0 -0
  16. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/.pre-commit-config.yaml +0 -0
  17. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/AGENTS.md +0 -0
  18. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/LICENSE +0 -0
  19. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/MANIFEST.in +0 -0
  20. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/Makefile +0 -0
  21. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/README.rst +0 -0
  22. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/docs/Makefile +0 -0
  23. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/docs/_images/.gitkeep +0 -0
  24. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/docs/_static/.gitkeep +0 -0
  25. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/docs/_static/custom.css +0 -0
  26. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/docs/_static/sphinx-notes.png +0 -0
  27. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/docs/changelog.rst +0 -0
  28. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/docs/conf.py +0 -0
  29. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/docs/conf.rst +0 -0
  30. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/docs/index.rst +0 -0
  31. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/docs/make.bat +0 -0
  32. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/docs/requirements.txt +0 -0
  33. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/docs/sphinxnotes_any.rst +0 -0
  34. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/ruff.toml +0 -0
  35. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/setup.cfg +0 -0
  36. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/__init__.py +0 -0
  37. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/meta.py +0 -0
  38. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/py.typed +0 -0
  39. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/sphinxnotes_render_ext.py +0 -0
  40. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/templates/autoconfval.rst +0 -0
  41. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/templates/autoobj.rst +0 -0
  42. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/templates/internal-only.rst +0 -0
  43. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/templates/version.rst +0 -0
  44. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/utils/__init__.py +0 -0
  45. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes_project.egg-info/SOURCES.txt +0 -0
  46. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes_project.egg-info/dependency_links.txt +0 -0
  47. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/src/sphinxnotes_project.egg-info/top_level.txt +0 -0
  48. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/tests/__init__.py +0 -0
  49. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/tests/test_always_pass.py +0 -0
  50. {sphinxnotes_project-1.0a48 → sphinxnotes_project-1.0a50}/tests/test_render_ext.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sphinxnotes-project
3
- Version: 1.0a48
3
+ Version: 1.0a50
4
4
  Summary: A Sphinx extension that provides useful directives for creating project documentation
5
5
  Author: Shengyu Zhang
6
6
  Maintainer: Shengyu Zhang
@@ -25,6 +25,7 @@ Description-Content-Type: text/x-rst
25
25
  License-File: LICENSE
26
26
  Requires-Dist: Sphinx>=7.0
27
27
  Requires-Dist: sphinxnotes-any>=3.0b0
28
+ Requires-Dist: sphinxnotes-render
28
29
  Requires-Dist: sphinx_design
29
30
  Provides-Extra: dev
30
31
  Requires-Dist: build; extra == "dev"
@@ -43,6 +43,7 @@ dependencies = [
43
43
 
44
44
  # CUSTOM DEPENDENCIES START
45
45
  "sphinxnotes-any >= 3.0b0",
46
+ "sphinxnotes-render",
46
47
  "sphinx_design",
47
48
  # CUSTOM DEPENDENCIES END
48
49
  ]
@@ -15,7 +15,6 @@ from typing import TYPE_CHECKING
15
15
  from os import path
16
16
 
17
17
  from sphinx.config import ENUM
18
- from sphinx.errors import ConfigError
19
18
 
20
19
  if TYPE_CHECKING:
21
20
  from sphinx.application import Sphinx
@@ -40,14 +39,6 @@ def _read_template_file(name: str) -> str:
40
39
  return open(_get_template_file(name), 'r').read()
41
40
 
42
41
 
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
-
51
42
  ANY_OBJECT_TYPES = {
52
43
  'version': {
53
44
  'schema': {
@@ -77,10 +68,6 @@ ANY_OBJECT_TYPES = {
77
68
 
78
69
 
79
70
  def _config_inited(app: Sphinx, config: Config) -> None:
80
- config.project_example_style = _validate_project_example_style(
81
- config.project_example_style
82
- )
83
-
84
71
  if v := config.any_object_types:
85
72
  v.update(ANY_OBJECT_TYPES)
86
73
  else:
@@ -92,9 +79,9 @@ def setup(app: Sphinx):
92
79
  app.setup_extension('sphinxnotes.any')
93
80
  app.add_config_value(
94
81
  'project_example_style',
95
- 'grid',
82
+ 'split',
96
83
  'env',
97
- types=ENUM('tab', 'grid'),
84
+ types=ENUM('tab', 'grid', 'split', 'stack'),
98
85
  )
99
86
  # Should have priority over sphinxnotes.any's "config-inited" callback.
100
87
  app.connect('config-inited', _config_inited, priority=400)
@@ -0,0 +1,50 @@
1
+ {% macro render_source(content) %}
2
+ .. code:: rst
3
+
4
+ {% for line in content.split('\n') -%}
5
+ {{ line }}
6
+ {% endfor %}
7
+ {% endmacro %}
8
+
9
+ {% macro render_result(content) %}
10
+ {% for line in content.split('\n') -%}
11
+ {{ line }}
12
+ {% endfor %}
13
+ {% endmacro %}
14
+
15
+ {% set _style = style or load_extra('env').config.project_example_style %}
16
+
17
+ {% if _style == 'tab' %}
18
+ .. tab-set::
19
+
20
+ .. tab-item:: Result
21
+
22
+ {{ render_result(content) }}
23
+
24
+ .. tab-item:: Source
25
+
26
+ {{ render_source(content) }}
27
+
28
+ {% elif _style in ['grid', 'split', 'stack'] %}
29
+ .. grid:: {% if _style == 'stack' %}1 1 1 1{% else %}1 1 2 2{% endif %}
30
+ :gutter: 1
31
+ :margin: 0
32
+ :padding: 0
33
+
34
+ .. grid-item-card:: Source
35
+ :margin: 0
36
+
37
+ {{ render_source(content) }}
38
+
39
+ .. grid-item-card:: Result
40
+ :margin: 0
41
+
42
+ {{ render_result(content) }}
43
+
44
+ {% else %}
45
+
46
+ .. error::
47
+
48
+ Unkown example style ``{{ _style }}``.
49
+
50
+ {% endif %}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sphinxnotes-project
3
- Version: 1.0a48
3
+ Version: 1.0a50
4
4
  Summary: A Sphinx extension that provides useful directives for creating project documentation
5
5
  Author: Shengyu Zhang
6
6
  Maintainer: Shengyu Zhang
@@ -25,6 +25,7 @@ Description-Content-Type: text/x-rst
25
25
  License-File: LICENSE
26
26
  Requires-Dist: Sphinx>=7.0
27
27
  Requires-Dist: sphinxnotes-any>=3.0b0
28
+ Requires-Dist: sphinxnotes-render
28
29
  Requires-Dist: sphinx_design
29
30
  Provides-Extra: dev
30
31
  Requires-Dist: build; extra == "dev"
@@ -1,5 +1,6 @@
1
1
  Sphinx>=7.0
2
2
  sphinxnotes-any>=3.0b0
3
+ sphinxnotes-render
3
4
  sphinx_design
4
5
 
5
6
  [dev]
@@ -1,39 +0,0 @@
1
- {% set effective_style = style or load_extra('env').config.project_example_style %}
2
- {% if effective_style == 'tab' %}
3
- .. tab-set::
4
-
5
- .. tab-item:: Result
6
-
7
- {% for line in content.split('\n') -%}
8
- {{ line }}
9
- {% endfor %}
10
-
11
- .. tab-item:: Source
12
-
13
- .. code:: rst
14
-
15
- {% for line in content.split('\n') -%}
16
- {{ line }}
17
- {% endfor %}
18
- {% elif effective_style == 'grid' %}
19
- .. grid:: 1 1 2 2
20
- :gutter: 1
21
- :margin: 0
22
- :padding: 0
23
-
24
- .. grid-item-card:: Source
25
- :margin: 0
26
-
27
- .. code:: rst
28
-
29
- {% for line in content.split('\n') -%}
30
- {{ line }}
31
- {% endfor %}
32
-
33
- .. grid-item-card:: Result
34
- :margin: 0
35
-
36
- {% for line in content.split('\n') -%}
37
- {{ line }}
38
- {% endfor %}
39
- {% endif %}