Exemple #1
0
    def test_input_file_get_pandoc_title(self):
        i = tempfile.TemporaryFile('r+w')
        i.write('`test`')
        i.seek(0)
        md = Markdown(i)
        self.assertEqual(md.get_pandoc_title(), None)
        i.close()

        i = tempfile.TemporaryFile('r+w')
        i.write('% abc\n')
        i.seek(0)
        md = Markdown(i)
        self.assertEqual(md.get_pandoc_title(), None)
        i.close()

        i = tempfile.TemporaryFile('r+w')
        i.write('% abc\n% def')
        i.seek(0)
        md = Markdown(i)
        self.assertEqual(md.get_pandoc_title(), None)
        i.close()

        i = tempfile.TemporaryFile('r+w')
        i.write('% abc\n% def\n% jhi\n')
        i.seek(0)
        md = Markdown(i)
        self.assertEqual(md.get_pandoc_title(), 'abc')
        i.close()
Exemple #2
0
    def test_input_string_get_pandoc_title(self):
        md = Markdown('`test`')
        self.assertEqual(md.get_pandoc_title(), None)

        md = Markdown('% abc\n')
        self.assertEqual(md.get_pandoc_title(), None)

        md = Markdown('% abc\n% def')
        self.assertEqual(md.get_pandoc_title(), None)

        md = Markdown('% abc\n% def\n% jhi\n')
        self.assertEqual(md.get_pandoc_title(), 'abc')