コード例 #1
0
ファイル: test_export2html.py プロジェクト: Jenyay/outwiker
    def testBranchContentTitleNames2(self):
        """
        Экспорт дерева с короткими именами
        """
        from export2html.titlenamegenerator import TitleNameGenerator
        from export2html.branchexporter import BranchExporter

        pagename = "Страница 1"
        namegenerator = TitleNameGenerator(self.outputdir)
        branchExporter = BranchExporter(
            self.root[pagename], namegenerator, Application)

        branchExporter.export(
            outdir=self.outputdir,
            imagesonly=False,
            alwaysOverwrite=False
        )

        text = readTextFile(
            os.path.join(
                self.outputdir,
                "Страница 2 (2).html"))

        self.assertTrue('<img src="Страница 2 (2)/cd.png"/>' in text)
        self.assertTrue(
            '<a href="Страница 2 (2)/cd_go.png">cd_go.png</a>' in text)
コード例 #2
0
ファイル: test_export2html.py プロジェクト: sarutobi/outwiker
    def testLinkToPageByProticolTitleNames_01(self):
        """
        Тест на проверку того, что заменяются ссылки вида page://...
        """
        from export2html.titlenamegenerator import TitleNameGenerator
        from export2html.branchexporter import BranchExporter

        Application.wikiroot = self.root
        namegenerator = TitleNameGenerator(self.outputdir)
        branchExporter = BranchExporter(self.root, namegenerator, Application)

        branchExporter.export(outdir=self.outputdir,
                              imagesonly=False,
                              alwaysOverwrite=False)

        text = readTextFile(os.path.join(self.outputdir, u"Страница 1.html"))

        self.assertIn(u'<a href="Страница 2 (2).html">', text)
コード例 #3
0
ファイル: test_export2html.py プロジェクト: sarutobi/outwiker
    def testLinkToPagesHtmlTitleNames(self):
        """
        Тест для проверки того, как исправляются ссылки на страницы
        """
        from export2html.titlenamegenerator import TitleNameGenerator
        from export2html.branchexporter import BranchExporter

        pagename = u"Страница 1"
        namegenerator = TitleNameGenerator(self.outputdir)
        branchExporter = BranchExporter(self.root[pagename], namegenerator,
                                        Application)

        branchExporter.export(outdir=self.outputdir,
                              imagesonly=False,
                              alwaysOverwrite=False)

        text = readTextFile(os.path.join(self.outputdir, u"Страница 6.html"))

        self.assertTrue(u'<A HREF="/Типы страниц">/Типы страниц</A>' in text)

        self.assertTrue(
            u'<A HREF="Страница 2 (2).html">/Страница 1/Страница 2/Страница 6/Страница 7/Страница 2</A>'
            in text)

        self.assertTrue(
            u'<A HREF="Страница 2 (2).html">Страница 7/Страница 2</A>' in text)

        self.assertTrue(
            u'<A HREF="Страница 2 (2).html">Еще одна ссылка</A>' in text)

        self.assertTrue(u'<A HREF="Страница 7.html">Страница 7</A>' in text)

        self.assertTrue(
            u'<A HREF="Страница 2 (2).html" title="бла-бла-бла">Ссылка на /Страница 1/Страница 2/Страница 6/Страница 7/Страница 2</A>'
            in text)

        self.assertTrue(
            u'<A HREF="Страница 7.html" title="бла-бла-бла">Ссылка на Страницу 7</A>'
            in text)
コード例 #4
0
ファイル: test_export2html.py プロジェクト: sarutobi/outwiker
    def testExportBranchFilesTitleNames(self):
        """
        Экспорт дерева с короткими именами
        """
        from export2html.titlenamegenerator import TitleNameGenerator
        from export2html.branchexporter import BranchExporter

        pagename = u"Страница 1"
        namegenerator = TitleNameGenerator(self.outputdir)
        branchExporter = BranchExporter(self.root[pagename], namegenerator,
                                        Application)

        result = branchExporter.export(outdir=self.outputdir,
                                       imagesonly=False,
                                       alwaysOverwrite=False)

        self.assertEqual(len(result), 0, str(result))

        self.assertTrue(os.path.exists(os.path.join(self.outputdir, pagename)))
        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, pagename + ".html")))

        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, u"Страница 2")))
        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, u"Страница 2.html")))

        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, u"Страница 2 (1)")))
        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir,
                                        u"Страница 2 (1).html")))

        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, u"Страница 2 (2)")))
        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir,
                                        u"Страница 2 (2).html")))

        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, u"Страница 5")))
        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, u"Страница 5.html")))

        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, u"Страница 6")))
        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, u"Страница 6.html")))

        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, u"Страница 7")))
        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, u"Страница 7.html")))

        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, "__index.html")))
        self.assertTrue(
            os.path.isfile(os.path.join(self.outputdir, "__index.html")))

        self.assertTrue(
            os.path.exists(os.path.join(self.outputdir, PAGE_RESULT_HTML)))
        self.assertTrue(
            os.path.isfile(os.path.join(self.outputdir, PAGE_RESULT_HTML)))