You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import json
|
|
|
|
from jinja2 import Template, Environment, FileSystemLoader
|
|
|
|
|
|
|
|
env = Environment(loader=FileSystemLoader("scripts/templates"))
|
|
|
|
|
|
|
|
# import jinjafy.filters
|
|
|
|
# for name, fn in jinjafy.filters.all.items():
|
|
|
|
# env.filters[name] = fn
|
|
|
|
|
|
|
|
from common import load_json
|
|
|
|
|
|
|
|
data = load_json()
|
|
|
|
# with open("index.json") as fin:
|
|
|
|
# data = json.load(fin)
|
|
|
|
# data['projects'] = [x for x in data['@graph'] if x['type'] == 'project']
|
|
|
|
# data['projects'].sort(key=lambda x: x['title'].strip('"').lower())
|
|
|
|
|
|
|
|
template = env.get_template("index_titles.html")
|
|
|
|
with open("index_titles.html", "w") as fout:
|
|
|
|
print (template.render(**data), file=fout)
|