<commit_before>var fs = require('fs'),
    jazz = require('jazz'),
    path = require('path');
    
var Engine = function () {
};
Engine.prototype.prepare = function (file, encoding) {
    var data = fs.readFileSync(file, encoding);
    return jazz.compile(data);
};
Engine.prototype._combine = function (objects) {
    var combined = {}, i, j;
    for (i in objects) {
        if (objects.hasOwnProperty(i)) {
            for (j in objects[i]) {
                if (objects[i].hasOwnProperty(j)) {
                    combined[j] = objects[i][j];
                }
            }
        }
    }
    return combined;
};
Engine.prototype._predefined = function (filePath, partials, params) {
    var that = this;
    return {
        'include': function (file, cb) {
            partials[file].process(that._combine([params, that._predefined(filePath, partials, params)]), cb);
        },
        'relative': function (_path, cb) {
            var base = '', i;
            for (i = 0; i < filePath.split('/').length - 1; i += 1) {
                base += '../';
            }
            cb(path.join(base, _path).replace(/^\//, '')); 
        }
    };
};
Engine.prototype.merge = function (filePath, page, layout, partials, params, cb) {
    var that = this,
        pageParams = this._combine([params, this._predefined(filePath, partials, params)]);
    page.process(pageParams, function (data) {
        layout.process(that._combine([pageParams, { body: data }]), cb);
    });
};

exports.Engine = Engine;<commit_msg>Added file as a predefined var, handy for identifying the current page.<commit_after>var fs = require('fs'),
    jazz = require('jazz'),
    path = require('path');
    
var Engine = function () {
};
Engine.prototype.prepare = function (file, encoding) {
    var data = fs.readFileSync(file, encoding);
    return jazz.compile(data);
};
Engine.prototype._combine = function (objects) {
    var combined = {}, i, j;
    for (i in objects) {
        if (objects.hasOwnProperty(i)) {
            for (j in objects[i]) {
                if (objects[i].hasOwnProperty(j)) {
                    combined[j] = objects[i][j];
                }
            }
        }
    }
    return combined;
};
Engine.prototype._predefined = function (filePath, partials, params) {
    var that = this;
    return {
        'include': function (file, cb) {
            partials[file].process(that._combine([params, that._predefined(filePath, partials, params)]), cb);
        },
        'relative': function (_path, cb) {
            var base = '', i;
            for (i = 0; i < filePath.split('/').length - 1; i += 1) {
                base += '../';
            }
            cb(path.join(base, _path).replace(/^\//, '')); 
        },
        'file': filePath
    };
};
Engine.prototype.merge = function (filePath, page, layout, partials, params, cb) {
    var that = this,
        pageParams = this._combine([params, this._predefined(filePath, partials, params)]);
    page.process(pageParams, function (data) {
        layout.process(that._combine([pageParams, { body: data }]), cb);
    });
};

exports.Engine = Engine;
{'fraction_non_alphanumeric': 0.16069142125480154, 'fraction_numerical': 0.0019206145966709346, 'mean_word_length': 2.231644260599793, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3581600', 'n_tokens_mistral': 935, 'n_tokens_neox': 926, 'n_words': 220}