1. Shu Zong Chen
  2. django-sasaba

Commits

Shu Zong Chen  committed 3b12944

Added creole

  • Participants
  • Parent commits 6c3fd26
  • Branches default

Comments (0)

Files changed (1)

File sasaba/models.py

View file
 	import textile
 except:
 	textile = None
+try:
+	import creoleparser
+except:
+	creoleparser = None
 
 # Create your models here.
 
 		('html', 'HTML'),
 		('markdown', 'Markdown'),
 		('textile', 'Textile'),
+		('creole', 'Creole'),
 	)
 	engine = models.CharField("markup engine", max_length = 255, choices = ENGINE_CHOICES, blank = True)
 	content = models.TextField(blank = True)
 				return mark_safe(markdown2.markdown(self.content))
 			else:
 				return "Markdown Engine not installed."
-		if self.engine == "textile":
+		elif self.engine == "textile":
 			if textile is not None:
 				return mark_safe(textile.textile(self.content))
 			else:
 				return "Textile Engine not installed."
+		elif self.engine == "creole":
+			if creoleparser is not None:
+				return mark_safe(creoleparser.text2html(self.content))
+			else:
+				return "Creole Engine not installed."
 		return mark_safe(self.content)
 
 	def save(self, *args, **kwargs):