view tasks/task_social_contract.py @ 6:9ce41ef66dfa

python 3 port
author Goffi <goffi@goffi.org>
date Sat, 05 Oct 2019 01:26:51 +0200
parents 09d66acc7c73
children b5fc67c97c50
line wrap: on
line source

#!/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())
        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"))