<commit_before>/**
 * Fix for the Ruby Rhino
 */
if (!String.prototype.trim) {
    String.prototype.trim = function () {
        return this.replace(/^\s*/, "").replace(/\s*$/, "");
    }
}

/**
 * Haml Coffee Asset compiler.
 */
var HamlCoffeeAssets = (function(){

    var Compiler = require('/haml-coffee.js');

    return {

      /**
       * Compile the HAML Coffee template to JavaScript
       *
       * @param name [String] the name of the template that is registered to the namespace
       * @param source [String] the template source code to be compiled
       * @param namespace [String] the template namespace
       * @param jst [Boolean] if a JST template should be generated
       * @param format [String] output HTML format
       * @param uglify [Boolean] skip HTML indention
       * @param basename [Boolean] ignore path when generate JST
       * @param escapeHtml [Boolean] whether to escape HTML output by default or not
       * @param escapeAttributes [Boolean] whether to escape HTML attributes output by default or not
       * @param customHtmlEscape [String] the name of the function to escape the output
       * @param customCleanValue [String] the name of the function to clean the code output
       * @param customSurround [String] the name of the function for the surround helper
       * @param customSucceed [String] the name of the function for the succeed helper
       * @param customPrecede [String] the name of the function for the precede helper
       * @param preserveTags [String] comma separated list of tags to preserve whitespace
       * @param selfCloseTags [String] comma separated list of tags to self-closing tags
       * @param context [String] the name of the function to merge contexts
       */
      compile: function(name, source, jst, namespace, format, uglify, basename,
                        escapeHtml, escapeAttributes, cleanValue,
                        customHtmlEscape, customCleanValue, customPreserve, customFindAndPreserve,
                        customSurround, customSucceed, customPrecede,
                        preserveTags, selfCloseTags,
                        context) {

        var compiler = new Compiler({
          format: format,
          uglify: uglify,
          basename: basename,
          escapeHtml: escapeHtml,
          escapeAttributes: escapeAttributes,
          cleanValue: cleanValue,
          customHtmlEscape: customHtmlEscape,
          customCleanValue: customCleanValue,
          customPreserve: customPreserve,
          customFindAndPreserve: customFindAndPreserve,
          customSurround: customSurround,
          customSucceed: customSucceed,
          customPrecede: customPrecede,
          preserveTags: preserveTags,
          selfCloseTags: selfCloseTags
        });

        compiler.parse(source);

        var template;

        if (jst) {
          template = CoffeeScript.compile(compiler.render(name, namespace));
        } else {
          template = CoffeeScript.compile('(context) -> ( ->\n' + compiler.precompile().replace(/^(.*)$/mg, '  $1') + ').call(context)', { bare: true });
        }

        if (context !== '') {
          template = template.replace('.call(context);', '.call(' + context +'(context));');
        }

        return template;
      }

    }
 })();<commit_msg>Define JST wrapper function in JavaScript to fix CoffeeScript => operator.<commit_after>/**
 * Fix for the Ruby Rhino
 */
if (!String.prototype.trim) {
    String.prototype.trim = function () {
        return this.replace(/^\s*/, "").replace(/\s*$/, "");
    }
}

/**
 * Haml Coffee Asset compiler.
 */
var HamlCoffeeAssets = (function(){

    var Compiler = require('/haml-coffee.js');

    return {

      /**
       * Compile the HAML Coffee template to JavaScript
       *
       * @param name [String] the name of the template that is registered to the namespace
       * @param source [String] the template source code to be compiled
       * @param namespace [String] the template namespace
       * @param jst [Boolean] if a JST template should be generated
       * @param format [String] output HTML format
       * @param uglify [Boolean] skip HTML indention
       * @param basename [Boolean] ignore path when generate JST
       * @param escapeHtml [Boolean] whether to escape HTML output by default or not
       * @param escapeAttributes [Boolean] whether to escape HTML attributes output by default or not
       * @param customHtmlEscape [String] the name of the function to escape the output
       * @param customCleanValue [String] the name of the function to clean the code output
       * @param customSurround [String] the name of the function for the surround helper
       * @param customSucceed [String] the name of the function for the succeed helper
       * @param customPrecede [String] the name of the function for the precede helper
       * @param preserveTags [String] comma separated list of tags to preserve whitespace
       * @param selfCloseTags [String] comma separated list of tags to self-closing tags
       * @param context [String] the name of the function to merge contexts
       */
      compile: function(name, source, jst, namespace, format, uglify, basename,
                        escapeHtml, escapeAttributes, cleanValue,
                        customHtmlEscape, customCleanValue, customPreserve, customFindAndPreserve,
                        customSurround, customSucceed, customPrecede,
                        preserveTags, selfCloseTags,
                        context) {

        var compiler = new Compiler({
          format: format,
          uglify: uglify,
          basename: basename,
          escapeHtml: escapeHtml,
          escapeAttributes: escapeAttributes,
          cleanValue: cleanValue,
          customHtmlEscape: customHtmlEscape,
          customCleanValue: customCleanValue,
          customPreserve: customPreserve,
          customFindAndPreserve: customFindAndPreserve,
          customSurround: customSurround,
          customSucceed: customSucceed,
          customPrecede: customPrecede,
          preserveTags: preserveTags,
          selfCloseTags: selfCloseTags
        });

        compiler.parse(source);

        var template;

        if (jst) {
          template = CoffeeScript.compile(compiler.render(name, namespace));

          if (context !== '')
            template = template.replace('.call(context);', '.call(' + context + '(context));');
        } else {
          template = CoffeeScript.compile(compiler.precompile(), { bare: true });
          template = '(function() {\n' + template + '\n})';
          template = '(function(context) { return ' + template + '.call(' + context + '(context)); })';
        }

        return template;
      }

    }
 })();
{'fraction_non_alphanumeric': 0.09187279151943463, 'fraction_numerical': 0.00014723203769140164, 'mean_word_length': 2.429076224129228, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '5537685', 'n_tokens_mistral': 1730, 'n_tokens_neox': 1683, 'n_words': 599}