summaryrefslogtreecommitdiffstats
path: root/static/img/scripts/credits.py
blob: 7e0a0aed6c1bf4734bd78498975a25fb2457964a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /usr/bin/env python

import xml.etree.ElementTree as ET
import os

print '<ul>'
for filepath in sorted(os.listdir('sources')):
    if not filepath.endswith('.svg'):
        continue
    tree = ET.fromstring(file('sources/' + filepath).read())
    author = None
    for elem in tree.getchildren():
        if elem.tag == '{http://www.w3.org/2000/svg}text' and elem.text.startswith('Created by'):
            author = elem.text[len('Created by')+1:]
            tree.remove(elem)
            break
    else:
        continue
    print '<li>%s, par %s de <a href="http://thenounproject.com/">The Noun Project</a></li>' % (
            filepath.split('.')[0].title(), author)
print '</ul>'