<commit_before>var when  = require("when"),
    _     = require("underscore"),
    utils = require("../../utils");

module.exports = function(PluginResolver) {
    var BaseGenerator = PluginResolver.BaseGenerator;


    var HtmlWriterFile = function (options) {
        if (!("inputFile" in options)) {
            throw new Error("You need to specify an input file");
        }
        if (!("outputFile" in options)) {
            throw new Error("You need to specify an output file");
        }

        this.inputFile = options.inputFile;
        this.outputFile = options.outputFile;
        this.renderer = options.renderer;

    };

    HtmlWriterFile.prototype.setHelpers = function (helpers) {
        this.helpers = helpers;
    };


    HtmlWriterFile.prototype.render = function() {
        var self = this;
        return when.promise(function(resolve, reject) {
            var html = self.renderer.render(self.inputFile, {mddoc: self.helpers});
            utils.writeFileCreateDir(self.outputFile, html).then(
                function () {
                    console.log("We wrote ".green + self.outputFile.grey);
                    resolve();
                },
                function (err) {
                    console.log("eee ", err);
                    reject(err);
                }
            );
        });
    };


    var CustomGenerator = function (notused, projectSettings, generatorSettings) {
        BaseGenerator.call(this, projectSettings, generatorSettings);

        // TODO: this should be in the HtmlWriterFile, but i dont want to create
        // one every time
        var ECT = require("ect");
        this.renderer = ECT({ root : this.settings.templateDir });
    };<commit_msg>fix(generator): Fix reference in customGenerator<commit_after>var when  = require("when"),
    _     = require("underscore"),
    utils = require("../../utils");

module.exports = function(PluginResolver) {
    var BaseGenerator = PluginResolver.BaseGenerator;


    var HtmlWriterFile = function (options) {
        if (!("inputFile" in options)) {
            throw new Error("You need to specify an input file");
        }
        if (!("outputFile" in options)) {
            throw new Error("You need to specify an output file");
        }

        this.inputFile = options.inputFile;
        this.outputFile = options.outputFile;
        this.renderer = options.renderer;

    };

    HtmlWriterFile.prototype.setHelpers = function (helpers) {
        this.helpers = helpers;
    };


    HtmlWriterFile.prototype.render = function() {
        var self = this;
        return when.promise(function(resolve, reject) {
            var html = self.renderer.render(self.inputFile, {mddoc: self.helpers});
            utils.writeFileCreateDir(self.outputFile, html).then(
                function () {
                    console.log("We wrote ".green + self.outputFile.grey);
                    resolve();
                },
                function (err) {
                    console.log("eee ", err);
                    reject(err);
                }
            );
        });
    };


    var CustomGenerator = function (notused, projectSettings, generatorSettings) {
        BaseGenerator.call(this, projectSettings, generatorSettings);

        // TODO: this should be in the HtmlWriterFile, but i dont want to create
        // one every time
        var ECT = require("ect");
        this.renderer = ECT({ root : generatorSettings.templateDir });
    };
{'fraction_non_alphanumeric': 0.11508731749212711, 'fraction_numerical': 0.0, 'mean_word_length': 1.9710884353741496, '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': '4318900', 'n_tokens_mistral': 914, 'n_tokens_neox': 883, 'n_words': 224}