|
|
a331d75 |
From: Peter Lemenkov <lemenkov@gmail.com>
|
|
|
a331d75 |
Date: Wed, 16 Mar 2016 14:42:24 +0300
|
|
|
a331d75 |
Subject: [PATCH] Double-quites escaping is no longer necessary
|
|
|
a331d75 |
|
|
|
a331d75 |
It seems that double-quites escaping is no longer necessary with a
|
|
|
a331d75 |
recent erlang-mustache.
|
|
|
a331d75 |
|
|
|
a331d75 |
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
|
|
a331d75 |
|
|
|
a331d75 |
diff --git a/src/cuttlefish_unit.erl b/src/cuttlefish_unit.erl
|
|
|
a331d75 |
index 3db7551..4722668 100644
|
|
|
a331d75 |
--- a/src/cuttlefish_unit.erl
|
|
|
a331d75 |
+++ b/src/cuttlefish_unit.erl
|
|
|
a331d75 |
@@ -18,14 +18,7 @@ generate_templated_config(FileName, Conf, Context, PreexistingSchema) ->
|
|
|
a331d75 |
|
|
|
a331d75 |
render_template(FileName, Context) ->
|
|
|
a331d75 |
{ok, Bin} = file:read_file(FileName),
|
|
|
a331d75 |
- %% Stolen from rebar_templater:render/2
|
|
|
a331d75 |
- %% Be sure to escape any double-quotes before rendering...
|
|
|
a331d75 |
- ReOpts = [global, {return, list}],
|
|
|
a331d75 |
- Str0 = re:replace(Bin, "\\\\", "\\\\\\", ReOpts),
|
|
|
a331d75 |
- Str1 = re:replace(Str0, "\"", "\\\\\"", ReOpts),
|
|
|
a331d75 |
-
|
|
|
a331d75 |
- %% the mustache module is only available in the context of a rebar run.
|
|
|
a331d75 |
- mustache:render(Str1, dict:from_list(Context)).
|
|
|
a331d75 |
+ mustache:render(binary_to_list(Bin), dict:from_list(Context)).
|
|
|
a331d75 |
|
|
|
a331d75 |
-spec generate_config(atom(), [string()]|string(), list()) -> list().
|
|
|
a331d75 |
generate_config(strings, SchemaStrings, Conf) ->
|