The template ${templateName} does not compile : expecting anything but ''\n''; got it anyway

2,521 views
Skip to first unread message

Ef Rb

unread,
Oct 17, 2011, 1:55:24 PM10/17/11
to play-framework
Hi!.

I'm trying to solve this problem I which I can't fixed (and it is
supposed that
is already fixed).

I don't know, why, I'm using Play 1.2.3, and I haven't experimented
this
trouble before.

I hope you can help me.

From now, thank you.

Christian Koch

unread,
Oct 17, 2011, 2:12:48 PM10/17/11
to play-fr...@googlegroups.com
Without source it's hard to help. I had this message, too. It was a simple syntax error while using the template language.

Ef Rb

unread,
Oct 17, 2011, 2:18:48 PM10/17/11
to play-framework
Well...the code throws the error when I add any line.

Here is the "buggy code": http://pastebin.com/8RFwaNab

But if I just type in the file:
==========CODE==========
#{extends 'parentTemplate.html' /}
Testing, it is bad
=======END CODE=========

Then I save it and then I refresh I get the same error.

Ef Rb

unread,
Oct 17, 2011, 3:44:39 PM10/17/11
to play-framework
This comes even weirder, I have a template that shares lots of
code with this one. But, I wrote all the code inline:
#{extends 'parentTemplate.html' /}Testing it is working...

And I have no problems...but when I type an enter after the extends
tag
I get the message: "The template ${templateName} does not compile :
expecting anything but ''\n''; got it anyway "

I think this is very weird, because, I have 2 templates a.html and
b.html, so the a.html template extends from origin.html,
and b.html also extends from origin.html but when I type an enter
inside the b.html template I get an error...I will to go back to
Play 1.1 to see if I get this error or not.

Ef Rb

unread,
Oct 17, 2011, 3:53:18 PM10/17/11
to play-framework
Same error using play 1.1.2, I don't get where is the error and all I
get is:
"The template /app/views/Companies/companyInformation.html does not
compile : expecting anything but ''\n''; got it anyway"

Sorry If I'm getting annoying, but I don't know what is happening.

Brian Nesbitt

unread,
Oct 17, 2011, 3:55:52 PM10/17/11
to play-fr...@googlegroups.com
Not sure but sounds like a quote/fancy quote issue (or not closed) or a file newline (windows/linux) issue?!?

Ef Rb

unread,
Oct 17, 2011, 4:06:04 PM10/17/11
to play-framework
It could be...but I'm trying again to do it with just html (no
extending templates) and I get the same error...the code
of the template:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html;
charset=UTF-8' />
<title>Company information</title>
</head>
<body>
Testing...
</body>
</html>

Again, what I get is: "The template /app/views/Companies/
companyInformation.html does not compile: expecting anything but "\n";
got it anyway"

I have tried also " instead '.

Brian Nesbitt

unread,
Oct 17, 2011, 4:14:54 PM10/17/11
to play-fr...@googlegroups.com
If I change the file type to Unicode I get that error as well.

Encode it as ANSI or UTF-8.

What platform are you on?  What editor do you use?

Ef Rb

unread,
Oct 18, 2011, 10:43:52 AM10/18/11
to play-framework
I'm using IntelliJ IDEA 10 Community on Snow Leopard...

As you can see I'm encoding the file as UTF-8 using the html
tag meta, or are you telling me other way of encode?

Brian Nesbitt

unread,
Oct 18, 2011, 10:54:29 AM10/18/11
to play-fr...@googlegroups.com
No, not the same thing.

In the status bar at the bottom there should be a select list that has different file encoding types.  Its the encoding of the file sitting on the drive, not how you are rendering it to the browser.  You probably have "Unicode" selected... just switch it to "UTF-8".

Ef Rb

unread,
Oct 18, 2011, 12:38:56 PM10/18/11
to play-framework
Still not working...I switched the file encoding to UTF-8, I created
the template again then I ran the project and I still get a: The
template ${templateName} does not compile : expecting anything but
''\n''; got it anyway

The weir of this is that when I don't break lines (type enter) I don't
get the error...I mean, when I write like this:
<!DOCTYPE html><html><head><title></title></head><body>Beetween love
and hate</body></html>
I have no problems...But if I write like:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
Beetween love and hate
</body>
</html>

I get the message previously mentioned.

On 18 oct, 08:54, Brian Nesbitt <br...@nesbot.com> wrote:
> No, not the same thing.
>
> In the status bar at the bottom there should be a select list that has
> different file encoding types.  Its the encoding of the file sitting on the
> drive, not how you are rendering it to the browser.  You probably have
> "Unicode" selected... just switch it to "UTF-8".
>
> http://www.jetbrains.com/idea/webhelp/configuring-individual-file-enc...http://www.jetbrains.com/idea/webhelp/file-encodings.html

Brian Nesbitt

unread,
Oct 18, 2011, 1:40:06 PM10/18/11
to play-fr...@googlegroups.com
If you do a search online for that error lots of stuff comes up about the groovy compiler and newlines.  I am on windows so I can't really try too much here to help you.

Ef Rb

unread,
Oct 18, 2011, 2:54:58 PM10/18/11
to play-framework
Yes it seems to be a problem with groovy compiler...

Drew Hamlett

unread,
Oct 20, 2011, 2:08:26 PM10/20/11
to play-framework
I saw this a couple days ago. The issue was I had an image in the app/
views directory. It was weird. I removed it and it started working.
Although I did a play clean too. Make sure your app/views directory
just has html files in it.
Reply all
Reply to author
Forward
0 new messages