def expand(self, node, format, node_map):
     return ''.join(['<para>'] + [expand(child, format, node_map) for child in node.children] + ['</para>'])
Example #2
0
 def testExpandFromTree(self):
     p = ParagraphNode()
     tn = TextNode()
     tn.content = 'content'
     p.children.append(tn)
     self.assertEquals(expand(p, 'docbook5', node_map), '<para>content</para>')
Example #3
0
 def testExpandFromTreeWithEntitiesEnabled(self):
     p = ParagraphNode()
     tn = TextNode()
     tn.content = '<b>not bold</b>'
     p.children.append(tn)
     self.assertEquals(expand(p, 'docbook5', node_map), '<para>&lt;b&gt;not bold&lt;/b&gt;</para>')
Example #4
0
 def expand_with_content(self, node, format, node_map, prefix=u'', suffix=u''):
     return u''.join([prefix] + [expand(child, format, node_map) for child in node.children] + [suffix])