You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you're reporting a bug, please continue with this template.
Describe the bug
Creating Svg object with the argument "xmlns" will cause TypeError: fasthtml.svg.ft_svg() got multiple values for keyword argument 'xmlns'.
I believe it would be a very common practice to convert svg code to Svg object by using the html2ft tool, which often contains the property xmlns='http://www.w3.org/2000/svg'. In the lastest version of the source code svg.py, this argument is passed through **kwargs. It will cause an argument conflict in line 39 ft_svg('svg', *args, xmlns="http://www.w3.org/2000/svg", viewBox=viewBox, height=height, width=width, **kwargs), since xmlns is explictly given.
This is of course not really a bug, but it would be much convenient to provide an argument check, so a common user don't have to remove this property every time converting a html code to Svg object.
code suggestion
# svg.py line 34
def Svg(*args, viewBox=None, h=None, w=None, height=None, width=None, **kwargs):
"An SVG tag; xmlns is added automatically, and viewBox defaults to height and width if not provided"
if h: height=h
if w: width=w
if not viewBox and height and width: viewBox=f'0 0 {width} {height}'
if "xmlns" not in kwargs: kwargs["xmlns"]="http://www.w3.org/2000/svg"
return ft_svg('svg', *args, viewBox=viewBox, height=height, width=width, **kwargs)
Minimal Reproducible Example
Provide a minimal code snippet that reproduces the issue. This is crucial for us to understand and fix the bug quickly.
Important Notice
We do not provide support through GitHub issues. For community-based help, please use either:
If you're reporting a bug, please continue with this template.
Describe the bug
Creating Svg object with the argument "xmlns" will cause TypeError: fasthtml.svg.ft_svg() got multiple values for keyword argument 'xmlns'.
I believe it would be a very common practice to convert svg code to Svg object by using the html2ft tool, which often contains the property
xmlns='http://www.w3.org/2000/svg'
. In the lastest version of the source code svg.py, this argument is passed through **kwargs. It will cause an argument conflict in line 39ft_svg('svg', *args, xmlns="http://www.w3.org/2000/svg", viewBox=viewBox, height=height, width=width, **kwargs)
, sincexmlns
is explictly given.This is of course not really a bug, but it would be much convenient to provide an argument check, so a common user don't have to remove this property every time converting a html code to Svg object.
code suggestion
Minimal Reproducible Example
Provide a minimal code snippet that reproduces the issue. This is crucial for us to understand and fix the bug quickly.
output
Expected behavior
A clear and concise description of what you expected to happen.
Environment Information
Please provide the following version information:
Confirmation
Please confirm the following:
Additional context
Add any other context about the problem here.
Screenshots
If applicable, add screenshots to help explain your problem.
The text was updated successfully, but these errors were encountered: