Esempio n. 1
0
 def chunk_db(self, xml):
     root = etree.XML(xml)
     files = mkhtml2.chunk(root, 'test')
     return [f for f in PreOrderIter(files) if f.anchor is None]
Esempio n. 2
0
 def test_chunk_single_chapter_gives_two_chunks(self):
     root = etree.XML('<book><chapter /></book>')
     files = mkhtml2.chunk(root, 'test')
     descendants = [f for f in files.descendants if f.anchor is None]
     logging.info('descendants : %s', str(descendants))
     self.assertEqual(1, len(descendants))
Esempio n. 3
0
 def test_chunk_second_sect1_is_not_inlined(self):
     root = etree.XML('<book><chapter><sect1 /><sect1 /></chapter></book>')
     files = mkhtml2.chunk(root, 'test')
     descendants = [f for f in files.descendants if f.anchor is None]
     logging.info('descendants : %s', str(descendants))
     self.assertEqual(2, len(descendants))
Esempio n. 4
0
 def test_chunk_only_root_gives_single_chunk(self):
     root = etree.XML('<book />')
     files = mkhtml2.chunk(root, 'test')
     self.assertEqual('book', files.name)
     self.assertEqual(0, len(files.descendants))
Esempio n. 5
0
 def convert(self, xml, ix):
     root = etree.XML(xml)
     files = mkhtml2.chunk(root, 'test')
     nodes = [f for f in PreOrderIter(files) if f.anchor is None]
     return '\n'.join(mkhtml2.convert_content('test', nodes, nodes[ix], 'c'))
Esempio n. 6
0
 def chunk_db(self, xml):
     root = etree.XML(xml)
     files = mkhtml2.chunk(root, 'test')
     return [f for f in PreOrderIter(files) if f.anchor is None]
Esempio n. 7
0
 def convert(self, xml):
     root = etree.XML(xml)
     files = mkhtml2.chunk(root, 'test')
     files = [f for f in PreOrderIter(files) if f.anchor is None]
     mkhtml2.add_id_links_and_titles(files, {})
     return '\n'.join(mkhtml2.create_devhelp2_content('test', root, files))
Esempio n. 8
0
 def test_chunk_second_sect1_is_not_inlined(self):
     root = etree.XML('<book><chapter><sect1 /><sect1 /></chapter></book>')
     files = mkhtml2.chunk(root, 'test')
     descendants = [f for f in files.descendants if f.anchor is None]
     logging.info('descendants : %s', str(descendants))
     self.assertEqual(2, len(descendants))
Esempio n. 9
0
 def convert(self, xml, ix):
     root = etree.XML(xml)
     files = mkhtml2.chunk(root, 'test')
     nodes = [f for f in PreOrderIter(files) if f.anchor is None]
     return '\n'.join(mkhtml2.convert_content('test', nodes, nodes[ix],
                                              'c'))
Esempio n. 10
0
 def test_chunk_single_chapter_gives_two_chunks(self):
     root = etree.XML('<book><chapter /></book>')
     files = mkhtml2.chunk(root, 'test')
     descendants = [f for f in files.descendants if f.anchor is None]
     logging.info('descendants : %s', str(descendants))
     self.assertEqual(1, len(descendants))
Esempio n. 11
0
 def test_chunk_only_root_gives_single_chunk(self):
     root = etree.XML('<book />')
     files = mkhtml2.chunk(root, 'test')
     self.assertEqual('book', files.name)
     self.assertEqual(0, len(files.descendants))
Esempio n. 12
0
 def convert(self, xml):
     root = etree.XML(xml)
     files = mkhtml2.chunk(root, 'test')
     files = [f for f in PreOrderIter(files) if f.anchor is None]
     mkhtml2.add_id_links_and_titles(files, {})
     return '\n'.join(mkhtml2.create_devhelp2_content('test', root, files))