14 December 2011

How to solve problem with "illegal colon after argument expression" in template in play framework

bug exists in play framwork (1.2.3 and earlier versions and according to play site it will not fixed in 1.2.4 and 1.2.5) .

BUG: when you use multiline tag is template then ,play framwork give error "illegal colon after argument expression" in return :(.

CASE:
Template compilation error
The template /app/views/Books/list.html does not compile : illegal colon after argument expression; solution: a complex label expression before a colon must be parenthesized

example:

#{crud.table fields:['image','title','category','shortlisted'],
sort:['title', 'category', 'shortlisted']}


PROBLEM CAUSED BY:
template parser doesn't like CRLF line-breaks.


SOLUTION:
1)Make sure that multiline is correct!
2)If your file using (CRLF line-breaks (Windows style)).You need change to LF on Windows.

a) in Netbeans
you need download plugin "show-and-change-line-endings from this page : http://plugins.netbeans.org/plugin/36810/show-and-change-line-endings

b) in Eclipse
File -> Convert Line Delimiters To

x)if your IDE cannot convert CRLF to LF then use text editor like Notepad++ to change Break lines

BAD NEWS IS : if you use Git remote repo's keep in mind that you need change this quite often.

SOURCE : https://play.lighthouseapp.com/projects/57987/tickets/107-multiline-tags-not-working-in-windows