-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_tasks.py
executable file
·45 lines (42 loc) · 1.37 KB
/
make_tasks.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python2
GCI = '''\
<gci:task href="uh_{href}.xhtml">
<gci:title>{title}</gci:title>
<gci:tags>{tags}
</gci:tags>
<gci:types>{categories}</gci:types>
<gci:team>UH</gci:team>
<gci:desc>
{desc}
</gci:desc>
</gci:task>'''
def print_one_task(title, desc, types, all_tags, tickets=None):
tickets = tickets or []
href = '_'.join(w.replace(':', '') for w in title.split()[:3] if len(w) > 3).lower()
desc = '''\
<h2>Unknown Horizons</h2>
<p>Join <a href="http://www.unknown-horizons.org/irc/">our IRC channel</a>
when working on this task!</p>\n''' + desc + '\n' + '''
<br />'''.join(' '*8 + '<a href="https://github.com/'
'unknown-horizons/unknown-horizons/issues/{0}">'
'<b>Ticket {0}</b></a>'.format(t)
for t in tickets)
desc = ' <div style="font-size:17px;">\n' + desc + '''
</div>'''
categories = ','.join(t for t in sorted(types))
tags = ''.join('''
<gci:tag id="{tag_id}"/>'''.format(tag_id=tag_id)
for tag_id in (['unknownhorizons'] + sorted(all_tags)))
return GCI.format(**locals())
if __name__ == '__main__':
from all_tasks import ALL_TASKS
print '''\
<?xml version='1.0'?>
<gci:tasks xmlns="http://www.w3.org/1999/xhtml" xmlns:gci="gci">
'''
for task in ALL_TASKS:
if not task:
continue
print print_one_task(*task)
print
print '</gci:tasks>'