summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2013-12-05 22:02:12 +0100
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2014-01-01 10:59:34 +0100
commit34ead92c8332ce8681d3cd54561562a2eac9b43e (patch)
treeff145e0df19b00c1deefa95b381b044863ec448a /src
parent777fefe181521b497e2c23b955be7bea48bf2950 (diff)
Fix #187 (rename mustache to rebar_mustache)
Diffstat (limited to 'src')
-rw-r--r--src/rebar_mustache.erl (renamed from src/mustache.erl)10
-rw-r--r--src/rebar_templater.erl2
2 files changed, 7 insertions, 5 deletions
diff --git a/src/mustache.erl b/src/rebar_mustache.erl
index f6963cd..9016c0f 100644
--- a/src/mustache.erl
+++ b/src/rebar_mustache.erl
@@ -23,7 +23,7 @@
%% See the README at http://github.com/mojombo/mustache.erl for additional
%% documentation and usage examples.
--module(mustache). %% v0.1.0
+-module(rebar_mustache). %% v0.1.0
-author("Tom Preston-Werner").
-export([compile/1, compile/2, render/1, render/2, render/3, get/2, get/3, escape/1, start/1]).
@@ -31,6 +31,8 @@
section_re = undefined,
tag_re = undefined}).
+-define(MUSTACHE_STR, "rebar_mustache").
+
compile(Body) when is_list(Body) ->
State = #mstate{},
CompiledTemplate = pre_compile(Body, State),
@@ -108,7 +110,7 @@ compile_section(Name, Content, State) ->
Mod = State#mstate.mod,
Result = compiler(Content, State),
"fun() -> " ++
- "case mustache:get(" ++ Name ++ ", Ctx, " ++ atom_to_list(Mod) ++ ") of " ++
+ "case " ++ ?MUSTACHE_STR ++ ":get(" ++ Name ++ ", Ctx, " ++ atom_to_list(Mod) ++ ") of " ++
"\"true\" -> " ++
Result ++ "; " ++
"\"false\" -> " ++
@@ -143,10 +145,10 @@ tag_kind(T, {K0, K1}) ->
compile_tag(none, Content, State) ->
Mod = State#mstate.mod,
- "mustache:escape(mustache:get(" ++ Content ++ ", Ctx, " ++ atom_to_list(Mod) ++ "))";
+ ?MUSTACHE_STR ++ ":escape(" ++ ?MUSTACHE_STR ++ ":get(" ++ Content ++ ", Ctx, " ++ atom_to_list(Mod) ++ "))";
compile_tag("{", Content, State) ->
Mod = State#mstate.mod,
- "mustache:get(" ++ Content ++ ", Ctx, " ++ atom_to_list(Mod) ++ ")";
+ ?MUSTACHE_STR ++ ":get(" ++ Content ++ ", Ctx, " ++ atom_to_list(Mod) ++ ")";
compile_tag("!", _Content, _State) ->
"[]".
diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl
index c21daa3..43bb8da 100644
--- a/src/rebar_templater.erl
+++ b/src/rebar_templater.erl
@@ -103,7 +103,7 @@ render(Bin, Context) ->
ReOpts = [global, {return, list}],
Str0 = re:replace(Bin, "\\\\", "\\\\\\", ReOpts),
Str1 = re:replace(Str0, "\"", "\\\\\"", ReOpts),
- mustache:render(Str1, Context).
+ rebar_mustache:render(Str1, Context).
%% ===================================================================
%% Internal functions