<commit_before><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="*" mode="toc" />
	
	<xsl:template match="*[(h2 | h3) and count(*) &gt; 15]" mode="toc">
		<h2>Table of contents</h2>
		
		<ol class="toc">
			<xsl:for-each select="h2">
				<xsl:variable name="tocsection" select="position()" />
				<xsl:variable name="next" select="
					1 + count(following-sibling::h3[
						preceding-sibling::h2[1] = current()
					])
				" />
				
				<li>
					<xsl:value-of select="$tocsection" />
					<xsl:text>. </xsl:text>
					
					<a href="#view={$tocsection}">
						<xsl:value-of select="." />
					</a>
					
					<xsl:if test="following-sibling::h3[position() &lt; $next]">
						<ol>
							<xsl:for-each select="following-sibling::h3[position() &lt; $next]">
								<li>
									<xsl:value-of select="$tocsection" />
									<xsl:text>.</xsl:text>
									<xsl:value-of select="position()" />
									<xsl:text>. </xsl:text>
									
									<a href="#view={$tocsection}.{position()}">
										<xsl:value-of select="." />
									</a><commit_msg>TOC now requires 4 headers and at least 10 elements on a page before appearing.<commit_after><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="*" mode="toc" />
	
	<xsl:template match="*[count(h2 | h3) &gt; 3 and count(*) &gt; 9]" mode="toc">
		<h2>Table of contents</h2>
		
		<ol class="toc">
			<xsl:for-each select="h2">
				<xsl:variable name="tocsection" select="position()" />
				<xsl:variable name="next" select="
					1 + count(following-sibling::h3[
						preceding-sibling::h2[1] = current()
					])
				" />
				
				<li>
					<xsl:value-of select="$tocsection" />
					<xsl:text>. </xsl:text>
					
					<a href="#view={$tocsection}">
						<xsl:value-of select="." />
					</a>
					
					<xsl:if test="following-sibling::h3[position() &lt; $next]">
						<ol>
							<xsl:for-each select="following-sibling::h3[position() &lt; $next]">
								<li>
									<xsl:value-of select="$tocsection" />
									<xsl:text>.</xsl:text>
									<xsl:value-of select="position()" />
									<xsl:text>. </xsl:text>
									
									<a href="#view={$tocsection}.{position()}">
										<xsl:value-of select="." />
									</a>
{'fraction_non_alphanumeric': 0.22021052631578947, 'fraction_numerical': 0.02063157894736842, 'mean_word_length': 2.7476340694006307, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 2, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, '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': '3358088', 'n_tokens_mistral': 1232, 'n_tokens_neox': 842, 'n_words': 147}