forked from program-repair/program-repair.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
69 lines (53 loc) · 2.35 KB
/
Copy pathbuild.py
File metadata and controls
69 lines (53 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python3
import pystache
import os
from os.path import join, basename
import json
SITE_PATH = os.path.dirname(os.path.realpath(__file__))
NEWS_FILE = join(SITE_PATH, 'data', 'news.json')
PAPERS_FILE = join(SITE_PATH, 'data', 'papers.json')
TOOLS_FILE = join(SITE_PATH, 'data', 'tools.json')
BENCHMARKS_FILE = join(SITE_PATH, 'data', 'benchmarks.json')
ANALYTICS_FILE = join(SITE_PATH, 'analytics.txt')
META_FILE = join(SITE_PATH, 'meta.txt')
HOME_TEMPLATE = join(SITE_PATH, 'templates', 'index.html')
BIBLIOGRAPHY_TEMPLATE = join(SITE_PATH, 'templates', 'bibliography.html')
TOOLS_TEMPLATE = join(SITE_PATH, 'templates', 'tools.html')
BENCHMARKS_TEMPLATE = join(SITE_PATH, 'templates', 'benchmarks.html')
HOME_OUTPUT = join(SITE_PATH, 'index.html')
BIBLIOGRAPHY_OUTPUT = join(SITE_PATH, 'bibliography.html')
TOOLS_OUTPUT = join(SITE_PATH, 'tools.html')
BENCHMARKS_OUTPUT = join(SITE_PATH, 'benchmarks.html')
print('Rendering {}'.format(basename(HOME_OUTPUT)))
with open(HOME_TEMPLATE, 'r') as file:
home_template = file.read()
with open(NEWS_FILE, 'r') as file:
home_data = json.load(file)
with open(META_FILE, 'r') as file:
home_data['meta'] = file.read()
with open(ANALYTICS_FILE, 'r') as file:
home_data['analytics'] = file.read()
with open(HOME_OUTPUT, 'w') as file:
file.write(pystache.render(home_template, home_data))
print('Rendering {}'.format(basename(BIBLIOGRAPHY_OUTPUT)))
with open(BIBLIOGRAPHY_TEMPLATE, 'r') as file:
bibliography_template = file.read()
with open(PAPERS_FILE, 'r') as file:
papers_data = json.load(file)
with open(BIBLIOGRAPHY_OUTPUT, 'w') as file:
file.write(pystache.render(bibliography_template, papers_data))
print('Rendering {}'.format(basename(TOOLS_OUTPUT)))
with open(TOOLS_TEMPLATE, 'r') as file:
tools_template = file.read()
with open(TOOLS_FILE, 'r') as file:
tools_data = json.load(file)
with open(TOOLS_OUTPUT, 'w') as file:
file.write(pystache.render(tools_template, tools_data))
print('Rendering {}'.format(basename(BENCHMARKS_OUTPUT)))
with open(BENCHMARKS_TEMPLATE, 'r') as file:
benchmarks_template = file.read()
with open(BENCHMARKS_FILE, 'r') as file:
benchmarks_data = json.load(file)
with open(BENCHMARKS_OUTPUT, 'w') as file:
file.write(pystache.render(benchmarks_template, benchmarks_data))
print('DONE')