<commit_before>var postcss = require('postcss');

module.exports = postcss.plugin('postcss-messages', function (opts) {
    if ( opts && opts.disabled === true ) {
        return function () { };
    }

    return function (css, result) {
        css.append({ selector: 'body:before' });
        css.last.append({ prop: 'display', value: 'block' });
        css.last.append({ prop: 'padding', value: '20px 30px' });
        css.last.append({ prop: 'background', value: 'red' });
        css.last.append({ prop: 'font-size', value: '16px' });
        css.last.append({ prop: 'color', value: 'white' });
        css.last.append({ prop: 'white-space', value: 'pre' });

        var content = result.warnings().map(function (message) {
            return message.toString().replace(/"/g, '\\"');
        }).join('\\00000a');

        css.last.append({ prop: 'content', value: '"' + content + '"' });
    };
});
<commit_msg>Add styles from options logic<commit_after>var postcss = require('postcss');

module.exports = postcss.plugin('postcss-messages', function (opts) {
    if ( opts && opts.disabled === true ) {
        return function () { };
    };

    var styleKeys = ['display', 'padding', 'background', 'font-size', 'color', 'white-space'];

    var defaultStyles = {
      'display': 'block',
      'padding': '20px 30px',
      'background': 'red',
      'font-size': '16px',
      'color': 'white',
      'white-space': 'pre'
    };
    if ( opts && opts.styles ) {
      for ( var attrname in opts.styles ) {
        if ( opts.styles.hasOwnProperty(attrname) ) {
          defaultStyles[attrname] = opts.styles[attrname];
        };
      };
    };

    return function (css, result) {
        css.append({ selector: (opts && opts.selector) ? opts.selector : 'body:before' });
        for ( var style in defaultStyles ) {
          if ( defaultStyles.hasOwnProperty(style) ) {
            css.last.append({ prop: style, value: defaultStyles[style] });
          }
        };

        var content = result.warnings().map(function (message) {
            return message.toString().replace(/"/g, '\\"');
        }).join('\\00000a');

        css.last.append({ prop: 'content', value: '"' + content + '"' });
    };
});

{'fraction_non_alphanumeric': 0.19370786516853933, 'fraction_numerical': 0.009887640449438202, 'mean_word_length': 2.5110410094637223, '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': '6354067', 'n_tokens_mistral': 687, 'n_tokens_neox': 670, 'n_words': 149}