<commit_before>'use strict';

/**
 * Expose `plugin`.
 */
module.exports = plugin;


/**
 * Metalsmith plugin that sets a `rootPath` variable on each file's metadata.
 * This allows you to find relative paths in your templates easily.
 *
 * @return {Function}
 */
function plugin(){

    return function(files, metalsmith, done){

        Object.keys(files).forEach(function(file){
            setImmediate(done);

            var re = /(\/)+/g;

            var rootPath = "";
            var a;
            while ((a = re.exec(file)) !== null) {
                rootPath += "../";
            }

            files[file].rootPath = rootPath;

        });
    }
}<commit_msg>bugfix: update regex to work with windoze paths<commit_after>'use strict';

/**
 * Expose `plugin`.
 */
module.exports = plugin;


/**
 * Metalsmith plugin that sets a `rootPath` variable on each file's metadata.
 * This allows you to find relative paths in your templates easily.
 *
 * @return {Function}
 */
function plugin(){

    return function(files, metalsmith, done){

        Object.keys(files).forEach(function(file){
            setImmediate(done);

            var re = /(\/|\\)+/g;

            var rootPath = "";
            var a;
            while ((a = re.exec(file)) !== null) {
                rootPath += "../";
            }

            files[file].rootPath = rootPath;

        });
    }
}
{'fraction_non_alphanumeric': 0.14563806777217014, 'fraction_numerical': 0.0, 'mean_word_length': 1.915966386554622, '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': '1228900', 'n_tokens_mistral': 410, 'n_tokens_neox': 384, 'n_words': 111}