How to use the atelier.rstgen.write_header function in atelier

To help you get started, we’ve selected a few atelier examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lino-framework / lino / lino / modlib / vocbook / base.py View on Github external
def write_rst_files(self, root='.'):

        self.writing_format = 'rst'
        self.main.write_rst_files(root)

        if False:  # must convert to new structure
            fn = os.path.join('dict', 'et_fr.rst')
            logger.info("Generate %s", fn)
            fd = codecs.open(fn, 'w', 'utf-8')
            write_header(fd, 1, 'eesti-prantsuse')
            t = rstgen.Table(['Nr.', "ET", "FR", u"hääldamine", "Tasand"])
            self.words.sort(sort_by_et)
            words_et = [w for w in self.words if not w.hide_et]
            t.write(fd, [
                (i, w.et, html2rst(w.html_fr()),
                 w.pronounciation, w.lesson.rst_ref_to())
                for i, w in enumerate(words_et)])
            fd.close()
github lino-framework / lino / lino / modlib / vocbook / base.py View on Github external
fn = os.path.join(root, *self.name_parts()) + ".rst"
        logger.info("Generate %s", fn)
        newroot = os.path.dirname(fn)
        makedirs_if_missing(newroot)
        fd = codecs.open(fn, 'w', 'utf-8')

        if self.number is None:
            title = self.title
        else:
            title = "%d. %s" % (self.number, self.title)

        #~ if self.number is None:
            #~ write_header(fd,1,"%s" % self.title)
        #~ else:
            #~ write_header(fd,1,"%d. %s" % (self.number,self.title))
        write_header(fd, 1, self.memo2rst(title))
        self.write_body(fd)
        fd.close()
        for s in self.children:
            s.write_rst_files(newroot)