Skip to content

Commit

Permalink
revert rootdir for tags
Browse files Browse the repository at this point in the history
  • Loading branch information
fexofenadine committed Apr 19, 2024
1 parent 4814bbf commit f3a22df
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/update_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def badges2kv(text):
badges = re.findall(testpat, text)
return [("tag", b.split('-')[0].split('.')[0]) for b in badges]

def make_badge(label, prefix='tag', color='lightgrey'):
def make_badge(label, prefix='tag', color='lightgrey', root='.'):
# return f"[![{label}](https://img.shields.io/badge/{prefix}-{label}-{color})](tags/{label}.md){{:target=\"_blank\"}}"
return f'<a href="tags/{label}.html"><img src="https://img.shields.io/badge/{prefix}-{label}-{color}" alt="{label}" /></a>'
return f'<a href="{root}/tags/{label}.html"><img src="https://img.shields.io/badge/{prefix}-{label}-{color}" alt="{label}" /></a>'

def random_hex_colour():
"""generates a string for a random hex color"""
Expand Down Expand Up @@ -125,7 +125,7 @@ def make_badges(unq_tags, sep=' '):
f.write(readme)

# overriding it this way is ugly but whatever
tag_badges_map = {tag_name:make_badge(label=tag_name, color = get_tag_hex_colour(tag_name)) for tag_name in unq_tags}
tag_badges_map = {tag_name:make_badge(label=tag_name, color = get_tag_hex_colour(tag_name), root='..') for tag_name in unq_tags}
def make_badges(unq_tags, sep=' '):
return sep.join([tag_badges_map[tag] for tag in unq_tags])

Expand Down

0 comments on commit f3a22df

Please sign in to comment.