<commit_before>/*
 * grunt-combo-html-css-js
 * https://github.com/jinjiang/grunt-combo-html-css-js
 *
 * Copyright (c) 2014 Jinjiang
 * Licensed under the MIT license.
 */

'use strict';

var path = require('path');

module.exports = function (grunt) {

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

  /**
   * find all stylesheet links and javascript tags,
   * read the css/js file to fill in the html code
   * 
   * @param  {string} filepath
   * @return {string}
   */
  function combo(filepath) {
    var cssHrefPattern = /<link(?:[^>]*) href="(.+)"(?:[^>]*)>/g;
    var jsSrcPattern = /<script(?:[^>]*) src="(.+)"(?:[^>]*)>/g;

    var html = grunt.file.read(filepath);

    html = html.replace(cssHrefPattern, function (openTag, href) {
      if (href.match(/\:/)) {
        return openTag;
      }
      return '<style>\n' + grunt.file.read(path.join(filepath, '../', href)) + '\n</style>';
    });

    html = html.replace(jsSrcPattern, function (openTag, src) {
      if (src.match(/\:/)) {
        return openTag;<commit_msg>Fix bugs in src/href attrib and relative protocol matching<commit_after>/*
 * grunt-combo-html-css-js
 * https://github.com/jinjiang/grunt-combo-html-css-js
 *
 * Copyright (c) 2014 Jinjiang
 * Licensed under the MIT license.
 */

'use strict';

var path = require('path');

module.exports = function (grunt) {

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

  /**
   * find all stylesheet links and javascript tags,
   * read the css/js file to fill in the html code
   * 
   * @param  {string} filepath
   * @return {string}
   */
  function combo(filepath) {
    var cssHrefPattern = /<link(?:[^>]*) href="([^"]+)"(?:[^>]*)>/g;
    var jsSrcPattern = /<script(?:[^>]*) src="([^"]+)"(?:[^>]*)>/g;

    var html = grunt.file.read(filepath);

    html = html.replace(cssHrefPattern, function (openTag, href) {
      if (href.match(/\/\//)) {
        return openTag;
      }
      return '<style>\n' + grunt.file.read(path.join(filepath, '../', href)) + '\n</style>';
    });

    html = html.replace(jsSrcPattern, function (openTag, src) {
      if (src.match(/\/\//)) {
        return openTag;
{'fraction_non_alphanumeric': 0.1907463989524225, 'fraction_numerical': 0.003491924923614142, 'mean_word_length': 2.9381443298969074, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 2, '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': '3798869', 'n_tokens_mistral': 812, 'n_tokens_neox': 758, 'n_words': 187}