コード例 #1
0
 def test_markdown(self):
     """
     Ensure markdown to HTML works as expected.
     """
     if apply_markdown:
         gte_21_match = apply_markdown(DESCRIPTION) == MARKED_DOWN_gte_21
         lt_21_match = apply_markdown(DESCRIPTION) == MARKED_DOWN_lt_21
         self.assertTrue(gte_21_match or lt_21_match)
コード例 #2
0
def markup_description(description):
    """
    Apply HTML markup to the given description.
    """
    if apply_markdown:
        description = apply_markdown(description)
    else:
        description = escape(description).replace("\n", "<br />")
        description = "<p>" + description + "</p>"
    return mark_safe(description)