Browse Source

Disable HTML escaping in Erlang file templating

We never really need that and nobody would expect it either. We're
rendering normal files, not HTML.
pull/2170/head
Fred Hebert 5 years ago
parent
commit
fe8626ff7d
2 changed files with 8 additions and 5 deletions
  1. +6
    -3
      src/rebar_templater.erl
  2. +2
    -2
      test/rebar_new_SUITE.erl

+ 6
- 3
src/rebar_templater.erl View File

@ -431,8 +431,11 @@ write_file(Output, Data, Force) ->
{error, exists}
end.
%%
%% Render a binary to a string, using mustache and the specified context
%%
render(Bin, Context) ->
bbmustache:render(rebar_utils:to_binary(Bin), Context, [{key_type, atom}]).
bbmustache:render(
rebar_utils:to_binary(Bin),
Context,
[{key_type, atom},
{escape_fun, fun(X) -> X end}] % disable HTML-style escaping
).

+ 2
- 2
test/rebar_new_SUITE.erl View File

@ -56,12 +56,12 @@ app_git_user(Config) ->
Name = ?config(name, Config),
rebar_test_utils:run_and_check(
Config, [],
["new", "test_app", Name, "author_name=some_name"],
["new", "test_app", Name, "author_name=<some_name>"],
{ok, []}
),
validate_files(
Config, Name,
[{"LICENSE", ["some_name", "git@email.com"]},
[{"LICENSE", ["<some_name>", "git@email.com"]},
{"README.md", [Name]},
{".gitignore", []},
{"rebar.config", []},

Loading…
Cancel
Save