0
|
1 #!/ur/bin/env python2 |
|
2 |
|
3 import glob |
|
4 import markdown |
|
5 import os.path |
|
6 from sat.core.i18n import _ |
|
7 from sat.core.log import getLogger |
|
8 log = getLogger(__name__) |
|
9 |
|
10 |
|
11 def start(self): |
|
12 sat_path = self.getConfig("sat_repos_path") |
|
13 for filepath in glob.glob(os.path.join(sat_path, "CONTRAT_SOCIAL*")): |
|
14 filename = os.path.basename(filepath) |
|
15 with open(filepath) as f: |
|
16 md = markdown.markdown(f.read().decode('utf-8')) |
|
17 build_path = os.path.join(self.build_path, filename + '.html') |
|
18 with open(build_path, 'w') as f: |
|
19 f.write(md.encode('utf-8')) |
|
20 |
|
21 log.info(_(u"social contract has been converted to HTML")) |