compone 0.2.0__tar.gz → 0.3.0__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.
- {compone-0.2.0 → compone-0.3.0}/PKG-INFO +1 -1
- {compone-0.2.0 → compone-0.3.0}/compone/escape.py +3 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/component.py +5 -2
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/inline_text.py +3 -4
- {compone-0.2.0 → compone-0.3.0}/compone/utils.py +4 -1
- {compone-0.2.0 → compone-0.3.0}/pyproject.toml +1 -1
- {compone-0.2.0 → compone-0.3.0}/README.md +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/__init__.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/component.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/__init__.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/__init__.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/content_sectioning.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/embedded.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/forms.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/interactive.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/main.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/metadata.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/multimedia.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/other.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/scripting.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/table.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/text_content.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/elements/web_components.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/html/helpers.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/htmx/__init__.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/htmx/config.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/htmx/constants.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/robots/__init__.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/robots/html_meta.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/robots/robots_txt.py +0 -0
- {compone-0.2.0 → compone-0.3.0}/compone/xml.py +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import inspect
|
|
1
2
|
from typing import Any
|
|
2
3
|
|
|
3
4
|
from markupsafe import Markup
|
|
@@ -19,6 +20,8 @@ def escape(s: Any) -> safe:
|
|
|
19
20
|
return s
|
|
20
21
|
elif s is None:
|
|
21
22
|
return safe()
|
|
23
|
+
elif inspect.isclass(s):
|
|
24
|
+
raise ValueError("Cannot escape classes. Instantiate the class first!")
|
|
22
25
|
# We use the __str__ method instead of __html__
|
|
23
26
|
elif hasattr(s, "__str__"):
|
|
24
27
|
s = s.__str__()
|
|
@@ -4,7 +4,6 @@ from typing import TypeVar
|
|
|
4
4
|
|
|
5
5
|
from ..component import CompSelf, _ChildrenBase, _ComponentBase
|
|
6
6
|
from ..escape import escape, safe
|
|
7
|
-
from ..utils import is_iterable
|
|
8
7
|
from .helpers import classes
|
|
9
8
|
|
|
10
9
|
T = TypeVar("T")
|
|
@@ -47,7 +46,11 @@ class _HTMLComponentBase(_ComponentBase):
|
|
|
47
46
|
raise ValueError("Both single and double quotes in attribute value")
|
|
48
47
|
if keyword.iskeyword(no_underscore := key[:-1]):
|
|
49
48
|
key = no_underscore
|
|
50
|
-
|
|
49
|
+
# This is not using is_iterable, because there can be iterable objects
|
|
50
|
+
# which behave like strings, but not subclasses of str.
|
|
51
|
+
# For example gettext_lazy and reverse_lazy in Django, which are proxy objects
|
|
52
|
+
# We aim for the most common case here
|
|
53
|
+
if isinstance(val, (tuple, list)):
|
|
51
54
|
val = " ".join(str(i) for i in val)
|
|
52
55
|
|
|
53
56
|
html_key = escape(key.replace("_", "-"))
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
from
|
|
2
|
-
from ..component import _Elem
|
|
1
|
+
from ..component import _Elem, _SelfElem
|
|
3
2
|
|
|
4
3
|
A = _Elem("a")
|
|
5
4
|
Abbr = _Elem("abbr")
|
|
6
5
|
B = _Elem("b")
|
|
7
6
|
Bdi = _Elem("bdi")
|
|
8
7
|
Bdo = _Elem("bdo")
|
|
9
|
-
Br =
|
|
8
|
+
Br = _SelfElem("<br>")
|
|
10
9
|
Cite = _Elem("cite")
|
|
11
10
|
Code = _Elem("code")
|
|
12
11
|
Data = _Elem("data")
|
|
@@ -31,4 +30,4 @@ Sup = _Elem("sup")
|
|
|
31
30
|
Time = _Elem("time")
|
|
32
31
|
U = _Elem("u")
|
|
33
32
|
Var = _Elem("var")
|
|
34
|
-
Wbr =
|
|
33
|
+
Wbr = _SelfElem("<wbr />")
|
|
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
|