Skip to content

Commit

Permalink
Don't escape values in list filter (output tab)
Browse files Browse the repository at this point in the history
For that we also use the "interpolate" delimiter in _.template.

Fixes #572
  • Loading branch information
pgiraud committed Mar 20, 2023
1 parent e4f8a8a commit 9e53a2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ export function percent(value: number): string {

export function list(value: string[] | string): string {
if (typeof value === "string") {
value = _.escape(value).split(/\s*,\s*/)
value = value.split(/\s*,\s*/)
}
const compiled = _.template(
"<% _.forEach(lines, function(line) { %><li><%- line %></li><% }); %>"
"<% _.forEach(lines, function(line) { %><li><%= line %></li><% }); %>"
)
return '<ul class="list-unstyled">' + compiled({ lines: value }) + "</ul>"
}
Expand Down

0 comments on commit 9e53a2d

Please sign in to comment.