<commit_before>function htmlEncode(value) {
	return value.toString()
		.replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/'/g,'&#39;')
		.replace(/</g,'&lt;').replace(/>/g,'&gt;')
	; // https://github.com/emn178/js-htmlencode/blob/master/src/htmlencode.js
}

function generateCode() {
	return htmlEncode([
		"<!DOCTYPE html>",
		"<html lang='en'>",
		"<head>",
		"<meta charset='utf-8' />",
		"<title>Generated code</title>",
		"</head>",
		"<body>",
		"Generated code!",
		"</body>",
		"</html>",
	].join("\n"));
}

$(function(){
	$('.webgl-starter').each(function(){
		var container=$(this);
		container.html("<code><pre>"+generateCode()+"</code></pre>");
	});
});
<commit_msg>run popup<commit_after>/*
function htmlEncode(value) {
	return value.toString()
		.replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/'/g,'&#39;')
		.replace(/</g,'&lt;').replace(/>/g,'&gt;')
	; // https://github.com/emn178/js-htmlencode/blob/master/src/htmlencode.js
}
*/

function generateCode() {
	return [
		"<!DOCTYPE html>",
		"<html lang='en'>",
		"<head>",
		"<meta charset='utf-8' />",
		"<title>Generated code</title>",
		"</head>",
		"<body>",
		"Generated code!",
		"</body>",
		"</html>",
	].join("\n");
}

function getHtmlDataUri(html) {
	// with base64: https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/btoa
	//return "data:text/html;charset=utf-8;base64,"+window.btoa(unescape(encodeURIComponent(str)));
	// without base64: https://en.wikipedia.org/wiki/Data_URI_scheme
	return 'data:text/html;charset=utf-8,'+encodeURIComponent(html);
}

$(function(){
	$('.webgl-starter').each(function(){
		var container=$(this);
		var code;
		//container.html("<code><pre>"+generateCode()+"</code></pre>");
		container.empty().append(
			$("<code>").append(code=$("<pre>").text(generateCode()))
		).append(
			$("<button type='button'>Run</button>").click(function(){
				//window.open("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==","generatedCode");
				window.open(getHtmlDataUri(code.text()),"generatedCode");
			})
		);
	});
});

{'fraction_non_alphanumeric': 0.26820103334899015, 'fraction_numerical': 0.016909347111319868, 'mean_word_length': 5.103151862464183, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 4, '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': '4957801', 'n_tokens_mistral': 903, 'n_tokens_neox': 817, 'n_words': 86}