<commit_before>/**
 * Methods for rendering a template.
 */
const nunjucks = require('nunjucks');

let env;

/**
 * Render a template with given context variables.
 * @param {string} template  Template name, excluding the extension.
 * @param {object} variables Object of variables to interpolate in the
 *   template.
 * @param {File=} file File object used to get more information. Optional.
 * @return {string} Rendered template.
 */
exports.render = function(template, variables, file) {
  if (!env) {
    return '';
  }

  if (template) {
    return env.render(`${template}.html`, variables);
  } else {
    return env.renderString(file.content, variables);
  }
};

/**
 * Exposed method to configure template engine.
 * @param {string|Array.<string>} paths Either an array of paths or a singular
 *   path that we can load templates from.
 */
exports.configure = function(paths) {
  env = new nunjucks.Environment(new nunjucks.FileSystemLoader(paths));<commit_msg>Restore behavior of nunjucks to not autescape<commit_after>/**
 * Methods for rendering a template.
 */
const nunjucks = require('nunjucks');

let env;

/**
 * Render a template with given context variables.
 * @param {string} template  Template name, excluding the extension.
 * @param {object} variables Object of variables to interpolate in the
 *   template.
 * @param {File=} file File object used to get more information. Optional.
 * @return {string} Rendered template.
 */
exports.render = function(template, variables, file) {
  if (!env) {
    return '';
  }

  if (template) {
    return env.render(`${template}.html`, variables);
  } else {
    return env.renderString(file.content, variables);
  }
};

/**
 * Exposed method to configure template engine.
 * @param {string|Array.<string>} paths Either an array of paths or a singular
 *   path that we can load templates from.
 */
exports.configure = function(paths) {
  env = new nunjucks.Environment(new nunjucks.FileSystemLoader(paths), {
    autoescape: false
  });
{'fraction_non_alphanumeric': 0.1199400299850075, 'fraction_numerical': 0.0, 'mean_word_length': 3.8948655256723717, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2719368', 'n_tokens_mistral': 573, 'n_tokens_neox': 566, 'n_words': 203}