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
def convert(cls, text): return RST.to_html(text, encoding="utf8")
def convert (cls, text) : return RST.to_html (text, encoding = "utf8")
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