Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newLine at end of @this(...) and @(...) are not part of content #169

Merged
merged 1 commit into from
Feb 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
}