Permalink
Browse files

Fix indentation according to erlang-mode.

My apologies for anyone having outstanding changes, getting a lot of
conflicts due to this. But it is a pain to keep the code tidy with
disagreeing indentation policies.
  • Loading branch information...
1 parent 70caeb6 commit c484084b59598a8480beb67bb1a4b1584117393b @kaos kaos committed Dec 9, 2013
View
@@ -1,7 +1,7 @@
%% -*- mode: erlang -*-
{application, erlydtl,
[{description, "ErlyDTL compiles the Django Template Language to Erlang bytecode"},
- {vsn, "0.7.0"},
+ {vsn, git},
{modules, [
]},
{applications, [kernel, stdlib, compiler, syntax_tools]},
View
@@ -3,9 +3,9 @@
%%% @author Roberto Saccon <rsaccon@gmail.com> [http://rsaccon.com]
%%% @author Evan Miller <emmiller@gmail.com>
%%% @copyright 2008 Roberto Saccon, Evan Miller
-%%% @doc
+%%% @doc
%%% Public interface for ErlyDTL
-%%% @end
+%%% @end
%%%
%%% The MIT License
%%%
View
Oops, something went wrong.
@@ -3,16 +3,16 @@
-export([intcomma/1]).
intcomma(Value) when is_integer(Value) ->
- intcomma(integer_to_list(Value));
+ intcomma(integer_to_list(Value));
intcomma(Value) ->
- ValueBin = iolist_to_binary(Value),
- intcomma(ValueBin, size(ValueBin) rem 3, <<>>).
+ ValueBin = iolist_to_binary(Value),
+ intcomma(ValueBin, size(ValueBin) rem 3, <<>>).
intcomma(<<>>, _, Acc) ->
- Acc;
+ Acc;
intcomma(<< C, Rest/bits >>, 0, <<>>) ->
- intcomma(Rest, 2, << C >>);
+ intcomma(Rest, 2, << C >>);
intcomma(<< C, Rest/bits >>, 0, Acc) ->
- intcomma(Rest, 2, << Acc/binary, $,, C >>);
+ intcomma(Rest, 2, << Acc/binary, $,, C >>);
intcomma(<< C, Rest/bits >>, N, Acc) ->
- intcomma(Rest, N - 1, << Acc/binary, C >>).
+ intcomma(Rest, N - 1, << Acc/binary, C >>).
View
@@ -3,9 +3,9 @@
%%% @author Roberto Saccon <rsaccon@gmail.com> [http://rsaccon.com]
%%% @author Evan Miller <emmiller@gmail.com>
%%% @copyright 2008 Roberto Saccon, Evan Miller
-%%% @doc
+%%% @doc
%%% ErlyDTL helper module
-%%% @end
+%%% @end
%%%
%%% The MIT License
%%%
@@ -53,7 +53,7 @@ get_base_dir(Module) ->
%% get_base_dir(?MODULE).
get_base_dir() ->
get_base_dir(?MODULE).
-
+
%%====================================================================
%% Internal functions
%%====================================================================
View
@@ -35,7 +35,7 @@ find_value(Key, {GBSize, GBData}) when is_integer(GBSize) ->
end;
find_value(Key, Tuple) when is_tuple(Tuple) ->
case element(1, Tuple) of
- dict ->
+ dict ->
case dict:find(Key, Tuple) of
{ok, Val} ->
Val;
@@ -61,8 +61,8 @@ find_value(Key, Tuple) when is_tuple(Tuple) ->
find_deep_value([Key|Rest],Item) ->
case find_value(Key,Item) of
- undefined -> undefined;
- NewItem -> find_deep_value(Rest,NewItem)
+ undefined -> undefined;
+ NewItem -> find_deep_value(Rest,NewItem)
end;
find_deep_value([],Item) -> Item.
@@ -226,22 +226,22 @@ init_counter_stats(List) ->
init_counter_stats(List, undefined).
init_counter_stats(List, Parent) when is_list(List) ->
- [{counter, 1},
- {counter0, 0},
- {revcounter, length(List)},
- {revcounter0, length(List) - 1},
- {first, true},
- {last, length(List) =:= 1},
- {parentloop, Parent}].
+ [{counter, 1},
+ {counter0, 0},
+ {revcounter, length(List)},
+ {revcounter0, length(List) - 1},
+ {first, true},
+ {last, length(List) =:= 1},
+ {parentloop, Parent}].
increment_counter_stats([{counter, Counter}, {counter0, Counter0}, {revcounter, RevCounter},
- {revcounter0, RevCounter0}, {first, _}, {last, _}, {parentloop, Parent}]) ->
+ {revcounter0, RevCounter0}, {first, _}, {last, _}, {parentloop, Parent}]) ->
[{counter, Counter + 1},
- {counter0, Counter0 + 1},
- {revcounter, RevCounter - 1},
- {revcounter0, RevCounter0 - 1},
- {first, false}, {last, RevCounter0 =:= 1},
- {parentloop, Parent}].
+ {counter0, Counter0 + 1},
+ {revcounter, RevCounter - 1},
+ {revcounter0, RevCounter0 - 1},
+ {first, false}, {last, RevCounter0 =:= 1},
+ {parentloop, Parent}].
forloop(Fun, Acc0, Values) ->
push_ifchanged_context(),
@@ -251,9 +251,9 @@ forloop(Fun, Acc0, Values) ->
push_ifchanged_context() ->
IfChangedContextStack = case get(?IFCHANGED_CONTEXT_VARIABLE) of
- undefined -> [];
- Stack -> Stack
- end,
+ undefined -> [];
+ Stack -> Stack
+ end,
put(?IFCHANGED_CONTEXT_VARIABLE, [[]|IfChangedContextStack]).
pop_ifchanged_context() ->
@@ -296,8 +296,8 @@ spaceless(Contents) ->
read_file(Module, Function, DocRoot, FileName) ->
AbsName = case filename:absname(FileName) of
- FileName -> FileName;
- _ -> filename:join([DocRoot, FileName])
- end,
+ FileName -> FileName;
+ _ -> filename:join([DocRoot, FileName])
+ end,
{ok, Binary} = Module:Function(AbsName),
binary_to_list(Binary).
View
@@ -33,55 +33,55 @@ unparse([{'filter', FilterList, Contents}|Rest], Acc) ->
unparse([{'firstof', Vars}|Rest], Acc) ->
unparse(Rest, [["{% firstof ", unparse(Vars), " %}"]|Acc]);
unparse([{'for', {'in', IteratorList, Identifier}, Contents}|Rest], Acc) ->
- unparse(Rest, [["{% for ", unparse_identifier(Identifier), " in ", unparse(IteratorList), " %}",
- unparse(Contents),
- "{% endfor %}"]|Acc]);
+ unparse(Rest, [["{% for ", unparse_identifier(Identifier), " in ", unparse(IteratorList), " %}",
+ unparse(Contents),
+ "{% endfor %}"]|Acc]);
unparse([{'for', {'in', IteratorList, Identifier}, Contents, EmptyPartsContents}|Rest], Acc) ->
unparse(Rest, [["{% for ", unparse_identifier(Identifier), " in ", unparse(IteratorList), " %}",
- unparse(Contents),
- "{% empty %}",
- unparse(EmptyPartsContents),
- "{% endfor %}"]|Acc]);
+ unparse(Contents),
+ "{% empty %}",
+ unparse(EmptyPartsContents),
+ "{% endfor %}"]|Acc]);
unparse([{'if', Expression, Contents}|Rest], Acc) ->
unparse(Rest, [["{% if ", unparse_expression(Expression), " %}",
- unparse(Contents),
- "{% endif %}"]|Acc]);
+ unparse(Contents),
+ "{% endif %}"]|Acc]);
unparse([{'ifchanged', Expression, IfContents}|Rest], Acc) ->
unparse(Rest, [["{% ifchanged ", unparse_expression(Expression), " %}",
- unparse(IfContents),
- "{% endifchanged %}"]|Acc]);
+ unparse(IfContents),
+ "{% endifchanged %}"]|Acc]);
unparse([{'ifchangedelse', Expression, IfContents, ElseContents}|Rest], Acc) ->
unparse(Rest, [["{% ifchanged ", unparse_expression(Expression), " %}",
- unparse(IfContents),
- "{% else %}",
- unparse(ElseContents),
- "{% endifchanged %}"]|Acc]);
+ unparse(IfContents),
+ "{% else %}",
+ unparse(ElseContents),
+ "{% endifchanged %}"]|Acc]);
unparse([{'ifelse', Expression, IfContents, ElseContents}|Rest], Acc) ->
unparse(Rest, [["{% if ", unparse_expression(Expression), " %}",
- unparse(IfContents),
- "{% else %}",
- unparse(ElseContents),
- "{% endif %}"]|Acc]);
+ unparse(IfContents),
+ "{% else %}",
+ unparse(ElseContents),
+ "{% endif %}"]|Acc]);
unparse([{'ifequal', [Arg1, Arg2], Contents}|Rest], Acc) ->
unparse(Rest, [["{% ifequal ", unparse_value(Arg1), " ", unparse_value(Arg2), " %}",
- unparse(Contents),
- "{% endifequal %}"]|Acc]);
+ unparse(Contents),
+ "{% endifequal %}"]|Acc]);
unparse([{'ifequalelse', [Arg1, Arg2], IfContents, ElseContents}|Rest], Acc) ->
unparse(Rest, [["{% ifequal ", unparse_value(Arg1), " ", unparse_value(Arg2), " %}",
- unparse(IfContents),
- "{% else %}",
- unparse(ElseContents),
- "{% endifequal %}"]|Acc]);
+ unparse(IfContents),
+ "{% else %}",
+ unparse(ElseContents),
+ "{% endifequal %}"]|Acc]);
unparse([{'ifnotequal', [Arg1, Arg2], Contents}|Rest], Acc) ->
unparse(Rest, [["{% ifnotequal ", unparse_value(Arg1), " ", unparse_value(Arg2), " %}",
- unparse(Contents),
- "{% endifnotequal %}"]|Acc]);
+ unparse(Contents),
+ "{% endifnotequal %}"]|Acc]);
unparse([{'ifnotequalelse', [Arg1, Arg2], IfContents, ElseContents}|Rest], Acc) ->
unparse(Rest, [["{% ifnotequal ", unparse_value(Arg1), " ", unparse_value(Arg2), " %}",
- unparse(IfContents),
- "{% else %}",
- unparse(ElseContents),
- "{% endifnotequal %}"]|Acc]);
+ unparse(IfContents),
+ "{% else %}",
+ unparse(ElseContents),
+ "{% endifnotequal %}"]|Acc]);
unparse([{'include', Value, []}|Rest], Acc) ->
unparse(Rest, [["{% include ", unparse_value(Value), " %}"]|Acc]);
unparse([{'include', Value, Args}|Rest], Acc) ->
@@ -92,8 +92,8 @@ unparse([{'include_only', Value, Args}|Rest], Acc) ->
unparse(Rest, [["{% include ", unparse_value(Value), " with ", unparse_args(Args), " only %}"]|Acc]);
unparse([{'regroup', {Variable, Identifier1, Identifier2}, Contents}|Rest], Acc) ->
unparse(Rest, [["{% regroup ", unparse_value(Variable), " by ", unparse_identifier(Identifier1), " as ", unparse_identifier(Identifier2), " %}",
- unparse(Contents),
- "{% endregroup %}"]|Acc]);
+ unparse(Contents),
+ "{% endregroup %}"]|Acc]);
unparse([{'spaceless', Contents}|Rest], Acc) ->
unparse(Rest, [["{% spaceless %}", unparse(Contents), "{% endspaceless %}"]|Acc]);
unparse([{'ssi', Arg}|Rest], Acc) ->
@@ -114,8 +114,8 @@ unparse([{'widthratio', Numerator, Denominator, Scale}|Rest], Acc) ->
unparse(Rest, [["{% widthratio ", unparse_value(Numerator), " ", unparse_value(Denominator), " ", unparse_value(Scale), " %}"]|Acc]);
unparse([{'with', Args, Contents}|Rest], Acc) ->
unparse(Rest, [["{% with ", unparse_args(Args), " %}",
- unparse(Contents),
- "{% endwidth %}"]|Acc]);
+ unparse(Contents),
+ "{% endwidth %}"]|Acc]);
unparse([ValueToken|Rest], Acc) ->
unparse(Rest, [["{{ ", unparse_value(ValueToken), " }}"]|Acc]).
Oops, something went wrong.

0 comments on commit c484084

Please sign in to comment.