# HG changeset patch # User Goffi # Date 1744388330 -7200 # Node ID e22a5d80be02558cd370564e678df3ccf87d3959 # Parent 382dc6e62b6eab5f8dc7c3f5540384e73e805040 template: fix name handling for icons. diff -r 382dc6e62b6e -r e22a5d80be02 libervia/backend/tools/common/template.py --- a/libervia/backend/tools/common/template.py Fri Feb 28 09:23:35 2025 +0100 +++ b/libervia/backend/tools/common/template.py Fri Apr 11 18:18:50 2025 +0200 @@ -1012,13 +1012,15 @@ if "/" in name: raise ValueError("SVG name must not have a `/` in it.") if name.startswith("regular "): - name = name[8:] - path = self.fa_svgs_path / f"regular/{name}.svg" + filename = name[8:] + path = self.fa_svgs_path / f"regular/{filename}.svg" else: if name.startswith("solid "): # "solid" can be explicitely specified, and it's the default value. - name = name[6:] - path = self.fa_svgs_path / f"solid/{name}.svg" + filename = name[6:] + else: + filename = name + path = self.fa_svgs_path / f"solid/{filename}.svg" # Parse the source SVG try: @@ -1038,7 +1040,7 @@ symbol = etree.SubElement( defs_elt, "symbol", - id=name, + id=name.replace(" ", "_"), viewBox=viewbox, ) @@ -1060,7 +1062,7 @@ 'width="1em" height="1em" fill="currentColor" >\n' ' ' "\n".format( - name=name, + name=name.replace(" ", "_"), cls=(" " + cls) if cls else "", extra_attrs=" " + extra_attrs if extra_attrs else "", )