def test_textile(self): with warnings.catch_warnings(record=True) as w: result = textile('My *text*') self.tearDown() self.assertEqual(result, 'My *text*') self.assertTrue(issubclass(w[-1].category, RuntimeWarning)) self.assertEqual(str(w[-1].message), "The Python textile library isn't installed.")
def test_textile(self): with warnings.catch_warnings(record=True) as w: result = textile('My *text*') self.tearDown() self.assertEqual(result, 'My *text*') self.assertTrue(issubclass(w[-1].category, RuntimeWarning)) self.assertEqual( str(w[-1].message), "The Python textile library isn't installed.")
def html_content(self): """ Returns the "content" field formatted in HTML. """ if MARKUP_LANGUAGE == 'markdown': return markdown(self.content) elif MARKUP_LANGUAGE == 'textile': return textile(self.content) elif MARKUP_LANGUAGE == 'restructuredtext': return restructuredtext(self.content) return linebreaks(self.content)
def html_content(self): """ Returns the "content" field formatted in HTML. """ if "</p>" in self.content: return self.content elif MARKUP_LANGUAGE == "markdown": return markdown(self.content) elif MARKUP_LANGUAGE == "textile": return textile(self.content) elif MARKUP_LANGUAGE == "restructuredtext": return restructuredtext(self.content) return linebreaks(self.content)
def html_content(self): """ Returns the "content" field formatted in HTML. """ content = self.content if not content: return '' elif MARKUP_LANGUAGE == 'markdown': return markdown(content) elif MARKUP_LANGUAGE == 'textile': return textile(content) elif MARKUP_LANGUAGE == 'restructuredtext': return restructuredtext(content) elif '</p>' not in content: return linebreaks(content) return content
def html_content(self): """ Returns the "content" field formatted in HTML. """ if MARKUP_LANGUAGE == 'markdown': # TODO: Remove when Zinnia supports non-string Markdown exts. import markdown from zinnia.settings import MARKDOWN_EXTENSIONS from django.utils.encoding import force_text return markdown.markdown(force_text(self.content), extensions=MARKDOWN_EXTENSIONS, safe_mode=False) elif MARKUP_LANGUAGE == 'textile': return textile(self.content) elif MARKUP_LANGUAGE == 'restructuredtext': return restructuredtext(self.content) return linebreaks(self.content)
def test_textile(self): self.assertEqual(textile(self.text).strip(), '<p>Hello <strong>World</strong> !</p>')