Mercurial > libervia-website
view tasks/task_social_contract.py @ 10:0e9e97777fe0
doc: `-` in doc name is replace by `/`:
this is needed for Cagou which is deskop/mobile frontend.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 23 Apr 2021 11:04:23 +0200 |
parents | b5fc67c97c50 |
children | 5fd933e238bb |
line wrap: on
line source
#!/ur/bin/env python2 import glob import os.path import markdown from sat.core.i18n import _ from sat.core.log import getLogger from libervia.server.tasks import task log = getLogger(__name__) class Task(task.Task): 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()) build_path = os.path.join(self.build_path, filename + '.html') with open(build_path, 'w') as f: f.write(md) log.info(_("social contract has been converted to HTML"))