<commit_before><!DOCTYPE html>
<html>
<head>
	<title>Simplate</title>
	<script type="text/javascript" src="https://github.com/twigkit/simplate/raw/master/src/simplate.js"></script>
	<script type="text/javascript" charset="utf-8" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shCore.js"></script>
	<script type="text/javascript" charset="utf-8" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJScript.js"></script>
	<script type="text/javascript" charset="utf-8" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushXml.js"></script>
	<link rel="stylesheet" href="css/syntaxhighlighter.css" type="text/css" charset="utf-8">
</head>
<body>

<h1>Simplate > The Simple JavaScript Template Engine</h1>

<h2>Usage</h2>
<h3>JavaScript</h3>
<pre name="code" class="js:nocontrols:nogutter">
	/*
	 * element : ID or an instance of an HTMLElement
	 * data    : An array of objects
	 */
	SIMPLATE.prepare( element ).render( data );
</pre>
<h3>HTML</h3>
<p>Any tag with data-template attribute will be considered a template</p>
<pre name="code" class="xhtml:nocontrols:nogutter">
	&lt;div id=&quot;container&quot;&gt;
		&lt;span data-template&gt;{{foo.bar}}&lt;/span&gt;
	&lt;/div&gt;
</pre>

<h2>Simple Example (static array of items)</h2>
	
<script>
	window.onload = function() {
		dp.SyntaxHighlighter.HighlightAll('code');
		
		var template = SIMPLATE.prepare('marx-brothers');
		
		template.render([
				{'name':{'first':'Leonard', 'last':'Marx'}, 'nickname':'Chico', 'born': 'March 21, 1887', 'actor': true},
				{'name':{'first':'Adolph', 'last':'Marx'}, 'nickname':'Harpo', 'born': 'November 23, 1888', 'actor': true},
				{'name':{'first':'<NAME>', 'last':'Marx'}, 'nickname':'Groucho', 'born': 'October 2, 1890', 'actor': true},
				{'name':{'first':'Milton', 'last':'Marx'}, 'nickname':'Gummo', 'born': 'October 23, 1892'},
				{'name':{'first':'Herbert', 'last':'Marx'}, 'nickname':'Zeppo', 'born': 'February 25, 1901', 'actor': true}
			]);
	}
</script>

<h3>JavaScript</h3>
<pre name="code" class="js:nocontrols:nogutter">
	var template = SIMPLATE.prepare('marx-brothers');
	
	template.render([
			{'name':{'first':'Leonard', 'last':'Marx'}, 'nickname':'Chico', 'born': 'March 21, 1887', 'actor': true},
			{'name':{'first':'Adolph', 'last':'Marx'}, 'nickname':'Harpo', 'born': 'November 23, 1888', 'actor': true},
			{'name':{'first':'<NAME>', 'last':'Marx'}, 'nickname':'Groucho', 'born': 'October 2, 1890', 'actor': true},
			{'name':{'first':'Milton', 'last':'Marx'}, 'nickname':'Gummo', 'born': 'October 23, 1892'},
			{'name':{'first':'Herbert', 'last':'Marx'}, 'nickname':'Zeppo', 'born': 'February 25, 1901', 'actor': true}
		]);
</pre>

<h3>HTML</h3>
<pre name="code" class="xhtml:nocontrols:nogutter">
	&lt;style&gt;
		ul#marx-brothers li.person { margin-left: 25px; }
		ul#marx-brothers li.person.grumpy { color: red; }
	&lt;/style&gt;

	&lt;ul id=&quot;marx-brothers&quot;&gt;
		&lt;li style=&quot;list-style: none; font-weight: bold; border-bottom: 1px solid #000;&quot;&gt;Marx Brothers (this element is not removed)&lt;/li&gt;
		&lt;li data-template data-where-nickname=&quot;Groucho&quot; class=&quot;person grumpy&quot;&gt;{{nickname}} was grumpy!&lt;/li&gt;
		&lt;li data-template data-where-actor class=&quot;person&quot;&gt;{{name.first}}, nicknamed &#x27;&lt;i&gt;{{nickname}} {{name.last}}&lt;/i&gt;&#x27; was born on {{born}}&lt;/li&gt;
		&lt;li data-template class=&quot;person&quot;&gt;{{name.first}} {{name.last}} was not in any movies!&lt;/li&gt;
	&lt;/ul&gt;
</pre>

<h3>Output</h3>

<style>
	ul#marx-brothers li.person { margin-left: 25px; }
	ul#marx-brothers li.person.grumpy { color: red; }
</style>

<ul id="marx-brothers">
	<li style="list-style: none; font-weight: bold; border-bottom: 1px solid #000;">Marx Brothers (this element is not removed)</li>
	<li data-template data-where-nickname="Groucho" class="person grumpy">{{nickname}} was grumpy!</li>
	<li data-template data-where-actor class="person">{{name.first}}, nicknamed '<i>{{nickname}} {{name.last}}</i>' was born on {{born}}</li>
	<li data-template class="person">{{name.first}} {{name.last}} was not in any movies!</li>
</ul>

</body>
</html><commit_msg>changed conditional to use if<commit_after><!DOCTYPE html>
<html>
<head>
	<title>Simplate</title>
	<script type="text/javascript" src="https://github.com/twigkit/simplate/raw/master/src/simplate.js"></script>
	<script type="text/javascript" charset="utf-8" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shCore.js"></script>
	<script type="text/javascript" charset="utf-8" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJScript.js"></script>
	<script type="text/javascript" charset="utf-8" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushXml.js"></script>
	<link rel="stylesheet" href="css/syntaxhighlighter.css" type="text/css" charset="utf-8">
</head>
<body>

<h1>Simplate > The Simple JavaScript Template Engine</h1>

<h2>Usage</h2>
<h3>JavaScript</h3>
<pre name="code" class="js:nocontrols:nogutter">
	/*
	 * element : ID or an instance of an HTMLElement
	 * data    : An array of objects
	 */
	SIMPLATE.prepare( element ).render( data );
</pre>
<h3>HTML</h3>
<p>Any tag with data-template attribute will be considered a template</p>
<pre name="code" class="xhtml:nocontrols:nogutter">
	&lt;div id=&quot;container&quot;&gt;
		&lt;span data-template&gt;{{foo.bar}}&lt;/span&gt;
	&lt;/div&gt;
</pre>

<h2>Simple Example (static array of items)</h2>
	
<script>
	window.onload = function() {
		dp.SyntaxHighlighter.HighlightAll('code');
		
		var template = SIMPLATE.prepare('marx-brothers');
		
		template.render([
				{'name':{'first':'Leonard', 'last':'Marx'}, 'nickname':'Chico', 'born': 'March 21, 1887', 'actor': true},
				{'name':{'first':'Adolph', 'last':'Marx'}, 'nickname':'Harpo', 'born': 'November 23, 1888', 'actor': true},
				{'name':{'first':'<NAME>', 'last':'Marx'}, 'nickname':'Groucho', 'born': 'October 2, 1890', 'actor': true},
				{'name':{'first':'Milton', 'last':'Marx'}, 'nickname':'Gummo', 'born': 'October 23, 1892'},
				{'name':{'first':'Herbert', 'last':'Marx'}, 'nickname':'Zeppo', 'born': 'February 25, 1901', 'actor': true}
			]);
	}
</script>

<h3>JavaScript</h3>
<pre name="code" class="js:nocontrols:nogutter">
	var template = SIMPLATE.prepare('marx-brothers');
	
	template.render([
			{'name':{'first':'Leonard', 'last':'Marx'}, 'nickname':'Chico', 'born': 'March 21, 1887', 'actor': true},
			{'name':{'first':'Adolph', 'last':'Marx'}, 'nickname':'Harpo', 'born': 'November 23, 1888', 'actor': true},
			{'name':{'first':'<NAME>', 'last':'Marx'}, 'nickname':'Groucho', 'born': 'October 2, 1890', 'actor': true},
			{'name':{'first':'Milton', 'last':'Marx'}, 'nickname':'Gummo', 'born': 'October 23, 1892'},
			{'name':{'first':'Herbert', 'last':'Marx'}, 'nickname':'Zeppo', 'born': 'February 25, 1901', 'actor': true}
		]);
</pre>

<h3>HTML</h3>
<pre name="code" class="xhtml:nocontrols:nogutter">
	&lt;style&gt;
		ul#marx-brothers li.person { margin-left: 25px; }
		ul#marx-brothers li.person.grumpy { color: red; }
	&lt;/style&gt;

	&lt;ul id=&quot;marx-brothers&quot;&gt;
		&lt;li style=&quot;list-style: none; font-weight: bold; border-bottom: 1px solid #000;&quot;&gt;Marx Brothers (this element is not removed)&lt;/li&gt;
		&lt;li data-template data-if-nickname=&quot;Groucho&quot; class=&quot;person grumpy&quot;&gt;{{nickname}} was grumpy!&lt;/li&gt;
		&lt;li data-template data-if-actor class=&quot;person&quot;&gt;{{name.first}}, nicknamed &#x27;&lt;i&gt;{{nickname}} {{name.last}}&lt;/i&gt;&#x27; was born on {{born}}&lt;/li&gt;
		&lt;li data-template class=&quot;person&quot;&gt;{{name.first}} {{name.last}} was not in any movies!&lt;/li&gt;
	&lt;/ul&gt;
</pre>

<h3>Output</h3>

<style>
	ul#marx-brothers li.person { margin-left: 25px; }
	ul#marx-brothers li.person.grumpy { color: red; }
</style>

<ul id="marx-brothers">
	<li style="list-style: none; font-weight: bold; border-bottom: 1px solid #000;">Marx Brothers (this element is not removed)</li>
	<li data-template data-if-nickname="Groucho" class="person grumpy">{{nickname}} was grumpy!</li>
	<li data-template data-if-actor class="person">{{name.first}}, nicknamed '<i>{{nickname}} {{name.last}}</i>' was born on {{born}}</li>
	<li data-template class="person">{{name.first}} {{name.last}} was not in any movies!</li>
</ul>

</body>
</html>
{'fraction_non_alphanumeric': 0.2342042755344418, 'fraction_numerical': 0.022327790973871733, 'mean_word_length': 6.191289496157131, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 129, 'https://': 2, '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': '555104', 'n_tokens_mistral': 3495, 'n_tokens_neox': 3101, 'n_words': 611}