Mercurial > libervia-website
diff tasks/task_social_contract.py @ 0:09d66acc7c73
initial commit, website first draft:
- presentation page
- documentation (generated from backend and Libervia)
- social contract (HTML generated from sat repository)
- press/conferences (adapted from former website)
- association page (adpated from former website)
- news (a selected blog is displayed)
- fr i18n
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 26 May 2019 22:26:30 +0200 |
parents | |
children | 9ce41ef66dfa |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tasks/task_social_contract.py Sun May 26 22:26:30 2019 +0200 @@ -0,0 +1,21 @@ +#!/ur/bin/env python2 + +import glob +import markdown +import os.path +from sat.core.i18n import _ +from sat.core.log import getLogger +log = getLogger(__name__) + + +def start(self): + sat_path = self.getConfig("sat_repos_path") + for filepath in glob.glob(os.path.join(sat_path, "CONTRAT_SOCIAL*")): + filename = os.path.basename(filepath) + with open(filepath) as f: + md = markdown.markdown(f.read().decode('utf-8')) + build_path = os.path.join(self.build_path, filename + '.html') + with open(build_path, 'w') as f: + f.write(md.encode('utf-8')) + + log.info(_(u"social contract has been converted to HTML"))