<commit_before>var gulp     = require('gulp');
var gutil    = require('gulp-util');
var replace  = require('gulp-replace');
var _        = require('lodash');
var fs       = require('fs');


if (!gutil.env.config) {
    gutil.log(gutil.colors.red("error:"), "missing config. Use --config ./config/someconfig.js");
    process.exit(1);
}

var configFile = gutil.env.config;

//if (configFile.indexOf('./') !== 0) configFile = './' + configFile;

var cfg = require(configFile);

gutil.log("using config " +configFile);

var headerFields = (function(){
    var lis = _.map(cfg.termList.fields, function(field) {
        return '<th field-name="' +field.name+ '" enable-filtering="true"></th>';
    });
    return '\n' + lis.join('\n');
})();

var valueFields = (function(){
    var lis = _.map(cfg.termList.fields, function(field, idx) {
        var pipe = idx === 0 ? ' | htmlifyTerm:termListFilter'
                 : idx === 1 ? ' | htmlifyDefinition:termListFilter'
                 : '';
        return '<td field-name="' +field.name+ '">\n' +
               '  <div ng-bind-html="gridItem.' +field.name + pipe +'"></div>\n' +
               '</td>';
    });
    return '\n' + lis.join('\n');
})();


gulp.task('default', ['genConfig'], function(){
    return gulp.src('config/tpl/main.html')
        .pipe(replace(/@@headerFields/, headerFields))
        .pipe(replace(/@@valueFields/, valueFields))
        .pipe(gulp.dest('app/views'));
});

gulp.task('genConfig', function(cb) {
    fs.writeFile("app/js/config.js", "var scvConfig = " + JSON.stringify(cfg, null, '  '), function (err) {
        cb(err);
    });
});<commit_msg>for now use htmlifyDefinition filter for all columns but first<commit_after>var gulp     = require('gulp');
var gutil    = require('gulp-util');
var replace  = require('gulp-replace');
var _        = require('lodash');
var fs       = require('fs');


if (!gutil.env.config) {
    gutil.log(gutil.colors.red("error:"), "missing config. Use --config ./config/someconfig.js");
    process.exit(1);
}

var configFile = gutil.env.config;

//if (configFile.indexOf('./') !== 0) configFile = './' + configFile;

var cfg = require(configFile);

gutil.log("using config " +configFile);

var headerFields = (function(){
    var lis = _.map(cfg.termList.fields, function(field) {
        return '<th field-name="' +field.name+ '" enable-filtering="true"></th>';
    });
    return '\n' + lis.join('\n');
})();

var valueFields = (function(){
    var lis = _.map(cfg.termList.fields, function(field, idx) {
        var pipe = idx === 0 ? ' | htmlifyTerm:termListFilter'
                 : ' | htmlifyDefinition:termListFilter';
        return '<td field-name="' +field.name+ '">\n' +
               '  <div ng-bind-html="gridItem.' +field.name + pipe +'"></div>\n' +
               '</td>';
    });
    return '\n' + lis.join('\n');
})();


gulp.task('default', ['genConfig'], function(){
    return gulp.src('config/tpl/main.html')
        .pipe(replace(/@@headerFields/, headerFields))
        .pipe(replace(/@@valueFields/, valueFields))
        .pipe(gulp.dest('app/views'));
});

gulp.task('genConfig', function(cb) {
    fs.writeFile("app/js/config.js", "var scvConfig = " + JSON.stringify(cfg, null, '  '), function (err) {
        cb(err);
    });
});
{'fraction_non_alphanumeric': 0.2107349801768832, 'fraction_numerical': 0.0021347971942665446, 'mean_word_length': 2.92814371257485, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1939547', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1075, 'n_words': 211}