Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 def preformatted_emit(self, node):
     yield START, (QName('pre'), Attrs()), POS
     yield TEXT, node.content, POS
     yield END, QName('pre'), POS
Пример #4
0
 def break_emit(self, node):
     yield START, (QName('br'), Attrs()), POS
     yield END, QName('br'), POS
Пример #5
0
 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
Пример #6
0
 def separator_emit(self, node):
     yield START, (QName('hr'), Attrs()), POS
     yield END, QName('hr'), POS
Пример #7
0
 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