<commit_before>/**
 * document.execCommand("foreColor") will create either inline styles (firefox, chrome) or use font tags
 * which we don't want
 * Instead we set a css class
 */
(function(wysihtml5) {
  var REG_EXP = /(^|\s)color\s*\:\s*((#[0-9a-f]{3}([0-9a-f]{3})?)|(rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}(\s*,\s*\d{1,3}\s*)?\)))\s*;?/i;
  
  wysihtml5.commands.foreColorStyle = {
    exec: function(composer, command, color) {
      wysihtml5.commands.formatInline.execWithToggle(composer, command, "span", false, false, "color:" + color, REG_EXP);
    },

    state: function(composer, command, color) {
      return wysihtml5.commands.formatInline.state(composer, command, "span", false, false, "color:" + color, REG_EXP);
    }
  };
})(wysihtml5);<commit_msg>forecolor regex improvement<commit_after>/**
 * document.execCommand("foreColor") will create either inline styles (firefox, chrome) or use font tags
 * which we don't want
 * Instead we set a css class
 */
(function(wysihtml5) {
  var REG_EXP = /(^|\s|;)color\s*\:\s*((#[0-9a-f]{3}([0-9a-f]{3})?)|(rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}(\s*,\s*\d{1,3}\s*)?\)))\s*;?/i;
  
  wysihtml5.commands.foreColorStyle = {
    exec: function(composer, command, color) {
      wysihtml5.commands.formatInline.execWithToggle(composer, command, "span", false, false, "color:" + color, REG_EXP);
    },

    state: function(composer, command, color) {
      return wysihtml5.commands.formatInline.state(composer, command, "span", false, false, "color:" + color, REG_EXP);
    }
  };
})(wysihtml5);
{'fraction_non_alphanumeric': 0.21994884910485935, 'fraction_numerical': 0.024296675191815855, 'mean_word_length': 4.305084745762712, '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': '4799017', 'n_tokens_mistral': 620, 'n_tokens_neox': 615, 'n_words': 109}