<commit_before>var jade = require('jade');
var fs = require('fs');
var path = require('path');

function rootHandler(request, response) {
  return response.render('index.jade');
}
exports.rootHandler = rootHandler;

function renderFile(filename, templateDirectory) {
  var templatePath = path.join(templateDirectory, filename);
  var template = fs.readFileSync(templatePath);
  var name = path.basename(filename, '.jade');

  var head = '(function() {' +
    'this.JST || (this.JST = {});' +
    'this.JST[' + JSON.stringify(name) + '] = ';
  var tail = '; }).call(this);';
  var fn = jade.compile(template, {filename: filename, client: true, compileDebug: false});

  return head + fn.toString() + tail;
}

function templatesHandler(request, response) {
  var templateDirectory = path.join(__dirname, '/../client_templates');
  var templates = fs.readdirSync(templateDirectory).filter(function(path) {
    return path.match(/\.jade$/);
  });
   
  var rendered = templates.map(function(path) {
    return renderFile(path, templateDirectory);
  });

  return response.send(rendered.join(''), {'Content-Type': 'application/javascript'});
}
exports.templatesHandler = templatesHandler;<commit_msg>Remove trailing spaces<commit_after>var jade = require('jade');
var fs = require('fs');
var path = require('path');

function rootHandler(request, response) {
  return response.render('index.jade');
}
exports.rootHandler = rootHandler;

function renderFile(filename, templateDirectory) {
  var templatePath = path.join(templateDirectory, filename);
  var template = fs.readFileSync(templatePath);
  var name = path.basename(filename, '.jade');

  var head = '(function() {' +
    'this.JST || (this.JST = {});' +
    'this.JST[' + JSON.stringify(name) + '] = ';
  var tail = '; }).call(this);';
  var fn = jade.compile(template, {filename: filename, client: true, compileDebug: false});

  return head + fn.toString() + tail;
}

function templatesHandler(request, response) {
  var templateDirectory = path.join(__dirname, '/../client_templates');
  var templates = fs.readdirSync(templateDirectory).filter(function(path) {
    return path.match(/\.jade$/);
  });

  var rendered = templates.map(function(path) {
    return renderFile(path, templateDirectory);
  });

  return response.send(rendered.join(''), {'Content-Type': 'application/javascript'});
}
exports.templatesHandler = templatesHandler;
{'fraction_non_alphanumeric': 0.166110183639399, 'fraction_numerical': 0.0, 'mean_word_length': 4.9925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '181769', 'n_tokens_mistral': 726, 'n_tokens_neox': 713, 'n_words': 155}