code: function(str, vars) {
  			vars = vars || {};
  			var resolver = typeof vars === 'function' ? vars : function(str, p1) {
  				return p1 in vars ? vars[p1] : null;
  			};
  			
  			return this.processText(str, {
  				variable: function(data) {
  					var newValue = resolver(data.token, data.name, data);
  					if (newValue === null) {
  						// try to find variable in resources
  						newValue = resources.getVariable(data.name);
  					}
  					
  					if (newValue === null || typeof newValue === 'undefined')
  						// nothing found, return token itself
  						newValue = data.token;
  					return newValue;
  				}
  			});
  		}
docs: Replace variables like ${var} in string
  @param {String} str
  @param {Object} vars Variable set (defaults to variables defined in
  <code>snippets.json</code>) or variable resolver (<code>Function</code>)
  @return {String}