newlines in template parameters are printed as XML character entities

28 views
Skip to first unread message

hoda...@gmail.com

unread,
Oct 2, 2015, 12:39:48 PM10/2/15
to mustache.java
I'm trying to embed some newlines into a template parameter and expecting to see the newlines reproduced in the mustache output. However, it appears the newlines are converted to XML character entities. For example, if I modify the example code to change: new Feature("Awesome!") with new Feature("Awe\nsome!"), what I get as output is:

Name: Item 1
Price: $19.99
  Feature: New!
  Feature: Awe
some!
Name: Item 2
Price: $29.99
  Feature: Old.
  Feature: Ugly.

The \n has been converted to 
. Is this a bug or a feature? If this is a feature, is there a way to disable it?

Thanks.

hoda...@gmail.com

unread,
Oct 2, 2015, 3:45:24 PM10/2/15
to mustache.java
Never mind, I read the friendly manual and realized I need to use triple-mustache templates.
Reply all
Reply to author
Forward
0 new messages