Skip to content

Commit

Permalink
fix template icons without <I></I>
Browse files Browse the repository at this point in the history
  • Loading branch information
joBr99 committed Nov 24, 2023
1 parent e846ac4 commit 2944044
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def render(self, cardType=""):

if self.icon_overwrite and self.icon_overwrite.startswith("ha:"):
#icon_char = libs.home_assistant.render_template(self.icon_overwrite[3:])
self.icon_overwrite = ha_template.render(self.icon_overwrite[3:])
self.icon_overwrite = ha_template.render(self.icon_overwrite)

if self.etype in ["delete", "navigate", "iText"]:
out = super().render()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6904,16 +6904,14 @@
def get_icon_id(ma_name):
if isinstance(ma_name, re.Match):
ma_name = ma_name.group(0).replace('<I>', '').replace('</I>', '')
print(f"testxxxx {ma_name}")

if "text:" in ma_name:
return ma_name.replace("text:", "")
if "<I>" in ma_name and "</I>" in ma_name:
print(f"testdddd {ma_name}")
if isinstance(ma_name, str):
ma_name = re.sub(r'<I>.+?<\/I>', get_icon_id, ma_name)
print(f"test123d {ma_name}")
return ma_name
if "ha:" in ma_name:
if "<I>" in ma_name and "</I>" in ma_name:
if isinstance(ma_name, str):
ma_name = re.sub(r'<I>.+?<\/I>', get_icon_id, ma_name)
return ma_name.replace("ha:", "")

ma_name = ma_name.replace("mdi:", "")
if ma_name in icons:
Expand Down

0 comments on commit 2944044

Please sign in to comment.