Using Play Framework 2 I\'ve noticed the rendered Scala HTML templates don\'t like indented @if
or @for
.
So, for example, something like that:<
Echoing on bluenote10's answer I created the following, it does not require third party libraryDependecies. It would be nice to integrate it into a filter, unfortunately I am not sure how to do that correctly today.
import play.twirl.api.Html
/** Helper to format Html */
def prettify(content: Html): Html = {
Html(content.body.trim().replaceAll("\\n\\s*\\n", "\n"))
}
def index = Action { implicit request =>
Ok(prettify(views.html.index()))
}