<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!--
 - Desc:    This file is part of the ecromedos Document Preparation System
 - Date:    2009/11/15
 - Author:  <NAME> (<EMAIL>)
 - License: GNU General Public License, version 2
 - URL:     http://www.ecromedos.net
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!--
 - All 'make-index' elements are replaced with an 'index' section
 - by the pre-processor. So this should never match, unless in draft mode.
-->
<xsl:template match="make-index">
	<!-- cut -->
</xsl:template>

<!--
 - Processes an index environment. Items have already been
 - sorted by the pre-processor.
-->
<xsl:template match="index">
	<xsl:text>\begin{multicols}{</xsl:text>
	<!-- number of columns -->
	<xsl:choose>
		<xsl:when test="@columns">
			<xsl:value-of select="@columns"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:text>2</xsl:text>
		</xsl:otherwise>
	</xsl:choose>
	<xsl:text>}[</xsl:text>
	<xsl:if test="not(@tocentry) or @tocentry != 'no'">
		<xsl:text>\addchap{</xsl:text>
	</xsl:if>
	<!-- index name -->
	<xsl:choose>
		<xsl:when test="@title">
			<xsl:value-of select="normalize-space(@title)"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:call-template name="i18n.print">
				<xsl:with-param name="key" select="'index'"/>
			</xsl:call-template>
		</xsl:otherwise>
	</xsl:choose>
	<xsl:if test="not(@tocentry) or @tocentry != 'no'">
		<xsl:text>}</xsl:text>
	</xsl:if>
	<xsl:text>]&#x0a;</xsl:text>

	<!-- set parskip, parindent and columnsep -->
	<xsl:text>\setlength{\parindent}{0em}&#x0a;</xsl:text>
	<xsl:text>\setlength{\parskip}{0ex}&#x0a;</xsl:text>
	<xsl:text>\makeatletter&#x0a;</xsl:text>
	<xsl:text>\let\item\@idxitem&#x0a;</xsl:text>
	<xsl:text>\makeatother&#x0a;</xsl:text>

	<!-- render sections -->
	<xsl:for-each select="idxsection[child::item]">
		<xsl:apply-templates select="."/>
	</xsl:for-each>

	<xsl:text>\end{multicols}&#x0a;&#x0a;</xsl:text>
</xsl:template>

<!--
 - Renders an index section.
-->
<xsl:template match="idxsection">
	<!-- section name, usually a
	letter from the alphabet -->
	<xsl:if test="@name">
		<xsl:text>\vspace{3ex}{\sffamily\bfseries\large{}</xsl:text>
		<xsl:value-of select="normalize-space(@name)"/>
		<xsl:text>}\hfil\nopagebreak\vspace{3pt}</xsl:text>
	</xsl:if>
	<!-- render items -->
	<xsl:for-each select="item|subitem|subsubitem">
		<xsl:text>\</xsl:text><xsl:value-of select="name()"/><xsl:text> </xsl:text>
		<xsl:apply-templates/>
		<xsl:text>&#x0a;&#x0a;</xsl:text>
	</xsl:for-each>
</xsl:template>

<!--<commit_msg>LaTeX: Make space between idxsections flexible length to get balanced columns<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!--
 - Desc:    This file is part of the ecromedos Document Preparation System
 - Date:    2009/11/15
 - Author:  <NAME> (<EMAIL>)
 - License: GNU General Public License, version 2
 - URL:     http://www.ecromedos.net
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!--
 - All 'make-index' elements are replaced with an 'index' section
 - by the pre-processor. So this should never match, unless in draft mode.
-->
<xsl:template match="make-index">
	<!-- cut -->
</xsl:template>

<!--
 - Processes an index environment. Items have already been
 - sorted by the pre-processor.
-->
<xsl:template match="index">
	<xsl:text>\begin{multicols}{</xsl:text>
	<!-- number of columns -->
	<xsl:choose>
		<xsl:when test="@columns">
			<xsl:value-of select="@columns"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:text>2</xsl:text>
		</xsl:otherwise>
	</xsl:choose>
	<xsl:text>}[</xsl:text>
	<xsl:if test="not(@tocentry) or @tocentry != 'no'">
		<xsl:text>\addchap{</xsl:text>
	</xsl:if>
	<!-- index name -->
	<xsl:choose>
		<xsl:when test="@title">
			<xsl:value-of select="normalize-space(@title)"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:call-template name="i18n.print">
				<xsl:with-param name="key" select="'index'"/>
			</xsl:call-template>
		</xsl:otherwise>
	</xsl:choose>
	<xsl:if test="not(@tocentry) or @tocentry != 'no'">
		<xsl:text>}</xsl:text>
	</xsl:if>
	<xsl:text>]&#x0a;</xsl:text>

	<!-- set parskip, parindent and columnsep -->
	<xsl:text>\setlength{\parindent}{0em}&#x0a;</xsl:text>
	<xsl:text>\setlength{\parskip}{0ex}&#x0a;</xsl:text>
	<xsl:text>\makeatletter&#x0a;</xsl:text>
	<xsl:text>\let\item\@idxitem&#x0a;</xsl:text>
	<xsl:text>\makeatother&#x0a;</xsl:text>

	<!-- render sections -->
	<xsl:for-each select="idxsection[child::item]">
		<xsl:apply-templates select="."/>
	</xsl:for-each>

	<xsl:text>\end{multicols}&#x0a;&#x0a;</xsl:text>
</xsl:template>

<!--
 - Renders an index section.
-->
<xsl:template match="idxsection">
	<!-- section name, usually a
	letter from the alphabet -->
	<xsl:if test="@name">
		<xsl:text>\vspace{3ex plus .5ex minus .25ex}{\sffamily\bfseries\large{}</xsl:text>
		<xsl:value-of select="normalize-space(@name)"/>
		<xsl:text>}\hfil\nopagebreak\vspace{3pt}</xsl:text>
	</xsl:if>
	<!-- render items -->
	<xsl:for-each select="item|subitem|subsubitem">
		<xsl:text>\</xsl:text><xsl:value-of select="name()"/><xsl:text> </xsl:text>
		<xsl:apply-templates/>
		<xsl:text>&#x0a;&#x0a;</xsl:text>
	</xsl:for-each>
</xsl:template>

<!--
{'fraction_non_alphanumeric': 0.22971933871587852, 'fraction_numerical': 0.01441753171856978, 'mean_word_length': 4.425443169968718, 'pattern_counts': {'":': 0, '<': 177, '<?xml version=': 2, '>': 175, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '5417660', 'n_tokens_mistral': 2247, 'n_tokens_neox': 1955, 'n_words': 350}