/** * Parses the given `template` and returns the source of a function that, * with the proper arguments, will render the template. Recognized options * include the following: * * - file The name of the file the template comes from (displayed in * error messages) * - tags An array of open and close tags the `template` uses. Defaults * to the value of Mustache.tags * - debug Set `true` to log the body of the generated function to the * console * - space Set `true` to preserve whitespace from lines that otherwise * contain only a {{tag}}. Defaults to `false` */

// is there a {{tag}} on the current line? nonSpace =false;// is there a non-space char on the current line?// Strips all space characters from the code array for the current line// if there was a {{tag}} on it and otherwise only spaces.var stripSpace =function(){if(hasTag &&!nonSpace &&!options.space){while(spaces.length){ code.splice(spaces.pop(),1);}}else{ spaces =[];}

/** * Compiles the given `template` into a reusable function using the given * `options`. In addition to the options accepted by Mustache.parse, * recognized options include the following: * * - cache Set `false` to bypass any pre-compiled version of the given * template. Otherwise, a given `template` string will be cached * the first time it is parsed */

function compile(template, options){ options = options ||{};

// Use a pre-compiled version from the cache if we have one.if(options.cache!==false){if(!_cache[template]){ _cache[template]= _compile(template, options);}

return _cache[template];}

return _compile(template, options);}

/** * High-level function that renders the given `template` using the given * `view` and `partials`. If you need to use any of the template options (see * `compile` above), you must compile in a separate step, and then call that * compiled function. */