Reputation: 71
I want the list that is ownerList to be displayed one after other, for that i am using for loop in pebble engine template. But i am getting output with html tags appended.
How to display list one after other using pebble template
<p>Greece </p>
<p>Anthony</p>
displaying with <p> and </p> tags
Greece
Anthony
I want output to print without html tags.
I have created the template
OwnerList.peb
{% for owner in ownersList%}
<p>{{ owner.dateTime }}</p>
{% endfor %}
Code
PebbleEngine engine = new PebbleEngine.Builder().build();
PebbleTemplate compiledTemplate =
engine.getTemplate("OwnerList.peb");
Map<String, Object> context = new HashMap<>();
context.put("ownerList", ownerList);
Writer writer = new StringWriter();
compiledTemplate.evaluate(writer, context);
String output = writer.toString();
Upvotes: 0
Views: 63
Reputation: 1454
Wherever you define {{ ownerList }}
you should use {{ ownerList | raw }}
instead.
Upvotes: 0