mirror of
https://github.com/MunGell/awesome-for-beginners.git
synced 2026-01-25 12:58:17 -08:00
Cleaning code a little by putting some in a method
This commit is contained in:
6
.github/scripts/render-readme.py
vendored
6
.github/scripts/render-readme.py
vendored
@@ -6,6 +6,9 @@ TEMPLATEPATH = "./.github/"
|
|||||||
TEMPLATEFILE = "README-template.j2"
|
TEMPLATEFILE = "README-template.j2"
|
||||||
TARGETFILE = "./README.md"
|
TARGETFILE = "./README.md"
|
||||||
|
|
||||||
|
def new_technology_dict(repo_technology):
|
||||||
|
return {"link_id": repo_technology.lower(), "entries": []}
|
||||||
|
|
||||||
technologies = {}
|
technologies = {}
|
||||||
|
|
||||||
with open(DATAFILE, 'r') as datafile:
|
with open(DATAFILE, 'r') as datafile:
|
||||||
@@ -18,11 +21,10 @@ for repository in data["repositories"]:
|
|||||||
repo_technologies = repository["technologies"]
|
repo_technologies = repository["technologies"]
|
||||||
for repo_technology in repo_technologies:
|
for repo_technology in repo_technologies:
|
||||||
if not technologies.get(repo_technology, False):
|
if not technologies.get(repo_technology, False):
|
||||||
technologies[repo_technology] = {"link_id": repo_technology.lower(), "entries": []}
|
technologies[repo_technology] = new_technology_dict(repo_technology)
|
||||||
technologies[repo_technology]["entries"].append(repository)
|
technologies[repo_technology]["entries"].append(repository)
|
||||||
|
|
||||||
env = Environment(loader = FileSystemLoader(TEMPLATEPATH))
|
env = Environment(loader = FileSystemLoader(TEMPLATEPATH))
|
||||||
|
|
||||||
template = env.get_template(TEMPLATEFILE)
|
template = env.get_template(TEMPLATEFILE)
|
||||||
|
|
||||||
categories = []
|
categories = []
|
||||||
|
|||||||
Reference in New Issue
Block a user