Skip to content

Commit

Permalink
Merge pull request #1533 from MunGell/readme-improvements
Browse files Browse the repository at this point in the history
Improvements to the README file template including to the table of contents
  • Loading branch information
sammyhori authored Dec 13, 2024
2 parents 11e6aac + 2a94ab4 commit f24d304
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
15 changes: 8 additions & 7 deletions .github/README-template.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- DO NOT EDIT THIS FILE (README.md) -->
<!-- ALL ENTRIES SHOULD BE IN TO THE data.json -->
<!-- SEE THE CONTRIBUTING GUIDE (CONTRIBUTING.md) FOR MORE GUIDANCE -->
<!-- YOU MAY IGNORE THIS MESSAGE IF YOU ARE EDITING THE TEMPLATE -->
<!-- DO NOT EDIT THIS FILE (`README.md`) -->
<!-- ALL ENTRIES SHOULD BE ADDED TO AND REMOVED FROM `data.json` -->
<!-- SEE THE CONTRIBUTING GUIDE (`CONTRIBUTING.md`) FOR MORE GUIDANCE -->
<!-- YOU MAY IGNORE THIS MESSAGE IF YOU ARE EDITING `README-template.j2` -->

# Awesome First PR Opportunities [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)

Expand All @@ -10,10 +10,11 @@ Inspired by [First Timers Only](https://kentcdodds.com/blog/first-timers-only) b
If you are a maintainer of open-source projects, add the label `first-timers-only` (or similar) to your project and list it here so that people can find it.

If you are not a programmer but would like to contribute, check out the [Awesome for non-programmers](https://github.com/szabgab/awesome-for-non-programmers) list.

## Table of Contents:
{% for category in categories %}
- [{{ category.title }}](#{{ category.link_id }}){% endfor %}

||Languages|
|--|--|{% for category_group, categories in category_groups.items() %}
|{{ category_group }}|{% for category in categories %}[{{ category.title }}](#{{ category.link_id }}){% if loop.index < (categories | length) %}, {% endif %}{% endfor %}|{% endfor %}
{% for category in categories %}
## {{ category.title }}
{% for entry in category.entries %}
Expand Down
12 changes: 9 additions & 3 deletions .github/scripts/render-readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
TEMPLATEFILE = "README-template.j2"
TARGETFILE = "./README.md"


def new_technology_dict(repo_technology):
return {"link_id": repo_technology.lower(), "entries": []}


technologies = {}

with open(DATAFILE, "r") as datafile:
Expand Down Expand Up @@ -39,11 +37,19 @@ def new_technology_dict(repo_technology):
)

categories = sorted(categories, key=lambda x: x["title"].upper())
category_groups = {"Misc": []}
for category in categories:
category["entries"] = sorted(category["entries"], key=lambda x: x["name"].upper())
first_char = category["title"][0].upper()
if first_char in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
if first_char not in category_groups:
category_groups[first_char] = []
category_groups[first_char].append(category)
else:
category_groups["Misc"].append(category)

sponsors = data["sponsors"]

output = template.render(categories=categories, sponsors=sponsors)
output = template.render(category_groups=category_groups, categories=categories, sponsors=sponsors)

open(TARGETFILE, "w").write(output)

0 comments on commit f24d304

Please sign in to comment.