diff --git a/src/g-component.html b/src/g-component.html
index 49f32adf..76e5f674 100644
--- a/src/g-component.html
+++ b/src/g-component.html
@@ -440,12 +440,24 @@ license that can be found in the LICENSE file.
}
};
+ // string interpolation
+ var macroize = function(inText, inMap, inPattern) {
+ var result = inText, pattern = inPattern || macroize.pattern;
+ var fn = function(macro, name) {
+ var v = inMap[name];
+ return (v === undefined || v === null) ? macro : v;
+ };
+ result = result.replace(pattern, fn);
+ return result;
};
+ // Matches macros of the form {{name}}.
+ macroize.pattern = /\{{([^{}]*)\}}/g;
// collect utils
var utils = {
job: job,
+ macroize: macroize,
findDistributedTarget: findDistributedTarget
};