sphinxnotes-project 1.0a49__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.
- {sphinxnotes_project-1.0a49/src/sphinxnotes_project.egg-info → sphinxnotes_project-1.0a50}/PKG-INFO +1 -1
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/sphinxnotes_any.py +2 -15
- sphinxnotes_project-1.0a50/src/sphinxnotes/project/templates/example.rst +50 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50/src/sphinxnotes_project.egg-info}/PKG-INFO +1 -1
- sphinxnotes_project-1.0a49/src/sphinxnotes/project/templates/example.rst +0 -39
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/.cruft.json +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/.github/workflows/lint.yml +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/.github/workflows/pages.yml +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/.github/workflows/pypi.yml +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/.github/workflows/release.yml +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/.github/workflows/tag.yml +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/.github/workflows/test.yml +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/.gitignore +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/.pre-commit-config.yaml +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/AGENTS.md +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/LICENSE +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/MANIFEST.in +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/Makefile +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/README.rst +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/docs/Makefile +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/docs/_images/.gitkeep +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/docs/_static/.gitkeep +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/docs/_static/custom.css +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/docs/_static/sphinx-notes.png +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/docs/changelog.rst +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/docs/conf.py +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/docs/conf.rst +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/docs/index.rst +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/docs/make.bat +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/docs/requirements.txt +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/docs/sphinxnotes_any.rst +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/pyproject.toml +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/ruff.toml +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/setup.cfg +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/__init__.py +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/meta.py +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/py.typed +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/sphinxnotes_render_ext.py +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/templates/autoconfval.rst +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/templates/autoobj.rst +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/templates/internal-only.rst +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/templates/version.rst +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/utils/__init__.py +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes_project.egg-info/SOURCES.txt +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes_project.egg-info/dependency_links.txt +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes_project.egg-info/requires.txt +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes_project.egg-info/top_level.txt +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/tests/__init__.py +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/tests/test_always_pass.py +0 -0
- {sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/tests/test_render_ext.py +0 -0
{sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/sphinxnotes_any.py
RENAMED
|
@@ -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
|
-
'
|
|
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,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 %}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sphinxnotes_project-1.0a49 → sphinxnotes_project-1.0a50}/src/sphinxnotes/project/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|