diff options
| author | Asko Nõmm <asko@nmm.ee> | 2025-01-09 21:43:58 +0200 |
|---|---|---|
| committer | Asko Nõmm <asko@nmm.ee> | 2025-01-09 21:43:58 +0200 |
| commit | 4a3208b8c16bf9b3857163f588e68b3ae505cd4b (patch) | |
| tree | 785c5eb94b1823f4f2cd282ff870cce8be8981cb /htmtl/parsers/iterate.py | |
| parent | 0544f795700240e19219521b8b435424fa689a1c (diff) | |
Getting there
Diffstat (limited to 'htmtl/parsers/iterate.py')
| -rw-r--r-- | htmtl/parsers/iterate.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/htmtl/parsers/iterate.py b/htmtl/parsers/iterate.py index a70d026..cc70491 100644 --- a/htmtl/parsers/iterate.py +++ b/htmtl/parsers/iterate.py @@ -1,11 +1,12 @@ from collections.abc import Iterable from typing import Optional -from dompa.nodes.actions import ToHtml +from dompa.nodes.serializers import ToHtml from dompa.nodes import Node, FragmentNode from ..parser import Parser import htmtl + class IterateOp: var: str iter_var_as: Optional[str] @@ -22,11 +23,11 @@ class Iterate(Parser): if "iterate" in node.attributes: replacement_nodes = [] iterate_op = self.__parse_exp(node.attributes["iterate"]) - collection = self.expression(iterate_op.var) + collection = self.parse_expression(iterate_op.var) node.attributes.pop("iterate") if isinstance(collection, Iterable): - data = self.data() + data = self.get_data() for idx, item in enumerate(collection): if iterate_op.iter_var_as: @@ -35,8 +36,8 @@ class Iterate(Parser): if iterate_op.iter_index_as: data[iterate_op.iter_index_as] = idx - template = htmtl.Htmtl(node.action(ToHtml), data) - template_nodes = template.nodes() + template = htmtl.Htmtl(node.serialize(ToHtml), data) + template_nodes = template.get_nodes() if len(template_nodes) > 0: replacement_nodes.append(template_nodes[0]) |
