Пример #1
0
    def testToc_04 (self):
        from tableofcontents.contentsparser import Section
        from tableofcontents.tocwikigenerator import TOCWikiGenerator

        generator = TOCWikiGenerator(Application.config)
        items = [
            Section (u"Абырвалг 123", 1, u""),
            Section (u"Абырвалг 12345", 5, u""),
        ]

        result = generator.make (items)

        result_valid = u'''* Абырвалг 123
***** Абырвалг 12345'''

        self.assertEqual (result, result_valid)
Пример #2
0
    def testAnchors_03 (self):
        from tableofcontents.contentsparser import Section
        from tableofcontents.tocwikigenerator import TOCWikiGenerator

        WikiConfig (Application.config).linkStyleOptions.value = 2

        generator = TOCWikiGenerator(Application.config)
        items = [
            Section (u"Абырвалг 1", 1, u"якорь1"),
            Section (u"Абырвалг 2", 2, u"якорь2"),
        ]

        result = generator.make (items)

        result_valid = u'''* [[Абырвалг 1 -> #якорь1]]
** [[Абырвалг 2 -> #якорь2]]'''

        self.assertEqual (result, result_valid)
Пример #3
0
    def testToc_05(self):
        from tableofcontents.contentsparser import Section
        from tableofcontents.tocwikigenerator import TOCWikiGenerator

        generator = TOCWikiGenerator(self.application.config)
        items = [
            Section("Абырвалг 1", 1, ""),
            Section("Абырвалг 2", 2, ""),
            Section("Абырвалг 3", 3, ""),
            Section("Абырвалг 1", 1, ""),
        ]

        result = generator.make(items)

        result_valid = '''* Абырвалг 1
** Абырвалг 2
*** Абырвалг 3
* Абырвалг 1'''

        self.assertEqual(result, result_valid)