diff --git a/ebin/rebar.app b/ebin/rebar.app index e679139..c2f3ef7 100644 --- a/ebin/rebar.app +++ b/ebin/rebar.app @@ -39,7 +39,7 @@ rebar_utils, rebar_xref, rebar_getopt, - mustache ]}, + rebar_mustache ]}, {registered, []}, {applications, [kernel, stdlib, diff --git a/src/mustache.erl b/src/rebar_mustache.erl similarity index 95% rename from src/mustache.erl rename to 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