mirror of
https://github.com/MunGell/awesome-for-beginners.git
synced 2026-01-24 12:28:08 -08:00
WIP: Added new script for building the README
This uses jinja templating to do so. The script is made to exactly copy the behaviour of the current script as now, to prove that it does the same thing.
This commit is contained in:
31
.github/README.j2
vendored
Normal file
31
.github/README.j2
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Awesome First PR Opportunities [](https://github.com/sindresorhus/awesome)
|
||||||
|
|
||||||
|
Inspired by [First Timers Only](https://kentcdodds.com/blog/first-timers-only) blog post.
|
||||||
|
|
||||||
|
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 %}
|
||||||
|
{% for category in categories %}
|
||||||
|
## {{ category.title }}
|
||||||
|
{% for entry in category.entries %}
|
||||||
|
- [{{ entry.name }}]({{ entry.link }}) _(label: {% if entry.label is defined %}{{ entry.label }}{% else %}n/a{% endif %})_ <br> {{ entry.description }}{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
## Contribute
|
||||||
|
|
||||||
|
Contributions are welcome! See the [contributing guidelines](CONTRIBUTING.md).
|
||||||
|
|
||||||
|
## Thanks to GitHub Sponsors
|
||||||
|
|
||||||
|
<table>{% for sponsor in sponsors %}<tr><td align="center"><a href="{{ sponsor.link }}"><img src="{{ sponsor.image }}" width="60px;" alt=""/><br/><sub><b>{{ sponsor.name }}</b></sub></a></td></tr>{% endfor %}</table>
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[](http://creativecommons.org/publicdomain/zero/1.0/)
|
||||||
|
|
||||||
|
To the extent possible under law, the author has waived all copyrights and related or neighboring rights to this work.
|
||||||
|
|
||||||
35
.github/scripts/render-readme.py
vendored
Normal file
35
.github/scripts/render-readme.py
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
import json
|
||||||
|
|
||||||
|
technologies = {}
|
||||||
|
|
||||||
|
with open("../../data.json", 'r') as datafile:
|
||||||
|
data = json.loads(datafile.read())
|
||||||
|
|
||||||
|
for technology in data["technologies"]:
|
||||||
|
technologies[technology] = {"link_id": data["technologies"][technology], "entries": []}
|
||||||
|
|
||||||
|
for repository in data["repositories"]:
|
||||||
|
repo_technologies = repository["technologies"]
|
||||||
|
for repo_technology in repo_technologies:
|
||||||
|
if not technologies.get(repo_technology, False):
|
||||||
|
technologies[repo_technology] = {"link_id": repo_technology.lower(), "entries": []}
|
||||||
|
technologies[repo_technology]["entries"].append(repository)
|
||||||
|
|
||||||
|
env = Environment(loader = FileSystemLoader(".."))
|
||||||
|
|
||||||
|
template = env.get_template("README.j2")
|
||||||
|
|
||||||
|
categories = []
|
||||||
|
for key, value in zip(technologies.keys(), technologies.values()):
|
||||||
|
categories.append({"title": key, "link_id": value["link_id"], "entries": value["entries"]})
|
||||||
|
|
||||||
|
categories = sorted(categories, key=lambda x: x["title"].upper())
|
||||||
|
for category in categories:
|
||||||
|
category["entries"] = sorted(category["entries"], key=lambda x: x["name"].upper())
|
||||||
|
|
||||||
|
sponsors = data["sponsors"]
|
||||||
|
|
||||||
|
output = template.render(categories=categories, sponsors=sponsors)
|
||||||
|
|
||||||
|
open("README.md", "w").write(output)
|
||||||
Reference in New Issue
Block a user