<commit_before>// 1. preload all the available preprocessors
var path     = require('path'),
    root     = path.resolve(path.join(__dirname, '../../')),
    jade     = require('jade'),
    coffee   = require(root + '/public/js/vendor/coffee-script'),
    markdown = require(root + '/public/js/vendor/markdown'),
    less     = require('less'),
    stylus   = require('stylus');


module.exports = {
  coffee: function (source) {
    var renderedCode = '';
    try {
      renderedCode = coffee.compile(source, {
        bare: true
      });
    } catch (e) {
      console && console.error(e.message);
    }
    return renderedCode;
  },
  jade: function (source) {
    console.log(jade);
    return jade.compile(source, { pretty: true })();
  },
  markdown: function (source) {
    return markdown.toHTML(source);
  },
  less: function (source) {
    var css = '';

    less.Parser().parse(source, function (err, result) {
      if (err) {
        console && console.error(err);
        return source;
      }
      css = result.toCSS().trim();
    });
    return css;
  },
  stylus: function (source) {
    var css = '';

    stylus(source).render(function (err, result) {
      if (err) {
        console && console.error(err);
        return;
      }
      css = result.trim();
    });
    return css;
  }
};<commit_msg>Wrap processors in try/catch - it's crashing poor Dave<commit_after>// 1. preload all the available preprocessors
var path     = require('path'),
    root     = path.resolve(path.join(__dirname, '../../')),
    jade     = require('jade'),
    coffee   = require(root + '/public/js/vendor/coffee-script'),
    markdown = require(root + '/public/js/vendor/markdown'),
    less     = require('less'),
    stylus   = require('stylus');


module.exports = {
  coffee: function (source) {
    var renderedCode = '';
    try {
      renderedCode = coffee.compile(source, {
        bare: true
      });
    } catch (e) {
      console && console.error(e.message);
    }
    return renderedCode;
  },
  jade: function (source) {
    console.log(jade);
    try {
      source = jade.compile(source, { pretty: true })();
    } catch (e) {}

    return source;
  },
  markdown: function (source) {
    try {
      source = markdown.toHTML(source);
    } catch (e) {}

    return source;
  },
  less: function (source) {
    var css = '';
    try {
      less.Parser().parse(source, function (err, result) {
        if (err) {
          console && console.error(err);
          return source;
        }
        css = result.toCSS().trim();
      });
    }
    return css;
  },
  stylus: function (source) {
    var css = '';

    try {
      stylus(source).render(function (err, result) {
        if (err) {
          console && console.error(err);
          return;
        }
        css = result.trim();
      });
    } catch (e) {}

    return css;
  }
};
{'fraction_non_alphanumeric': 0.1613240418118467, 'fraction_numerical': 0.0006968641114982578, 'mean_word_length': 2.141137855579869, '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': '4857072', 'n_tokens_mistral': 918, 'n_tokens_neox': 902, 'n_words': 201}