Skip to content
Browse files

Use body content to parse mardown (and not use form-encoded)

  • Loading branch information...
1 parent 205b9da commit d3de7e16c27fb65a648562dccb7792f14b8cf8c4 @vjousse committed Apr 28, 2012
Showing with 11 additions and 13 deletions.
  1. +11 −13 app/controllers/Parsing.scala
View
24 app/controllers/Parsing.scala
@@ -16,25 +16,23 @@ object Parsing extends PygalaController {
def highlight(api: Boolean) = Action { implicit request
env.codeForm.bindFromRequest.fold(
formWithErrors BadRequest({
- for { error <- formWithErrors.errors } yield(error.message)
+ for { error formWithErrors.errors } yield (error.message)
} mkString "\n"),
value env.codeParser.colorCode(value._1, value._2).fold(
error BadRequest(error),
code api match {
- case true => Ok(code.unsafePerformIO).as(HTML)
- case false => Ok(views.html.colored(code.unsafePerformIO))
- }
- ))
+ case true Ok(code.unsafePerformIO).as(HTML)
+ case false Ok(views.html.colored(code.unsafePerformIO))
+ }))
}
- def markdown = Action { implicit request
- env.markdownForm.bindFromRequest.fold(
- formWithErrors BadRequest({
- for { error <- formWithErrors.errors } yield(error.message)
- } mkString "\n"),
- value env.markdownParser.parse(value).fold(
- error BadRequest(error),
- markdown Ok(markdown.unsafePerformIO).as(HTML)))
+ def markdown = Action {
+ implicit request
+ {
+ env.markdownParser.parse(request.body.asText.getOrElse("")).fold(
+ error BadRequest(error),
+ markdown Ok(markdown.unsafePerformIO).as(HTML))
+ }
}
def lexers = Action {

0 comments on commit d3de7e1

Please sign in to comment.
Something went wrong with that request. Please try again.