-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuildindex.py
27 lines (23 loc) · 1.11 KB
/
buildindex.py
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
import csv
from mako.template import Template
## TODO: Make filenames configurable, export directly to a file instead of STDOUT
item_tpl = Template(filename='item.tpl')
index_tpl = Template(filename='index.tpl', default_filters = ['n'])
now_content = []
next_content = []
later_content = []
released_content = []
with open('pr.csv', mode='r') as csv_file:
csv_reader = csv.DictReader(csv_file)
line_count = 0
for row in csv_reader:
content = item_tpl.render(**{'feature': row["Feature Name"], 'desc' : row["Description"], 'islive': bool(row["Live"])})
if row["Section"] == "Now":
now_content.append(content)
elif row["Section"] == "Next":
next_content.append(content)
elif row["Section"] == "Later":
later_content.append(content)
elif row["Section"] == "Released":
released_content.append(content)
print(index_tpl.render(**{'now_content' : "\n".join(now_content), 'next_content' : "\n".join(next_content), 'later_content' : "\n".join(later_content), 'released_content' : "\n".join(released_content)}))