Improving lazing loading. The scrollbars updates itself

This commit is contained in:
2025-08-22 00:09:59 +02:00
parent 9cf0e5e26a
commit 2c5fe004f5
5 changed files with 255 additions and 17 deletions

View File

@@ -7,6 +7,9 @@ attr_map = {
"_id": "id",
}
def safe_attr(attr_name):
attr_name = attr_name.replace("hx_", "hx-")
return attr_map.get(attr_name, attr_name)
def to_html(item):
if item is None:
@@ -31,7 +34,7 @@ class MyFt:
def to_html(self):
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>"
return f"<{self.name} {' '.join(f'{safe_attr(k)}="{v}"' for k, v in self.attrs.items())}>{' '.join(body_items)}</div>"
def __ft__(self):
return NotStr(self.to_html())