def __init__(self, level, children=None, id=None, style=None, class_=None): Element.__init__(self, children, id, style, class_) self.level = level if id: self.id = slugify(escape(anchor.strip()[1:])) else: self.id = slugify(escape(self.text))
def test_escape(): assert_equal(escape('you & me are so < then >'), 'you & me are so < then >') assert_equal(escape('I love "foo" >> bar!', True), 'I love "foo" >> bar!')
def prepare_html(self): yield escape(self.text)
def parse(self, stream): stream.expect("code_begin") data = escape(u"".join(filter_stream(stream, "code_end"))) stream.expect("code_end") return nodes.Preformatted([nodes.HTML(data)])
def parse(self, stream): stream.expect('code_begin') data = escape(u''.join(filter_stream(stream, 'code_end'))) stream.expect('code_end') return nodes.Preformatted([nodes.HTML(data)])