Working on improving the perf

This commit is contained in:
2025-08-10 17:42:54 +02:00
parent 5820efb7f1
commit 67abb45804
12 changed files with 142 additions and 69 deletions

View File

@@ -26,12 +26,12 @@ def to_html(item):
class MyFt:
def __init__(self, name, *args, **kwargs):
self.name = name
self.args = args
self.kwargs = kwargs
self.children = args
self.attrs = kwargs
def to_html(self):
body_items = [to_html(item) for item in self.args]
return f"<{self.name} {' '.join(f'{attr_map.get(k, k)}="{v}"' for k, v in self.kwargs.items())}>{' '.join(body_items)}</div>"
body_items = [to_html(item) for item in self.children]
return f"<{self.name} {' '.join(f'{attr_map.get(k, k)}="{v}"' for k, v in self.attrs.items())}>{' '.join(body_items)}</div>"
def __ft__(self):
return NotStr(self.to_html())