Skip to content

Commit

Permalink
newLine at end of @this(...) and @(...) are not part of content (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurz authored and marcospereira committed Feb 22, 2018
1 parent ec75217 commit a351758
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions parser/src/main/scala/play/twirl/parser/TwirlParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit a351758

Please sign in to comment.