def image_emit(self, node): target = node.content text = self.get_text(node) class_ = "internal" m = self.link_rules.addr_re.match(target) if m: if m.group('extern_addr'): class_ = "external" elif m.group('inter_wiki'): raise NotImplementedError yield START, (QName('img'), Attrs([ (QName('src'), target), (QName('alt'), text), (QName('class'), class_), ])), POS yield END, QName('img'), POS
def link_emit(self, node): target = node.content class_ = "internal" m = self.link_rules.addr_re.match(target) if m: if m.group('extern_addr'): class_ = "external" elif m.group('inter_wiki'): raise NotImplementedError yield START, (QName('a'), Attrs([ (QName('href'), target), (QName('class'), class_), ])), POS if node.children: for part in self.emit_children(node): yield part else: yield TEXT, target, POS yield END, QName('a'), POS
def preformatted_emit(self, node): yield START, (QName('pre'), Attrs()), POS yield TEXT, node.content, POS yield END, QName('pre'), POS
def break_emit(self, node): yield START, (QName('br'), Attrs()), POS yield END, QName('br'), POS
def header_emit(self, node): yield START, (QName('h%d' % node.level), Attrs()), POS yield TEXT, node.content, POS yield END, QName('h%d' % node.level), POS
def separator_emit(self, node): yield START, (QName('hr'), Attrs()), POS yield END, QName('hr'), POS
def wrap(self, tag, node): yield START, (QName(tag), Attrs()), POS for part in self.emit_children(node): yield part yield END, QName(tag), POS