|
|
@ -59,7 +59,7 @@ list_templates(State) -> |
|
|
|
|
|
|
|
%% Expand a single template's value |
|
|
|
list_template(Files, {Name, Type, File}, State) -> |
|
|
|
case rebar_string:consult(binary_to_list(load_file(Files, Type, File))) of |
|
|
|
case consult_template(Files, Type, File) of |
|
|
|
{error, Reason} -> |
|
|
|
{error, {consult, File, Reason}}; |
|
|
|
TemplateTerms -> |
|
|
@ -158,7 +158,7 @@ drop_var_docs([{K,V}|Rest]) -> [{K,V} | drop_var_docs(Rest)]. |
|
|
|
%% Load the template index, resolve all variables, and then execute |
|
|
|
%% the template. |
|
|
|
create({Template, Type, File}, Files, UserVars, Force, State) -> |
|
|
|
TemplateTerms = rebar_string:consult(binary_to_list(load_file(Files, Type, File))), |
|
|
|
TemplateTerms = consult_template(Files, Type, File), |
|
|
|
Vars = drop_var_docs(override_vars(UserVars, get_template_vars(TemplateTerms, State))), |
|
|
|
maybe_warn_about_name(Vars), |
|
|
|
TemplateCwd = filename:dirname(File), |
|
|
@ -439,3 +439,7 @@ render(Bin, Context) -> |
|
|
|
[{key_type, atom}, |
|
|
|
{escape_fun, fun(X) -> X end}] % disable HTML-style escaping |
|
|
|
). |
|
|
|
|
|
|
|
consult_template(Files, Type, File) -> |
|
|
|
TemplateBin = load_file(Files, Type, File), |
|
|
|
rebar_string:consult(TemplateBin, epp:read_encoding_from_binary(TemplateBin)). |