<commit_before>module.exports = function hawkElementBuilder(Hawkejs, Blast) {

	/**
	 * The Element Builder class
	 *
	 * @author   <NAME>   <<EMAIL>>
	 * @since    1.0.0
	 * @version  1.0.0
	 *
	 * @param    {String}   tagName
	 * @param    {Object}   options
	 */
	function ElementBuilder(tagName, options) {

		// Store the lowercase name
		this.tagName = tagName.toLowerCase();

		// The attributes
		this.attribute = {};

		// The content between the tags
		this.content = '';
	}

	/**
	 * A static function to create a new ElementBuilder
	 *
	 * @author   <NAME>   <<EMAIL>>
	 * @since    1.0.0
	 * @version  1.0.0
	 *
	 * @param    {String}   tagName
	 * @param    {Object}   options
	 */
	ElementBuilder.create = function create(tagName, options) {
		return new ElementBuilder(tagName, options);
	};

	/**
	 * Turn the element into a string
	 *
	 * @author   <NAME>   <<EMAIL>>
	 * @since    1.0.0
	 * @version  1.0.0
	 *
	 * @return   {String}
	 */
	ElementBuilder.prototype.toString = function toString() {

		var html = '<' + this.tagName,
		    classNames,
		    value,
		    name;

		html += this.getSerialized('id');
		html += this.getSerialized('class');
		html += this.getSerialized('for');
		html += this.getSerialized('name');

		for (name in this.attribute) {

			// Skip names that have already been added
			if (['id', 'class', 'for', 'name'].indexOf(name) > -1) {
				continue;
			}

			html += this.getSerialized(name);
		}

		html += '>' + (this.content||'') + '</' + this.tagName + '>';

		return html;
	};

	/**
	 * Set the content
	 *
	 * @author   <NAME>   <<EMAIL>>
	 * @since    1.0.0
	 * @version  1.0.0
	 *
	 * @param    {String}    value
	 * @param    {Boolean}   escape    HTML escape the content? False by default
	 */
	ElementBuilder.prototype.setContent = function setContent(value, escape) {

		var html = '',
		    i;
<commit_msg>feat: ElementBuilder now can also provide content asynchronously<commit_after>module.exports = function hawkElementBuilder(Hawkejs, Blast) {

	/**
	 * The Element Builder class
	 *
	 * @author   <NAME>   <<EMAIL>>
	 * @since    1.0.0
	 * @version  1.0.0
	 *
	 * @param    {String}   tagName
	 * @param    {Object}   options
	 */
	function ElementBuilder(tagName, options) {

		// Store the lowercase name
		this.tagName = tagName.toLowerCase();

		// The attributes
		this.attribute = {};

		// The content between the tags
		this.content = '';

		// The base content
		this.baseContent = false;

		// Use async content?
		this.useBaseContent = false;
	}

	/**
	 * A static function to create a new ElementBuilder
	 *
	 * @author   <NAME>   <<EMAIL>>
	 * @since    1.0.0
	 * @version  1.0.0
	 *
	 * @param    {String}   tagName
	 * @param    {Object}   options
	 */
	ElementBuilder.create = function create(tagName, options) {
		return new ElementBuilder(tagName, options);
	};

	/**
	 * Get the html asynchronously if the content provided also
	 * has a getContent method
	 *
	 * @author   <NAME>   <<EMAIL>>
	 * @since    1.0.0
	 * @version  1.0.0
	 *
	 * @return   {String}
	 */
	ElementBuilder.prototype.getContent = function getContent(callback) {

		var that = this,
		    val;

		if (this.baseContent && this.baseContent.value) {
			val = this.baseContent.value;

			if (val.getContent) {
				this.useBaseContent = true;
				return val.getContent(callback);
			}
		}

		return callback(null, this.content);
	};

	/**
	 * Turn the element into a string
	 *
	 * @author   <NAME>   <<EMAIL>>
	 * @since    1.0.0
	 * @version  1.0.0
	 *
	 * @return   {String}
	 */
	ElementBuilder.prototype.toString = function toString() {

		var html = '<' + this.tagName,
		    classNames,
		    value,
		    name;

		html += this.getSerialized('id');
		html += this.getSerialized('class');
		html += this.getSerialized('for');
		html += this.getSerialized('name');

		for (name in this.attribute) {

			// Skip names that have already been added
			if (['id', 'class', 'for', 'name'].indexOf(name) > -1) {
				continue;
			}

			html += this.getSerialized(name);
		}

		html += '>';

		if (this.useBaseContent) {
			value = this.baseContent.value;
			if (this.baseContent.escape) {
				value = Blast.Classes.String.prototype.encodeHTML.call(value);
			}
		} else {
			value = this.content;
		}

		html += value || '';

		html += '</' + this.tagName + '>';

		return html;
	};

	/**
	 * Set the content
	 *
	 * @author   <NAME>   <<EMAIL>>
	 * @since    1.0.0
	 * @version  1.0.0
	 *
	 * @param    {String}    value
	 * @param    {Boolean}   escape    HTML escape the content? False by default
	 */
	ElementBuilder.prototype.setContent = function setContent(value, escape) {

		var html = '',
		    i;

		this.baseContent = {value: value, escape: escape};

{'fraction_non_alphanumeric': 0.15146372507424694, 'fraction_numerical': 0.011879507848960543, 'mean_word_length': 2.574677786201668, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 36, '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': '7122089', 'n_tokens_mistral': 1772, 'n_tokens_neox': 1542, 'n_words': 388}