<commit_before>/*
 * grunt-inline-styles
 * http://sahibinden.github.io/grunt-inline-styles/
 *
 * Copyright (c) 2014 <EMAIL>
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function (grunt) {

  // Please see the Grunt documentation for more information regarding task
  // creation: http://gruntjs.com/creating-tasks

  grunt.registerMultiTask('inline_style', 'Inject external styles to your HTMLs.', function () {

    // Merge task-specific and/or target-specific options with these defaults.
    var options = this.options({
      verbose: false
    });

    // Iterate over all specified file groups.
    this.files.forEach(function (file) {
      // Concat specified files.
      file.src.filter(function (filepath) {
        // Warn on and remove invalid source files (if nonull was set).
        if (!grunt.file.exists(filepath)) {
          grunt.log.warn('Source file "' + filepath + '" not found.');
          return false;
        } else {
          return true;
        }
      }).map(function (filepath) {
        // Read file source.
        if (options.verbose) {
          grunt.log.writeln(filepath);
        }

        var html = grunt.file.read(filepath),
          destination = file.dest || filepath;

        var parts = filepath.split('/');
        parts.pop();

        html = html.replace(/<link[^>]* href="([^"]*)"[^>]?>/g, function (match, styleUrl) {
          if (options.verbose) {
            grunt.log.writeln(styleUrl);
          }

          var cssUrl = parts.join('/') + '/' + styleUrl;

          if (!grunt.file.exists(cssUrl)) {
            grunt.log.warn('CSS file "' + cssUrl + '" not found.');
            return '<!-- css file couldnt found: ' + cssUrl + ' -->';
          } else {
            var css = grunt.file.read(cssUrl);

            return '<style>'+css+'</style>';
          }
        });

        // Write the destination file.
        grunt.file.write(destination, html);

        // Print a success message.
        if (options.verbose) {
          grunt.log.writeln('File "' + destination + '" processed.');
        }

        return html;
      });

    });
  });

};
<commit_msg>Update inline_style.js<commit_after>/*
 * grunt-inline-styles
 * http://sahibinden.github.io/grunt-inline-styles/
 *
 * Copyright (c) 2014 <EMAIL>
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function (grunt) {

  // Please see the Grunt documentation for more information regarding task
  // creation: http://gruntjs.com/creating-tasks

  grunt.registerMultiTask('inline_style', 'Inject external styles to your HTMLs.', function () {

    // Merge task-specific and/or target-specific options with these defaults.
    var options = this.options({
      verbose: false,
      pwd: null
    });

    // Iterate over all specified file groups.
    this.files.forEach(function (file) {
      // Concat specified files.
      file.src.filter(function (filepath) {
        // Warn on and remove invalid source files (if nonull was set).
        if (!grunt.file.exists(filepath)) {
          grunt.log.warn('Source file "' + filepath + '" not found.');
          return false;
        } else {
          return true;
        }
      }).map(function (filepath) {
        // Read file source.
        if (options.verbose) {
          grunt.log.writeln(filepath);
        }

        var html = grunt.file.read(filepath),
          destination = file.dest || filepath;

        var parts = filepath.split('/');
        parts.pop();

        html = html.replace(/<link[^>]* href="([^"]*)"[^>]?>/g, function (match, styleUrl) {
          if (options.verbose) {
            grunt.log.writeln(styleUrl);
          }

          var cssUrl = (pwd ? pwd : (parts.join('/') + '/')) + styleUrl;

          if (!grunt.file.exists(cssUrl)) {
            grunt.log.warn('CSS file "' + cssUrl + '" not found.');
            return '<!-- css file couldnt found: ' + cssUrl + ' -->';
          } else {
            var css = grunt.file.read(cssUrl);

            return '<style>'+css+'</style>';
          }
        });

        // Write the destination file.
        grunt.file.write(destination, html);

        // Print a success message.
        if (options.verbose) {
          grunt.log.writeln('File "' + destination + '" processed.');
        }

        return html;
      });

    });
  });

};

{'fraction_non_alphanumeric': 0.15080091533180778, 'fraction_numerical': 0.0018306636155606408, 'mean_word_length': 1.9633898305084745, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, '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': '1033569', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1270, 'n_words': 311}