<commit_before>var templates = (function () {

var exports = {};

exports.render = function (name, arg) {
    if (Handlebars.templates === undefined)
        Handlebars.templates = {};

    if (Handlebars.templates[name] === undefined) {
        // Fetch the template using a synchronous AJAX request.
        //
        // This is only for local development.  In prod we precompile
        // templates and serve JavaScript which will have already
        // populated Handlebars.templates.
        $.ajax({
            url:     '/static/templates/'+name+'.handlebars?' + new Date().getTime(),
            async:   false,
            success: function (data) {
                Handlebars.templates[name] = Handlebars.compile(data);
            }
        });
    }

    return Handlebars.templates[name](arg);
};

return exports;
}());<commit_msg>handlebars: Add alternative partial support<commit_after>var templates = (function () {

var exports = {};

exports.render = function (name, arg) {
    if (Handlebars.templates === undefined)
        Handlebars.templates = {};

    if (Handlebars.templates[name] === undefined) {
        // Fetch the template using a synchronous AJAX request.
        //
        // This is only for local development.  In prod we precompile
        // templates and serve JavaScript which will have already
        // populated Handlebars.templates.
        $.ajax({
            url:     '/static/templates/'+name+'.handlebars?' + new Date().getTime(),
            async:   false,
            success: function (data) {
                Handlebars.templates[name] = Handlebars.compile(data);
            }
        });
    }

    return Handlebars.templates[name](arg);
};

$(function () {
    // Regular Handlebars partials require pre-registering.  This allows us
    // to treat any template as a partial.
    Handlebars.registerHelper('partial', function (template_name, context) {
        return new Handlebars.SafeString(exports.render(template_name, this));
    });
});

return exports;
}());
{'fraction_non_alphanumeric': 0.1242603550295858, 'fraction_numerical': 0.0, 'mean_word_length': 2.3481848184818483, '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': '5370365', 'n_tokens_mistral': 526, 'n_tokens_neox': 513, 'n_words': 148}