xcomponent 0.6.6__tar.gz → 0.6.7__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.
- {xcomponent-0.6.6 → xcomponent-0.6.7}/CHANGELOG.md +4 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/Cargo.lock +1 -1
- {xcomponent-0.6.6 → xcomponent-0.6.7}/Cargo.toml +1 -1
- {xcomponent-0.6.6 → xcomponent-0.6.7}/PKG-INFO +5 -5
- {xcomponent-0.6.6 → xcomponent-0.6.7}/README.md +3 -3
- {xcomponent-0.6.6 → xcomponent-0.6.7}/docs/source/user/getting_started.md +9 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/pyproject.toml +2 -2
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/expression/ast/eval.rs +1 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_binary_eq.py +2 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/uv.lock +1 -1
- {xcomponent-0.6.6 → xcomponent-0.6.7}/.github/workflows/build-sdist.yml +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/.github/workflows/build-wheels.yml +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/.github/workflows/publish-doc.yml +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/.github/workflows/publish-pypi.yml +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/.github/workflows/release.yml +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/.github/workflows/tests-artifacts.yml +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/.github/workflows/tests.yml +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/.gitignore +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/.python-version +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/Justfile +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/LICENSE +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/docs/Makefile +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/docs/source/conf.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/docs/source/develop/.gitkeep +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/docs/source/index.md +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/docs/source/user/changelog.md +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/scripts/get_version.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/scripts/write_changelog.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/python/xcomponent/__init__.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/python/xcomponent/py.typed +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/python/xcomponent/service/__init__.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/python/xcomponent/service/catalog.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/python/xcomponent/xcore.pyi +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/catalog/catalog.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/catalog/mod.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/context.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/expression/ast/mod.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/expression/ast/model.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/expression/ast/parse.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/expression/grammar.pest +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/expression/mod.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/expression/parser.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/expression/tokens.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/lib.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/markup/grammar.pest +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/markup/mod.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/markup/parser.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/src/rust/markup/tokens.rs +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/__init__.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/__init__.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/conftest.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_binary_op.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_binary_op_bool.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_default_values.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_field_access.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_for_expr.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_func.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_if_expr.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_let.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_nested.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_render_comment.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_script.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_str_method.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_types.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/expression/test_unary.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/test_core.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/test_named_component.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/test_render_attributes.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/test_render_context.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/test_render_globals.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/test_render_globals_obj.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/test_render_globals_obj2.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/test_render_nested_dict.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/test_render_nested_node.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/test_render_node.py +0 -0
- {xcomponent-0.6.6 → xcomponent-0.6.7}/tests/unittests/test_render_script.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xcomponent
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.7
|
|
4
4
|
Classifier: License :: OSI Approved :: MIT License
|
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
|
6
6
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -19,7 +19,7 @@ Requires-Dist: sphinx>=8.0.0,<9 ; extra == 'docs'
|
|
|
19
19
|
Requires-Dist: sphinx-autodoc2>=0.5.0,<1 ; extra == 'docs'
|
|
20
20
|
Provides-Extra: docs
|
|
21
21
|
License-File: LICENSE
|
|
22
|
-
Summary:
|
|
22
|
+
Summary: An embeded component base template engine - inspired by JSX
|
|
23
23
|
Author-email: Guillaume Gauvrit <guillaume@gauvr.it>
|
|
24
24
|
License: MIT
|
|
25
25
|
Requires-Python: >=3.11
|
|
@@ -37,7 +37,7 @@ Project-URL: Changelog, https://mardiros.github.io/xcomponent/user/changelog.htm
|
|
|
37
37
|
XComponent is a template engine, inspired by JSX, to embed template in Python.
|
|
38
38
|
|
|
39
39
|
It diverge from all existing Python template engine since all the templates
|
|
40
|
-
must be written
|
|
40
|
+
must be written inside the Python code.
|
|
41
41
|
|
|
42
42
|
This is a design decision and a matter of preference for the locality of behavior.
|
|
43
43
|
|
|
@@ -68,11 +68,11 @@ catalog.render("<HelloWorld name='Bob'/>")
|
|
|
68
68
|
Using XComponent, templates are stored in a catalog of components, and then
|
|
69
69
|
they can be rendered to HTML.
|
|
70
70
|
|
|
71
|
-
All components can be reused in other
|
|
71
|
+
All components can be reused in other components in order to build an HTML document
|
|
72
72
|
at the end.
|
|
73
73
|
|
|
74
74
|
Using curly brace let's have a friendly expression language, inspired by Python,
|
|
75
|
-
JSX and
|
|
75
|
+
JSX and Rust.
|
|
76
76
|
|
|
77
77
|
[Getting started ?](https://mardiros.github.io/xcomponent/)
|
|
78
78
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
XComponent is a template engine, inspired by JSX, to embed template in Python.
|
|
6
6
|
|
|
7
7
|
It diverge from all existing Python template engine since all the templates
|
|
8
|
-
must be written
|
|
8
|
+
must be written inside the Python code.
|
|
9
9
|
|
|
10
10
|
This is a design decision and a matter of preference for the locality of behavior.
|
|
11
11
|
|
|
@@ -36,10 +36,10 @@ catalog.render("<HelloWorld name='Bob'/>")
|
|
|
36
36
|
Using XComponent, templates are stored in a catalog of components, and then
|
|
37
37
|
they can be rendered to HTML.
|
|
38
38
|
|
|
39
|
-
All components can be reused in other
|
|
39
|
+
All components can be reused in other components in order to build an HTML document
|
|
40
40
|
at the end.
|
|
41
41
|
|
|
42
42
|
Using curly brace let's have a friendly expression language, inspired by Python,
|
|
43
|
-
JSX and
|
|
43
|
+
JSX and Rust.
|
|
44
44
|
|
|
45
45
|
[Getting started ?](https://mardiros.github.io/xcomponent/)
|
|
@@ -236,6 +236,15 @@ A good alternative would be to use **a type with dataclasses or pydantic for the
|
|
|
236
236
|
globals**, ensuring all declared fields have an appropriate default value and
|
|
237
237
|
proper documentation.
|
|
238
238
|
|
|
239
|
+
### Using scripts and style
|
|
240
|
+
|
|
241
|
+
HTML tags `<script>` and `<style>` have a special rendering in xcomponent;
|
|
242
|
+
**they can't contains any variable or expression**.
|
|
243
|
+
Says differently, it is not possible to generate a javascript function within
|
|
244
|
+
a XComponent expression. **The content of the `<script>` and `<style>` markup
|
|
245
|
+
tag is copied from the template at rendering, not interpreted**.
|
|
246
|
+
|
|
247
|
+
|
|
239
248
|
## XComponent Expression
|
|
240
249
|
|
|
241
250
|
Everything in the Markup that has been enclosed by curly braces is an expression.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "xcomponent"
|
|
3
|
-
version = "0.6.
|
|
4
|
-
description = "
|
|
3
|
+
version = "0.6.7"
|
|
4
|
+
description = "An embeded component base template engine - inspired by JSX"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{ name = "Guillaume Gauvrit", email = "guillaume@gauvr.it" }]
|
|
7
7
|
license = { text = "MIT" }
|
|
@@ -123,6 +123,7 @@ fn eval_raw_eq(l: Literal, r: Literal, op: String) -> PyResult<bool> {
|
|
|
123
123
|
(Literal::Bool(a), Literal::Int(b)) => Ok(a as isize == b),
|
|
124
124
|
(Literal::Bool(a), Literal::Bool(b)) => Ok(a == b),
|
|
125
125
|
(Literal::Str(a), Literal::Str(b)) => Ok(a == b),
|
|
126
|
+
(Literal::None(()), Literal::None(())) => Ok(true),
|
|
126
127
|
(Literal::None(()), _) => Ok(false),
|
|
127
128
|
(_, Literal::None(())) => Ok(false),
|
|
128
129
|
(a, b) => Err(PyErr::new::<pyo3::exceptions::PyTypeError, _>(format!(
|
|
@@ -51,6 +51,7 @@ def Lte(a: int | bool | str, b: int | bool | str) -> str:
|
|
|
51
51
|
pytest.param(Eq("1", "2"), "false", id="str-false"),
|
|
52
52
|
pytest.param(Eq("1", "1"), "true", id="str-true"),
|
|
53
53
|
pytest.param(Eq("", None), "false", id="str-None"),
|
|
54
|
+
pytest.param(Eq(None, None), "true", id="None-None"),
|
|
54
55
|
],
|
|
55
56
|
)
|
|
56
57
|
def test_eq(component: str, expected: str):
|
|
@@ -73,6 +74,7 @@ def test_eq(component: str, expected: str):
|
|
|
73
74
|
pytest.param(Neq("1", "2"), "true", id="str-true"),
|
|
74
75
|
pytest.param(Neq("1", "1"), "false", id="str-false"),
|
|
75
76
|
pytest.param(Neq("1", None), "true", id="str-None"),
|
|
77
|
+
pytest.param(Neq(None, None), "false", id="None-None"),
|
|
76
78
|
],
|
|
77
79
|
)
|
|
78
80
|
def test_neq(component: str, expected: str):
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|