Skip to content

Commit

Permalink
fixes #548
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed Oct 25, 2024
1 parent 727493b commit 3550ae1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions fasthtml/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def attrmap_x(o):
fh_cfg['attrmap']=attrmap_x
fh_cfg['valmap' ]=valmap
fh_cfg['ft_cls' ]=FT
fh_cfg['auto_id' ]=False
fh_cfg['auto_id']=False
fh_cfg['auto_name']=True

# %% ../nbs/api/01_components.ipynb
def ft_html(tag: str, *c, id=None, cls=None, title=None, style=None, attrmap=None, valmap=None, ft_cls=None, auto_id=None, **kwargs):
Expand All @@ -80,7 +81,7 @@ def ft_html(tag: str, *c, id=None, cls=None, title=None, style=None, attrmap=Non
kwargs['id'] = id.id if isinstance(id,FT) else id
kwargs['cls'],kwargs['title'],kwargs['style'] = cls,title,style
tag,c,kw = ft(tag, *c, attrmap=attrmap, valmap=valmap, **kwargs).list
if tag in named and id and 'name' not in kw: kw['name'] = kw['id']
if fh_cfg['auto_name'] and tag in named and id and 'name' not in kw: kw['name'] = kw['id']
return ft_cls(tag,c,kw, void_=tag in voids)

# %% ../nbs/api/01_components.ipynb
Expand Down
5 changes: 3 additions & 2 deletions nbs/api/01_components.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@
"fh_cfg['attrmap']=attrmap_x\n",
"fh_cfg['valmap' ]=valmap\n",
"fh_cfg['ft_cls' ]=FT\n",
"fh_cfg['auto_id' ]=False"
"fh_cfg['auto_id']=False\n",
"fh_cfg['auto_name']=True"
]
},
{
Expand All @@ -199,7 +200,7 @@
" kwargs['id'] = id.id if isinstance(id,FT) else id\n",
" kwargs['cls'],kwargs['title'],kwargs['style'] = cls,title,style\n",
" tag,c,kw = ft(tag, *c, attrmap=attrmap, valmap=valmap, **kwargs).list\n",
" if tag in named and id and 'name' not in kw: kw['name'] = kw['id']\n",
" if fh_cfg['auto_name'] and tag in named and id and 'name' not in kw: kw['name'] = kw['id']\n",
" return ft_cls(tag,c,kw, void_=tag in voids)"
]
},
Expand Down

0 comments on commit 3550ae1

Please sign in to comment.