def lore(self, arguments): """ Run lore with the given arguments. @param arguments: A C{list} of C{str} giving command line arguments to lore which should be used. """ options = lore.Options() options.parseOptions(["--null"] + arguments) lore.runGivenOptions(options)
def lore(self, arguments): """ Run lore with the given arguments. @param arguments: A C{list} of C{str} giving command line arguments to lore which should be used. """ options = lore.Options() options.parseOptions(["--null"] + arguments) lore.runGivenOptions(options)
def XXXtest_NumberedSections(self): # run two files through lore, with numbering turned on # every h2 should be numbered: # first file's h2s should be 1.1, 1.2 # second file's h2s should be 2.1, 2.2 templateFilename = sp('template.tpl') inputFilename = sp('lore_numbering_test.xhtml') inputFilename2 = sp('lore_numbering_test2.xhtml') indexFilename = 'theIndexFile' # you can number without a book: options = lore.Options() options.parseOptions(['--null', '--index=%s' % indexFilename, '--config', 'template=%s' % templateFilename, '--config', 'ext=%s' % ".tns", '--number', inputFilename, inputFilename2]) result = lore.runGivenOptions(options) self.assertEqual(None, result) #self.assertEqualFiles1("lore_index_file_out_multiple.html", indexFilename + ".tns") # VVV change to new, numbered files self.assertEqualFiles("lore_numbering_test_out.html", "lore_numbering_test.tns") self.assertEqualFiles("lore_numbering_test_out2.html", "lore_numbering_test2.tns")
def XXXtest_NumberedSections(self): # run two files through lore, with numbering turned on # every h2 should be numbered: # first file's h2s should be 1.1, 1.2 # second file's h2s should be 2.1, 2.2 templateFilename = sp('template.tpl') inputFilename = sp('lore_numbering_test.xhtml') inputFilename2 = sp('lore_numbering_test2.xhtml') indexFilename = 'theIndexFile' # you can number without a book: options = lore.Options() options.parseOptions([ '--null', '--index=%s' % indexFilename, '--config', 'template=%s' % templateFilename, '--config', 'ext=%s' % ".tns", '--number', inputFilename, inputFilename2 ]) result = lore.runGivenOptions(options) self.assertEquals(None, result) #self.assertEqualFiles1("lore_index_file_out_multiple.html", indexFilename + ".tns") # VVV change to new, numbered files self.assertEqualFiles("lore_numbering_test_out.html", "lore_numbering_test.tns") self.assertEqualFiles("lore_numbering_test_out2.html", "lore_numbering_test2.tns")
def test_runningLoreMultipleFiles(self): tmp = self.makeTemp('lore_index_test.xhtml', 'lore_index_test2.xhtml') templateFilename = sp('template.tpl') inputFilename = os.path.join(tmp, 'lore_index_test.xhtml') inputFilename2 = os.path.join(tmp, 'lore_index_test2.xhtml') indexFilename = 'theIndexFile' bookFilename = os.path.join(tmp, 'lore_test_book.book') bf = open(bookFilename, 'w') bf.write('Chapter(r"%s", None)\n' % inputFilename) bf.write('Chapter(r"%s", None)\n' % inputFilename2) bf.close() options = lore.Options() options.parseOptions([ '--null', '--book=%s' % bookFilename, '--config', 'template=%s' % templateFilename, '--index=%s' % indexFilename ]) result = lore.runGivenOptions(options) self.assertEquals(None, result) self.assertEqualFiles1("lore_index_file_unnumbered_multiple_out.html", indexFilename + ".html") self.assertEqualFiles1("lore_index_test_out.html", os.path.join(tmp, "lore_index_test.html")) self.assertEqualFiles1("lore_index_test_out2.html", os.path.join(tmp, "lore_index_test2.html"))
def test_runningLoreMultipleFiles(self): tmp = self.makeTemp('lore_index_test.xhtml', 'lore_index_test2.xhtml') templateFilename = sp('template.tpl') inputFilename = os.path.join(tmp, 'lore_index_test.xhtml') inputFilename2 = os.path.join(tmp, 'lore_index_test2.xhtml') indexFilename = 'theIndexFile' bookFilename = os.path.join(tmp, 'lore_test_book.book') bf = open(bookFilename, 'w') bf.write('Chapter(r"%s", None)\n' % inputFilename) bf.write('Chapter(r"%s", None)\n' % inputFilename2) bf.close() options = lore.Options() options.parseOptions(['--null', '--book=%s' % bookFilename, '--config', 'template=%s' % templateFilename, '--index=%s' % indexFilename ]) result = lore.runGivenOptions(options) self.assertEquals(None, result) self.assertEqualFiles1("lore_index_file_unnumbered_multiple_out.html", indexFilename + ".html") self.assertEqualFiles1("lore_index_test_out.html", os.path.join(tmp, "lore_index_test.html")) self.assertEqualFiles1("lore_index_test_out2.html", os.path.join(tmp, "lore_index_test2.html"))
def test_runningLore(self): options = lore.Options() tmp = self.makeTemp("lore_index_test.xhtml") templateFilename = sp("template.tpl") inputFilename = os.path.join(tmp, "lore_index_test.xhtml") indexFilename = "theIndexFile" bookFilename = os.path.join(tmp, "lore_test_book.book") bf = open(bookFilename, "w") bf.write('Chapter(r"%s", None)\n' % inputFilename) bf.close() options.parseOptions( [ "--null", "--book=%s" % bookFilename, "--config", "template=%s" % templateFilename, "--index=%s" % indexFilename, ] ) result = lore.runGivenOptions(options) self.assertEquals(None, result) self.assertEqualFiles1("lore_index_file_unnumbered_out.html", indexFilename + ".html")
def test_runningLoreMultipleFiles(self): tmp = self.makeTemp('lore_index_test.xhtml', 'lore_index_test2.xhtml') templateFilename = sp('template.tpl') inputFilename = os.path.join(tmp, 'lore_index_test.xhtml') inputFilename2 = os.path.join(tmp, 'lore_index_test2.xhtml') indexFilename = 'theIndexFile' bookFilename = os.path.join(tmp, 'lore_test_book.book') bf = open(bookFilename, 'w') bf.write('Chapter(r"%s", None)\n' % inputFilename) bf.write('Chapter(r"%s", None)\n' % inputFilename2) bf.close() options = lore.Options() options.parseOptions(['--null', '--book=%s' % bookFilename, '--config', 'template=%s' % templateFilename, '--index=%s' % indexFilename ]) result = lore.runGivenOptions(options) self.assertEqual(None, result) self.assertEqual( # XXX This doesn't seem like a very good index file. """\ aahz: <a href="lore_index_test2.html#index03">link</a><br /> aahz2: <a href="lore_index_test2.html#index02">link</a><br /> language of programming: <a href="lore_index_test.html#index02">link</a>, <a href="lore_index_test2.html#index01">link</a><br /> programming language: <a href="lore_index_test.html#index01">link</a><br /> """, file(FilePath(indexFilename + ".html").path).read()) self.assertXMLEqual( """\ <?xml version="1.0" ?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head><title>Twisted Documentation: The way of the program</title></head> <body bgcolor="white"> <h1 class="title">The way of the program</h1> <div class="content"> <span/> <p>The first paragraph.</p> <h2>The Python programming language<a name="auto0"/></h2> <a name="index01"/> <a name="index02"/> <p>The second paragraph.</p> </div> <a href="theIndexFile.html">Index</a> </body> </html>""", FilePath(tmp).child("lore_index_test.html").getContent()) self.assertXMLEqual( """\ <?xml version="1.0" ?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head><title>Twisted Documentation: The second page to index</title></head> <body bgcolor="white"> <h1 class="title">The second page to index</h1> <div class="content"> <span/> <p>The first paragraph of the second page.</p> <h2>The Jython programming language<a name="auto0"/></h2> <a name="index01"/> <a name="index02"/> <a name="index03"/> <p>The second paragraph of the second page.</p> </div> <a href="theIndexFile.html">Index</a> </body> </html>""", FilePath(tmp).child("lore_index_test2.html").getContent())
def test_runningLoreMultipleFiles(self): tmp = self.makeTemp('lore_index_test.xhtml', 'lore_index_test2.xhtml') templateFilename = sp('template.tpl') inputFilename = os.path.join(tmp, 'lore_index_test.xhtml') inputFilename2 = os.path.join(tmp, 'lore_index_test2.xhtml') indexFilename = 'theIndexFile' bookFilename = os.path.join(tmp, 'lore_test_book.book') bf = open(bookFilename, 'w') bf.write('Chapter(r"%s", None)\n' % inputFilename) bf.write('Chapter(r"%s", None)\n' % inputFilename2) bf.close() options = lore.Options() options.parseOptions([ '--null', '--book=%s' % bookFilename, '--config', 'template=%s' % templateFilename, '--index=%s' % indexFilename ]) result = lore.runGivenOptions(options) self.assertEqual(None, result) self.assertEqual( # XXX This doesn't seem like a very good index file. """\ aahz: <a href="lore_index_test2.html#index03">link</a><br /> aahz2: <a href="lore_index_test2.html#index02">link</a><br /> language of programming: <a href="lore_index_test.html#index02">link</a>, <a href="lore_index_test2.html#index01">link</a><br /> programming language: <a href="lore_index_test.html#index01">link</a><br /> """, file(FilePath(indexFilename + ".html").path).read()) self.assertXMLEqual( """\ <?xml version="1.0" ?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head><title>Twisted Documentation: The way of the program</title></head> <body bgcolor="white"> <h1 class="title">The way of the program</h1> <div class="content"> <span/> <p>The first paragraph.</p> <h2>The Python programming language<a name="auto0"/></h2> <a name="index01"/> <a name="index02"/> <p>The second paragraph.</p> </div> <a href="theIndexFile.html">Index</a> </body> </html>""", FilePath(tmp).child("lore_index_test.html").getContent()) self.assertXMLEqual( """\ <?xml version="1.0" ?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head><title>Twisted Documentation: The second page to index</title></head> <body bgcolor="white"> <h1 class="title">The second page to index</h1> <div class="content"> <span/> <p>The first paragraph of the second page.</p> <h2>The Jython programming language<a name="auto0"/></h2> <a name="index01"/> <a name="index02"/> <a name="index03"/> <p>The second paragraph of the second page.</p> </div> <a href="theIndexFile.html">Index</a> </body> </html>""", FilePath(tmp).child("lore_index_test2.html").getContent())