Skip to content

Commit

Permalink
use tags
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Feb 27, 2022
1 parent 7a8637e commit ffada8e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions script/generate_default_repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
title: "{name}"
description: "{description}"
custom_edit_url: null
tags: {tags}
---
<!-- The content of this file is autogenerated during build with script/generate_default_repositories.py -->
Expand Down Expand Up @@ -147,14 +148,20 @@ def gen_brands_icon(entry):
except:
pass

REPOSITORY_CONTENT = REPOSITORY_BASE.format(id=repository_id, name=name, description=description)
tags = entry["topics"] or []
if entry["category"] not in tags:
tags.append(entry["category"])
for tag in list(tags):
for item in ("hacs", "home", "hass", "hassio", "hasso", "custom"):
if item in tag.lower() and tag in tags:
tags.remove(tag)
if tag == "ha" and tag in tags:
tags.remove(tag)

REPOSITORY_CONTENT = REPOSITORY_BASE.format(id=repository_id, name=name, description=description, tags=tags)
REPOSITORY_CONTENT += f"<div style={{{{display: 'flex', marginBottom: 4, alignItems: 'center'}}}}>\n {gen_brands_icon(entry)} \n<i>{description}</i>\n</div>\n"
REPOSITORY_CONTENT += gen_authors(entry["authors"] or [entry['full_name'].split("/")[0]])
REPOSITORY_CONTENT += f"<p style={{{{marginBottom: 0}}}}>\nRepository: <a href='/{entry['full_name']}' target='_blank'>{entry['full_name']}</a>\n</p>\n"
if entry["topics"]:
REPOSITORY_CONTENT += f"<p>Topics: \n{''.join(f'<li style={{{{marginLeft: 24}}}}>{topic}</li>' for topic in entry['topics'])}</p>\n"


REPOSITORY_CONTENT += "<br /><br /><br />"
REPOSITORY_CONTENT += NOTES.get(category)

Expand Down

0 comments on commit ffada8e

Please sign in to comment.