<commit_before>"use strict";
define("Url2link", [], function(){
function _Url2link(cfg){
	var that = this;
	Object.keys(cfg).forEach(function(key){
		switch(key){
		case "truncate":
			that.trunc = cfg[key];
			break;
		default:
			Object.keys(cfg[key]).forEach(function(k){
				that[key][k] = cfg[key][k];
			});
		}
	});
};
_Url2link.prototype = {
	constructor:_Url2link
	,"trunc": 0
	,"url":{
		"regex": /(^|\s)((?:https?:\/\/)?(?:[^\s\/$.?#]+\.)+[^\s\/$.?#]{2,}[^\s]*)/
		,"flags": "i"
		,"newtab": true
		,"action":function(match,host){
			var regex = /https?:\/\//g;
			var text;
			if(regex.exec(match)) text = match.slice(regex.lastIndex)
			else {
				text = match;
				match = "http://"+match;
			}
			text = decodeURI(text);
			if (text.slice(-1) == "/")text = text.slice(0,-1);
			text = (host.trunc &&(text.length > host.trunc))? text.substr(0,host.trunc)+"...":text;
			return '<a ' +(host["url"].newtab?'target="_blank"':"") +' href="'+match+'">' + text + "</a>";
		}
	}
	,"uname":{
		"regex": /(^|\s)@([a-z0-9]{3,})/
		,"newtab": true
		,"flags":"i"
		,"action":function(match, host){
			return '<a '+(host["uname"].newtab?'target="_blank"':"") +' href="' + gConfig.front+match+'" >@' +match + '</a>' ;
		}
	}
	,"link": function(text){
		var that = this;
		var matches = new Array();
		var out = new Array();
		["url","uname"].forEach(function (t){<commit_msg>better URL regex<commit_after>"use strict";
define("Url2link", [], function(){
function _Url2link(cfg){
	var that = this;
	Object.keys(cfg).forEach(function(key){
		switch(key){
		case "truncate":
			that.trunc = cfg[key];
			break;
		default:
			Object.keys(cfg[key]).forEach(function(k){
				that[key][k] = cfg[key][k];
			});
		}
	});
};
_Url2link.prototype = {
	constructor:_Url2link
	,"trunc": 0
	,"url":{
		"regex": /(^|\s)((?:https?:\/\/)?(?:[^\s\/~!@#$^&*()_?:;|\\]+\.)+(?:[^\s\/~!@#$^&*()_?:;|\\]){2,}(?:\.)?(?::[0-9]+)?(?:\/[^\s]*)*)/
		,"flags": "i"
		,"newtab": true
		,"action":function(match,host){
			var regex = /https?:\/\//g;
			var text;
			if(regex.exec(match)) text = match.slice(regex.lastIndex)
			else {
				text = match;
				match = "http://"+match;
			}
			text = decodeURI(text);
			if (text.slice(-1) == "/")text = text.slice(0,-1);
			text = (host.trunc &&(text.length > host.trunc))? text.substr(0,host.trunc)+"...":text;
			return '<a ' +(host["url"].newtab?'target="_blank"':"") +' href="'+match+'">' + text + "</a>";
		}
	}
	,"uname":{
		"regex": /(^|\s)@([a-z0-9]{3,})/
		,"newtab": true
		,"flags":"i"
		,"action":function(match, host){
			return '<a '+(host["uname"].newtab?'target="_blank"':"") +' href="' + gConfig.front+match+'" >@' +match + '</a>' ;
		}
	}
	,"link": function(text){
		var that = this;
		var matches = new Array();
		var out = new Array();
		["url","uname"].forEach(function (t){
{'fraction_non_alphanumeric': 0.3016720028459623, 'fraction_numerical': 0.009960868018498754, 'mean_word_length': 3.815068493150685, 'pattern_counts': {'":': 28, '<': 11, '<?xml version=': 0, '>': 13, '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': '4062329', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1120, 'n_words': 185}