Пример #1
0
    def testProcessingFunctionFactoryWithFilenameGenerator(self):
        base = FilePath(self.mktemp())
        base.makedirs()

        def filenameGenerator(originalFileName, outputExtension):
            name = os.path.splitext(FilePath(originalFileName).basename())[0]
            return base.child(name + outputExtension).path

        htmlGenerator = factory.generate_html(options, filenameGenerator)
        htmlGenerator(self.file, self.linkrel)
        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: My Test Lore Input</title></head>
  <body bgcolor="white">
    <h1 class="title">My Test Lore Input</h1>
    <div class="content">
<span/>
<p>A Body.</p>
</div>
    <a href="index.xhtml">Index</a>
  </body>
</html>""",
            base.child("simple.xhtml").getContent(),
        )
Пример #2
0
    def testProcessingFunctionFactory(self):
        base = FilePath(self.mktemp())
        base.makedirs()

        simple = base.child("simple.html")
        FilePath(__file__).sibling("simple.html").copyTo(simple)

        htmlGenerator = factory.generate_html(options)
        htmlGenerator(simple.path, self.linkrel)

        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: My Test Lore Input</title></head>
  <body bgcolor="white">
    <h1 class="title">My Test Lore Input</h1>
    <div class="content">
<span/>
<p>A Body.</p>
</div>
    <a href="index.xhtml">Index</a>
  </body>
</html>""",
            simple.sibling("simple.xhtml").getContent(),
        )
Пример #3
0
    def testProcessingFunctionFactoryWithFilenameGenerator(self):
        base = FilePath(self.mktemp())
        base.makedirs()

        def filenameGenerator(originalFileName, outputExtension):
            name = os.path.splitext(FilePath(originalFileName).basename())[0]
            return base.child(name + outputExtension).path

        htmlGenerator = factory.generate_html(options, filenameGenerator)
        htmlGenerator(self.file, self.linkrel)
        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: My Test Lore Input</title></head>
  <body bgcolor="white">
    <h1 class="title">My Test Lore Input</h1>
    <div class="content">
<span/>
<p>A Body.</p>
</div>
    <a href="index.xhtml">Index</a>
  </body>
</html>""",
            base.child("simple.xhtml").getContent())
Пример #4
0
    def testProcessingFunctionFactory(self):
        base = FilePath(self.mktemp())
        base.makedirs()

        simple = base.child('simple.html')
        FilePath(__file__).sibling('simple.html').copyTo(simple)

        htmlGenerator = factory.generate_html(options)
        htmlGenerator(simple.path, self.linkrel)

        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: My Test Lore Input</title></head>
  <body bgcolor="white">
    <h1 class="title">My Test Lore Input</h1>
    <div class="content">
<span/>
<p>A Body.</p>
</div>
    <a href="index.xhtml">Index</a>
  </body>
</html>""",
            simple.sibling('simple.xhtml').getContent())
Пример #5
0
 def testProcessingFunctionFactoryWithFilenameGenerator(self):
     htmlGenerator = factory.generate_html(options, filenameGenerator2)
     htmlGenerator(self.file, self.linkrel)
     self.assertEqualFiles('good_simple.xhtml', 'simple2.xhtml')
 def testProcessingFunctionFactoryWithFilenameGenerator(self):
     htmlGenerator = factory.generate_html(options, filenameGenerator2)
     htmlGenerator(self.file, self.linkrel)
     self.assertEqualFiles('good_simple.xhtml', 'simple2.xhtml')