def test_html_format_default(self): markups.MARKUP_LANGUAGE = None self.assertEquals(html_format(''), '') self.assertEquals(html_format('Content'), '<p>Content</p>') self.assertEquals(html_format('Content</p>'), 'Content</p>') self.assertEquals(html_format('Hello\nworld!'), '<p>Hello<br />world!</p>')
def test_html_content_restructuredtext(self): markups.MARKUP_LANGUAGE = 'restructuredtext' value = 'Hello world !\n\n' \ 'this is my content :\n\n' \ '* Item 1\n* Item 2' self.assertEqual(html_format(value), '<p>Hello world !</p>\n' '<p>this is my content :</p>' '\n<ul class="simple">\n<li>Item 1</li>\n' '<li>Item 2</li>\n</ul>\n')
def test_html_content_markdown(self): markups.MARKUP_LANGUAGE = 'markdown' value = 'Hello world !\n\n' \ 'this is my content :\n\n' \ '* Item 1\n* Item 2' self.assertEqual(html_format(value), '<p>Hello world !</p>\n' '<p>this is my content :</p>' '\n<ul>\n<li>Item 1</li>\n' '<li>Item 2</li>\n</ul>')
def test_html_content_textitle(self): markups.MARKUP_LANGUAGE = 'textile' value = 'Hello world !\n\n' \ 'this is my content :\n\n' \ '* Item 1\n* Item 2' self.assertEqual(html_format(value), '\t<p>Hello world !</p>\n\n\t' '<p>this is my content :</p>\n\n\t' '<ul>\n\t\t<li>Item 1</li>\n\t\t' '<li>Item 2</li>\n\t</ul>')
def html_lead(self): """ Returns the "lead" field formatted in HTML. """ return html_format(self.lead)
def html_content(self): """ Returns the "content" field formatted in HTML. """ return html_format(self.content)