<commit_before>var WikiHandler = {
	lineNo: 0,
	skipBr: false,
	isFirstBr: false,
	tableStack: [],
	nonBreakingTagDepth: 0,
	blockLoc: {},
	blockLast: '',
	plugin: function(plugin) {
		//needs a little ajax magic
		if (plugin) {
			if (plugin.name) {
				var wikiPluginName = "wikiplugin_" + plugin.name.toLowerCase();
				if (window[wikiPluginName]) {
					var thisOutput = window[wikiPluginName](plugin.body);
					if (thisOutput) {
						//var newOutput = this.Parse(thisOutput);
						
						//return (newOutput ? newOutput : thisOutput);
					}
				}
			}
		}
		return (plugin.inline ? plugin.static : plugin.static + plugin.body + '{' + plugin.name + '}');
	},
	blocks: {
		"header": ['!'],

		"stackList": ['*','#','+',';'],

		"r2l": ['{r2l}'],
		"l2r": ['{l2r}']
	},
	block: function (content)
	{
		this.lineNo++;
		this.skipBr = false;

		var content = $.trim(content, "\n\r");

		for( fn in this.blocks) {
			var block = this.blocks[fn];
			for(startsWith in block) {
				if (this.beginsWith(content, block[startsWith])) {
					return this[fn](content);
				}
			}
		}

		return content;
	},
	newLine: function() {
		return '<br />';
	},
    np: function(content) {
        return content;
    },
	bold: function (content) {
		return "<strong>" + content + "</strong>";
	},
	box: function (content) {
		return "<div style='border: solid 1px black;'>" + content + "</div>";
	},
	center: function (content) {
		return "<center>" + content + "</center>";
	},
	color: function (content) {
		var text = content.split(':');
		var color = text[0];
		var html = text[1];
		return "<span style='color: #" + color + ";'>" + html + "</span>";
	},
	italics: function (content) {
		return "<i>" + content + "</i>";
	},
	header: function (content) {
		return "<h1>" + content + "</h1>";
	},
	htmlTag: function(content) {
		var parts = content.split(/[ >]/),
		name = $.trim(parts[0]).toLocaleLowerCase();

		switch (name) {
			//start block level
			case 'h1':
			case 'h2':
			case 'h3':
			case 'h4':
			case 'h5':
			case 'h6':
			case 'pre':
			case 'ul':
			case 'dl':
			case 'div':
			case 'table':
			case 'p':
				this.skipBr = true;
			case 'script':
				this.nonBreakingTagDepth++;
				this.lineNp++;
				break;

			//end block level
			case '/h1':
			case '/h2':
			case '/h3':
			case '/h4':
			case '/h5':
			case '/h6':
			case '/pre':
			case '/ul':
			case '/dl':
			case '/div':
			case '/table':
			case '/p':
				this.skipBr = true;
			case '/script':
				this.nonBreakingTagDepth--;
				this.nonBreakingTagDepth = max(this.nonBreakingTagDepth, 0);
				this.lineNo++;
				break;

			//skip next block level
			case 'hr':
			case 'br':
				this.skipBr = true;
				break;
		}

		return content;
	},
	unlink: function (content) {
		if (this.beginsWith(content, "@np")) {
			content = content.substring(0, content.length - 3);
		}

		if (content[content.length - 1] != "]" && this.beginsWith(content, "[[")) {
			content = content.substring(1);
		} else if (!this.endsWith(content, "]]")) {
			content = content.substring(1);
		}

		return content;
	},
    stackList: function(content) {
        return content;
    },
	hr: function () {
		return "<hr />";
	},
	link: function (content) {
		var link = this.split(':', content);
		var href = content;
		
		if (this.match(/\|/, content)) {
			href = link[0];
			content = link[1];
		}
		return "<a href='" + href + "'>" + content + "</a>";
	},
	line: function(ch) {
		this.lineNo++;
		var skipBr = this.skipBr;
		this.skipBr = false; //skipBr must always must be false when done processing line

		//The first \n was inserted just before parse
		if (this.isFirstBr == false) {
			this.isFirstBr = true;
			return '';
		}

		ch = (ch ? ch : '');

		var result = ch;

		if (skipBr == false && this.tableStack.length && this.nonBreakingTagDepth == 0) {
			result = "<br />" + ch;
		}

		return result;
	},
	smile: function (smile) { //this needs more tlc too
		return "<img src='img/smiles/icon_" + smile + ".gif' alt='" + smile + "' />";
	},
	strike: function (content) {
		return "<span style='text-decoration: line-through;'>" + content + "</span>";
	},
	tableParser: function (content) {
		var tableContents = '';
		var rows = this.split('<br />', content);
		for(var i = 0; i < this.size(rows); i++) {
			row = '';
			
			cells = this.split('|',  rows[i]);
			for(var j = 0; j < this.size(cells); j++) {
				row += this.table_td(cells[j]);
			}
			tableContents += this.table_tr(row);
		}
		return "<table style='width: 100%;'>" + tableContents + "</table>";
	},
	table_tr: function (content) {
		return "<tr>" + content + "</tr>";
	},
	table_td: function (content) {
		return "<td>" + content + "</td>";
	},
	titlebar: function (content) {
		return "<div class='titlebar'>" + content + "</div>";
	},
	underscore: function (content) {
		return "<u>" + content + "</u>";
	},
	wikilink: function (content) {
		var wikilink = this.split('|', content);
		var href = content;
		
		if (this.match('/\|/', content)) {
			href = wikilink[0];
			content = wikilink[1];
		}
		return "<a href='" + href + "'>" + content + "</a>";
	},
	olist: function(content) {
		return '<ol><li>' + content + '</li></ol>';<commit_msg>[FIX] Header, color<commit_after>var WikiHandler = {
	lineNo: 0,
	skipBr: false,
	isFirstBr: false,
	tableStack: [],
	nonBreakingTagDepth: 0,
	blockLoc: {},
	blockLast: '',
	plugin: function(plugin) {
		//needs a little ajax magic
		if (plugin) {
			if (plugin.name) {
				var wikiPluginName = "wikiplugin_" + plugin.name.toLowerCase();
				if (window[wikiPluginName]) {
					var thisOutput = window[wikiPluginName](plugin.body);
					if (thisOutput) {
						//var newOutput = this.Parse(thisOutput);
						
						//return (newOutput ? newOutput : thisOutput);
					}
				}
			}
		}
		return (plugin.inline ? plugin.static : plugin.static + plugin.body + '{' + plugin.name + '}');
	},
	blocks: {
		"header": ['!'],

		"stackList": ['*','#','+',';'],

		"r2l": ['{r2l}'],
		"l2r": ['{l2r}']
	},
	block: function (content)
	{
		this.lineNo++;
		this.skipBr = false;

		var content = $.trim(content, "\n\r");

		for( fn in this.blocks) {
			var block = this.blocks[fn];
			for(startsWith in block) {
				if (this.beginsWith(content, block[startsWith])) {
					return this[fn](content);
				}
			}
		}

		return content;
	},
	newLine: function() {
		return '<br />';
	},
    np: function(content) {
        return content;
    },
	bold: function (content) {
		return "<strong>" + content + "</strong>";
	},
	box: function (content) {
		return "<div style='border: solid 1px black;'>" + content + "</div>";
	},
	center: function (content) {
		return "<center>" + content + "</center>";
	},
	color: function (content) {
		var text = content.split(':');
		var color = text[0];
		var html = text[1];
		return "<span style='color: " + color + ";'>" + html + "</span>";
	},
	italics: function (content) {
		return "<i>" + content + "</i>";
	},
	header: function (content) {
		var hNum = 0;

		while (content[0] == '!') {
			content = content.substring(1);
			hNum++;
		}

		hNum = Math.min(7, hNum);

		return "<h" + hNum + ">" + content + "</h" + hNum + ">";
	},
	htmlTag: function(content) {
		var parts = content.split(/[ >]/),
		name = $.trim(parts[0]).toLocaleLowerCase();

		switch (name) {
			//start block level
			case 'h1':
			case 'h2':
			case 'h3':
			case 'h4':
			case 'h5':
			case 'h6':
			case 'pre':
			case 'ul':
			case 'dl':
			case 'div':
			case 'table':
			case 'p':
				this.skipBr = true;
			case 'script':
				this.nonBreakingTagDepth++;
				this.lineNp++;
				break;

			//end block level
			case '/h1':
			case '/h2':
			case '/h3':
			case '/h4':
			case '/h5':
			case '/h6':
			case '/pre':
			case '/ul':
			case '/dl':
			case '/div':
			case '/table':
			case '/p':
				this.skipBr = true;
			case '/script':
				this.nonBreakingTagDepth--;
				this.nonBreakingTagDepth = max(this.nonBreakingTagDepth, 0);
				this.lineNo++;
				break;

			//skip next block level
			case 'hr':
			case 'br':
				this.skipBr = true;
				break;
		}

		return content;
	},
	unlink: function (content) {
		if (this.beginsWith(content, "@np")) {
			content = content.substring(0, content.length - 3);
		}

		if (content[content.length - 1] != "]" && this.beginsWith(content, "[[")) {
			content = content.substring(1);
		} else if (!this.endsWith(content, "]]")) {
			content = content.substring(1);
		}

		return content;
	},
    stackList: function(content) {
        return content;
    },
	hr: function () {
		return "<hr />";
	},
	link: function (content) {
		var link = this.split(':', content);
		var href = content;
		
		if (this.match(/\|/, content)) {
			href = link[0];
			content = link[1];
		}
		return "<a href='" + href + "'>" + content + "</a>";
	},
	line: function(ch) {
		this.lineNo++;
		var skipBr = this.skipBr;
		this.skipBr = false; //skipBr must always must be false when done processing line

		//The first \n was inserted just before parse
		if (this.isFirstBr == false) {
			this.isFirstBr = true;
			return '';
		}

		ch = (ch ? ch : '');

		var result = ch;

		if (skipBr == false && !this.tableStack.length && this.nonBreakingTagDepth == 0) {
			result = "<br />" + ch;
		}

		return result;
	},
	smile: function (smile) { //this needs more tlc too
		return "<img src='img/smiles/icon_" + smile + ".gif' alt='" + smile + "' />";
	},
	strike: function (content) {
		return "<span style='text-decoration: line-through;'>" + content + "</span>";
	},
	tableParser: function (content) {
		var tableContents = '';
		var rows = this.split('\n', content);
		for(var i = 0; i < this.size(rows); i++) {
			row = '';
			
			cells = this.split('|',  rows[i]);
			for(var j = 0; j < this.size(cells); j++) {
				row += this.table_td(cells[j]);
			}
			tableContents += this.table_tr(row);
		}
		return '<table class="wikitable">' + tableContents + '</table>';
	},
	table_tr: function (content) {
		return "<tr>" + content + "</tr>";
	},
	table_td: function (content) {
		return "<td>" + content + "</td>";
	},
	titlebar: function (content) {
		return "<div class='titlebar'>" + content + "</div>";
	},
	underscore: function (content) {
		return "<u>" + content + "</u>";
	},
	wikilink: function (content) {
		var wikilink = this.split('|', content);
		var href = content;
		
		if (this.match('/\|/', content)) {
			href = wikilink[0];
			content = wikilink[1];
		}
		return "<a href='" + href + "'>" + content + "</a>";
	},
	olist: function(content) {
		return '<ol><li>' + content + '</li></ol>';
{'fraction_non_alphanumeric': 0.20448045757864633, 'fraction_numerical': 0.007530981887511916, 'mean_word_length': 2.923335826477188, 'pattern_counts': {'":': 8, '<': 80, '<?xml version=': 0, '>': 78, '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': '4722222', 'n_tokens_mistral': 4373, 'n_tokens_neox': 3764, 'n_words': 933}