Esempio n. 1
0
        self.body.append(self.starttag(node, 'a', '', **atts))

    # end def visit_reference

    def depart_reference(self, node):
        self.body.append('</a>')
        if not isinstance(node.parent, nodes.TextElement):
            self.body.append('\n')
        self.in_mailto = 0

    # end def depart_reference


# end class HTML_Translator


class HTML_Writer(html4css1.Writer):
    """This docutils writer will use the MyHTMLTranslator class below."""
    def __init__(self):
        html4css1.Writer.__init__(self)
        self.translator_class = HTML_Translator

    #end def __init__


# end class HTML_Writer

if __name__ != "__main__":
    ReST._Export("*")
### __END__ ReST.HTML_Writer
Esempio n. 2
0
 def convert(cls, text):
     return RST.to_html(text, encoding="utf8")
Esempio n. 3
0
 def convert (cls, text) :
     return RST.to_html (text, encoding = "utf8")
Esempio n. 4
0
            atts['href'] = '#' + node['refid']
            atts['class'] += ' internal'
        if not isinstance(node.parent, nodes.TextElement):
            assert len(node) == 1 and isinstance(node[0], nodes.image)
            atts['class'] += ' image-reference'
        self.body.append(self.starttag(node, 'a', '', **atts))
    # end def visit_reference

    def depart_reference(self, node):
        self.body.append('</a>')
        if not isinstance(node.parent, nodes.TextElement):
            self.body.append('\n')
        self.in_mailto = 0
    # end def depart_reference

# end class HTML_Translator

class HTML_Writer (html4css1.Writer) :
    """This docutils writer will use the MyHTMLTranslator class below."""

    def __init__ (self) :
        html4css1.Writer.__init__ (self)
        self.translator_class = HTML_Translator
    #end def __init__

# end class HTML_Writer

if __name__ != "__main__" :
    ReST._Export ("*")
### __END__ ReST.HTML_Writer