示例#1
0
    def testEmpty (self):
        from tableofcontents.tocwikigenerator import TOCWikiGenerator

        generator = TOCWikiGenerator(Application.config)
        items = []

        result = generator.make (items)

        result_valid = u''''''

        self.assertEqual (result, result_valid)
示例#2
0
    def testToc_01 (self):
        from tableofcontents.contentsparser import Section
        from tableofcontents.tocwikigenerator import TOCWikiGenerator

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

        result = generator.make (items)

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

        self.assertEqual (result, result_valid)
示例#3
0
    def testToc_04(self):
        from tableofcontents.contentsparser import Section
        from tableofcontents.tocwikigenerator import TOCWikiGenerator

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

        result = generator.make(items)

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

        self.assertEqual(result, result_valid)
示例#4
0
    def testToc_04(self):
        from tableofcontents.contentsparser import Section
        from tableofcontents.tocwikigenerator import TOCWikiGenerator

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

        result = generator.make(items)

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

        self.assertEqual(result, result_valid)
示例#5
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)