diff --git a/parser/src/main/scala/play/twirl/parser/TwirlParser.scala b/parser/src/main/scala/play/twirl/parser/TwirlParser.scala index 903b6a3a..1d8d5f0d 100644 --- a/parser/src/main/scala/play/twirl/parser/TwirlParser.scala +++ b/parser/src/main/scala/play/twirl/parser/TwirlParser.scala @@ -902,8 +902,13 @@ class TwirlParser(val shouldParseInclusiveDot: Boolean) { input.regress(1) val p = input.offset() val args = templateArgs() - if (args != null) Some(position(PosString(args), p)) - else None + if (args != null) { + val result = position(PosString(args), p) + check("\n") + Some(result) + } else { + None + } } else None } diff --git a/sbt-twirl/src/sbt-test/twirl/compile/src/test/scala/test/Test.scala b/sbt-twirl/src/sbt-test/twirl/compile/src/test/scala/test/Test.scala index fb6b8cdd..24c31da3 100644 --- a/sbt-twirl/src/sbt-test/twirl/compile/src/test/scala/test/Test.scala +++ b/sbt-twirl/src/sbt-test/twirl/compile/src/test/scala/test/Test.scala @@ -7,7 +7,7 @@ object Test extends App { assert(template.body == expected, s"Found '$template' but expected '$expected'") } - test(a.b.html.c.render("world"), "\nHello, world.\n") + test(a.b.html.c.render("world"), "Hello, world.\n") - test(html.template.render("42"), "\nAnswer: 42\n") + test(html.template.render("42"), "Answer: 42\n") } diff --git a/sbt-twirl/src/sbt-test/twirl/scalajs-compile/src/main/scala/Test.scala b/sbt-twirl/src/sbt-test/twirl/scalajs-compile/src/main/scala/Test.scala index 174551d3..a4cc16f4 100644 --- a/sbt-twirl/src/sbt-test/twirl/scalajs-compile/src/main/scala/Test.scala +++ b/sbt-twirl/src/sbt-test/twirl/scalajs-compile/src/main/scala/Test.scala @@ -6,7 +6,7 @@ object Test extends App { assert(template.body == expected, s"Found '$template' but expected '$expected'") } - test(a.b.html.c.render("world"), "\nHello, world.\n") + test(a.b.html.c.render("world"), "Hello, world.\n") - test(html.template.render("42"), "\nAnswer: 42\n") + test(html.template.render("42"), "Answer: 42\n") }