python-fragments 0.20__tar.gz → 0.22__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.
- {python_fragments-0.20 → python_fragments-0.22}/PKG-INFO +1 -1
- {python_fragments-0.20 → python_fragments-0.22}/fragments/grammar.py +1 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/html/elements.py +23 -6
- {python_fragments-0.20 → python_fragments-0.22}/pyproject.toml +1 -1
- {python_fragments-0.20 → python_fragments-0.22}/python_fragments.egg-info/PKG-INFO +1 -1
- {python_fragments-0.20 → python_fragments-0.22}/README.md +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/__init__.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/ast_nodes.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/cli.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/html/__init__.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/loader.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/__init__.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/based_proxy.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/__init__.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/code_actions.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/completion.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/definition.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/diagnostics.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/document_highlight.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/document_symbols.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/folding_range.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/hover.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/inlay_hints.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/lifecycle.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/references.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/rename.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/semantic_tokens.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/signature_help.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/file_state.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/message_queue.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/pyright_notification_handlers/__init__.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/pyright_notification_handlers/capability.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/pyright_notification_handlers/configuration.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/pyright_notification_handlers/diagnostics.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/types.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/source.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/transpiler.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/fragments/types.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/python_fragments.egg-info/SOURCES.txt +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/python_fragments.egg-info/dependency_links.txt +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/python_fragments.egg-info/entry_points.txt +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/python_fragments.egg-info/requires.txt +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/python_fragments.egg-info/top_level.txt +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/setup.cfg +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/tests/test_grammar.py +0 -0
- {python_fragments-0.20 → python_fragments-0.22}/tests/test_source_map.py +0 -0
|
@@ -20,6 +20,7 @@ from fragments.source import Source
|
|
|
20
20
|
HTML_IDENTIFIER = r"[a-zA-Z][a-zA-Z0-9_:.-]*"
|
|
21
21
|
HTML_ATTRIBUTE_NAME = r"[a-zA-Z:-_][a-zA-Z0-9_:.-]*"
|
|
22
22
|
HTML_TEXT = r"([\s\S]*?)(?=<|{{)"
|
|
23
|
+
CHILDREN_META_COMPONENT = r"<[\S]*Children\.\.\.[\S]*/>"
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
class ParsingError(Exception):
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import json
|
|
1
2
|
from typing import Any
|
|
2
3
|
from fragments.types import Children
|
|
3
4
|
|
|
@@ -14,7 +15,7 @@ def el(
|
|
|
14
15
|
) -> str:
|
|
15
16
|
tag_contents = [
|
|
16
17
|
name,
|
|
17
|
-
|
|
18
|
+
className_to_string(attributes.pop("className")) if "className" in attributes else None,
|
|
18
19
|
style_to_string(attributes.pop("style")) if "style" in attributes else None,
|
|
19
20
|
attributes_to_string(attributes) if attributes is not None else None,
|
|
20
21
|
]
|
|
@@ -34,14 +35,30 @@ def comment(content: str) -> str:
|
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
def attributes_to_string(attributes: dict[str, Any]) -> str:
|
|
37
|
-
return " ".join(
|
|
38
|
+
return " ".join(attribute_to_string(name, value) for name, value in attributes.items())
|
|
38
39
|
|
|
39
40
|
|
|
40
|
-
def
|
|
41
|
-
if
|
|
42
|
-
|
|
41
|
+
def attribute_to_string(name: str, value: Any) -> str:
|
|
42
|
+
if value is None:
|
|
43
|
+
return name
|
|
44
|
+
|
|
45
|
+
if isinstance(value, tuple):
|
|
46
|
+
value = list(value)
|
|
47
|
+
|
|
48
|
+
if isinstance(value, dict) or isinstance(value, list):
|
|
49
|
+
value = json.dumps(value)
|
|
50
|
+
|
|
51
|
+
if isinstance(value, bool):
|
|
52
|
+
value = str(value).lower()
|
|
53
|
+
|
|
54
|
+
return f'{name}="{value}"'
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def className_to_string(contents: list[str] | str) -> str:
|
|
58
|
+
if isinstance(contents, list):
|
|
59
|
+
inner = " ".join(contents)
|
|
43
60
|
else:
|
|
44
|
-
inner =
|
|
61
|
+
inner = contents
|
|
45
62
|
|
|
46
63
|
return f'class="{inner}"'
|
|
47
64
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python-fragments"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.22"
|
|
8
8
|
description = "Modern HTML template rendering in Python"
|
|
9
9
|
authors = [{ name = "The Running Algorithm", email = "services@therunningalgorithm.info" }]
|
|
10
10
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/completion.py
RENAMED
|
File without changes
|
{python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/definition.py
RENAMED
|
File without changes
|
{python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/diagnostics.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/hover.py
RENAMED
|
File without changes
|
{python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/inlay_hints.py
RENAMED
|
File without changes
|
{python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/lifecycle.py
RENAMED
|
File without changes
|
{python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/references.py
RENAMED
|
File without changes
|
{python_fragments-0.20 → python_fragments-0.22}/fragments/lsp/client_message_handlers/rename.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_fragments-0.20 → python_fragments-0.22}/python_fragments.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|