tools/common (template): add id argument to _icon_use
This commit is contained in:
parent
33b5bb63b7
commit
620f89f589
1 changed files with 10 additions and 3 deletions
|
|
@ -955,11 +955,18 @@ class Renderer(object):
|
|||
defs_elt.append(icon_svg_elt)
|
||||
return safe(etree.tostring(svg_elt, encoding="unicode"))
|
||||
|
||||
def _icon_use(self, name, cls=""):
|
||||
return safe('<svg class="svg-icon{cls}" xmlns="http://www.w3.org/2000/svg" '
|
||||
def _icon_use(self, name, cls="", id=""):
|
||||
if id:
|
||||
id = id.replace('"', '_')
|
||||
return safe('<svg class="svg-icon{cls}"{id} xmlns="http://www.w3.org/2000/svg" '
|
||||
'viewBox="0 0 100 100">\n'
|
||||
' <use href="#{name}"/>'
|
||||
'</svg>\n'.format(name=name, cls=(" " + cls) if cls else ""))
|
||||
'</svg>\n'.format(
|
||||
name=name,
|
||||
cls=(" " + cls) if cls else "",
|
||||
id=f' id="{id}"' if id else ""
|
||||
)
|
||||
)
|
||||
|
||||
def _icon_from_client(self, client):
|
||||
"""Get icon name to represent a disco client"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue