Merge pull request #195 from fgallaire/switch_template_instructions

Switch template instructions
This commit is contained in:
Tristan Sloughter 2014-06-14 21:55:44 -05:00
commit 29a16cbabe

View file

@ -397,6 +397,18 @@ execute_template(Files, [{'if', Cond, True, False} | Rest], TemplateType,
execute_template(Files, prepend_instructions(Instructions, Rest),
TemplateType, TemplateName, Context, Force,
ExistingFiles);
execute_template(Files, [{'case', Variable, Values, Instructions} | Rest], TemplateType,
TemplateName, Context, Force, ExistingFiles) ->
{ok, Value} = dict:find(Variable, Context),
Instructions2 = case lists:member(Value, Values) of
true ->
Instructions;
_ ->
[]
end,
execute_template(Files, prepend_instructions(Instructions2, Rest),
TemplateType, TemplateName, Context, Force,
ExistingFiles);
execute_template(Files, [{template, Input, Output} | Rest], TemplateType,
TemplateName, Context, Force, ExistingFiles) ->
InputName = filename:join(filename:dirname(TemplateName), Input),