Ejemplo n.º 1
0
Archivo: base.py Proyecto: cuchac/lino
 def render(cls, w, book):
     s = html2rst(E.div(*tuple(cls.word2html(w, book))))
     #~ s = html2rst(e) for e (cls.word2html(w,book)))
     if "<" in s:
         raise Exception("2013116 %r" % cls.word2html(w, book))
     if s.startswith('('):
         s = '\\' + s
     return s
Ejemplo n.º 2
0
Archivo: base.py Proyecto: DarioGT/lino
 def render(cls, w, book):
     s = html2rst(E.div(*tuple(cls.word2html(w, book))))
     #~ s = html2rst(e) for e (cls.word2html(w,book)))
     if "<" in s:
         raise Exception("2013116 %r" % cls.word2html(w, book))
     if s.startswith('('):
         s = '\\' + s
     return s
Ejemplo n.º 3
0
 def write_body(self,fd):
     Section.write_body(self,fd)
     self.from_language.words.sort(sort_by_fr)
     uca_sort(self.from_language.words)
     #~ self.from_language.words = uca_sorted(self.from_language.words)
     def fmt(w):
         for x in self.from_language.word2html(w):
             yield x
         yield " " 
         for x in  ET.word2html(w,self): 
             yield x
         yield " " 
         yield ", ".join([u.rst_ref_to() for u in w.units])
     for w in self.from_language.words:
         fd.write("| %s\n" % html2rst(E.div(*fmt(w))))
Ejemplo n.º 4
0
 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()
Ejemplo n.º 5
0
Archivo: base.py Proyecto: DarioGT/lino
    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()
Ejemplo n.º 6
0
Archivo: base.py Proyecto: DarioGT/lino
    def write_body(self, fd):
        Section.write_body(self, fd)
        self.from_language.words.sort(sort_by_fr)
        uca_sort(self.from_language.words)

        #~ self.from_language.words = uca_sorted(self.from_language.words)

        def fmt(w):
            for x in self.from_language.word2html(w):
                yield x
            yield " "
            for x in ET.word2html(w, self):
                yield x
            yield " "
            yield ", ".join([u.rst_ref_to() for u in w.units])

        for w in self.from_language.words:
            fd.write("| %s\n" % html2rst(E.div(*fmt(w))))