Commits

Ryan Herriman  committed e3a60b2

Fixed some comment formatting issues.

  • Participants
  • Parent commits 0f24667

Comments (0)

Files changed (1)

File leaves/utils.py

 	Given some text, and a format option, returns a formatted value.
 	"""
 	text = force_unicode(text)
+	if format == 'markdown':
+		import markdown
+		text = markdown.markdown(text, **extra)
+	elif format == 'bbcode':
+		import bbcode
+		text = bbcode.render_html(text, **extra)
+	elif format == 'html':
+		pass
+	else:
+		from django.template.defaultfilters import linebreaksbr
+		text = linebreaksbr(text)
 	# The bbcode module does pretty replacements by default.
 	if pretty and format != 'bbcode':
 		for search, repl in PRETTY_REPLACEMENTS:
 			text = text.replace(search, repl)
-	if format == 'markdown':
-		import markdown
-		return mark_safe(markdown.markdown(text, **extra))
-	elif format == 'bbcode':
-		import bbcode
-		return mark_safe(bbcode.render_html(text, **extra))
-	elif format == 'html':
-		return mark_safe(text)
-	else:
-		from django.template.defaultfilters import linebreaksbr
-		return linebreaksbr(text)
+	if format:
+		text = mark_safe(text)
+	return text