From 73addc9490ddec30d5194b0f167d6975bc8065a9 Mon Sep 17 00:00:00 2001 From: Jack Hogan Date: Wed, 1 Jul 2026 12:32:01 +0100 Subject: [PATCH] convert CamelCase tags to kebab-case --- fasthtml/components.py | 2 +- nbs/api/01_components.ipynb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fasthtml/components.py b/fasthtml/components.py index d952dce8..3b0864f8 100644 --- a/fasthtml/components.py +++ b/fasthtml/components.py @@ -197,7 +197,7 @@ def find_inputs(e, tags='input', **kw): # %% ../nbs/api/01_components.ipynb #1d8a28b1 def __getattr__(tag): if tag.startswith('_') or tag[0].islower(): raise AttributeError - tag = tag.replace("_", "-") + tag = re.sub(r'(?<=[a-z0-9])(?=[A-Z])', '-', tag.replace("_", "-")).lower() def _f(*c, target_id=None, **kwargs): return ft_hx(tag, *c, target_id=target_id, **kwargs) return _f diff --git a/nbs/api/01_components.ipynb b/nbs/api/01_components.ipynb index 449b6a58..dc22427c 100644 --- a/nbs/api/01_components.ipynb +++ b/nbs/api/01_components.ipynb @@ -1146,7 +1146,7 @@ "#| export\n", "def __getattr__(tag):\n", " if tag.startswith('_') or tag[0].islower(): raise AttributeError\n", - " tag = tag.replace(\"_\", \"-\")\n", + " tag = re.sub(r'(?<=[a-z0-9])(?=[A-Z])', '-', tag.replace(\"_\", \"-\")).lower()\n", " def _f(*c, target_id=None, **kwargs): return ft_hx(tag, *c, target_id=target_id, **kwargs)\n", " return _f" ]