<commit_before>/*
 *  Heading Anchors v1.0
 *  Copyright (c) 2010 <NAME> <http://twitter.com/rafBM>
 *
 *  Freely distributable under the terms of the MIT license.
 *  <http://github.com/rafBM/heading-anchors>
 *
 */

window.HeadingAnchors = {

    init: function( customHeadingsSelector ) {
        
        if ( 'querySelectorAll' in document ) {
            
            var $ = function( selector ) {
                var domElements   = document.querySelectorAll( selector ),
                    elementsArray = [];
                for ( var i = 0; i < domElements.length; i++ ) {
                    elementsArray.push( domElements[i] );
                }
                return elementsArray;
            };

            var nice = function( notNiceString ) {
                return notNiceString.replace('’','').replace(/[^a-z0-9]+/ig, '-');
            };

            var niceHeadings = {}, headingsSelector;
            
            if ( typeof customHeadingsSelector == "string" && customHeadingsSelector.length ) {
                headingsSelector = customHeadingsSelector;
            } else {
                headingsSelector = 'h2, h3, h4, h5, h6';
            }
            
            $( headingsSelector ).forEach(function( headingElement ) {

                var anchor    = document.createElement('a'),
                    niceHeading = nice( headingElement.id ? headingElement.id : headingElement.innerHTML.replace(/<([^ ]+)[^<>]*>([^<>]*)<\/\1>/ig, '$2') );

                anchor.className = 'heading-anchor';
                
                if ( niceHeading in niceHeadings ) {
                    anchor.href = '#'+ niceHeading +'-'+ niceHeadings[niceHeading];
                    headingElement.id = niceHeading +'-'+ niceHeadings[niceHeading];
                    niceHeadings[niceHeading] = niceHeadings[niceHeading] += 1;
                } else {
                    anchor.href = '#'+ niceHeading;
                    headingElement.id = niceHeading;
                    niceHeadings[niceHeading] = 2;<commit_msg>Nobody cares about typography anyway.<commit_after>/*
 *  Heading Anchors v1.0
 *  Copyright (c) 2010 <NAME> <http://twitter.com/rafBM>
 *
 *  Freely distributable under the terms of the MIT license.
 *  <http://github.com/rafBM/heading-anchors>
 *
 */

window.HeadingAnchors = {

    init: function( customHeadingsSelector ) {
        
        if ( 'querySelectorAll' in document ) {
            
            var $ = function( selector ) {
                var domElements   = document.querySelectorAll( selector ),
                    elementsArray = [];
                for ( var i = 0; i < domElements.length; i++ ) {
                    elementsArray.push( domElements[i] );
                }
                return elementsArray;
            };

            var nice = function( notNiceString ) {
                return notNiceString.replace(/['’]/,'').replace(/[^a-z0-9]+/ig, '-');
            };

            var niceHeadings = {}, headingsSelector;
            
            if ( typeof customHeadingsSelector == "string" && customHeadingsSelector.length ) {
                headingsSelector = customHeadingsSelector;
            } else {
                headingsSelector = 'h2, h3, h4, h5, h6';
            }
            
            $( headingsSelector ).forEach(function( headingElement ) {

                var anchor    = document.createElement('a'),
                    niceHeading = nice( headingElement.id ? headingElement.id : headingElement.innerHTML.replace(/<([^ ]+)[^<>]*>([^<>]*)<\/\1>/ig, '$2') );

                anchor.className = 'heading-anchor';
                
                if ( niceHeading in niceHeadings ) {
                    anchor.href = '#'+ niceHeading +'-'+ niceHeadings[niceHeading];
                    headingElement.id = niceHeading +'-'+ niceHeadings[niceHeading];
                    niceHeadings[niceHeading] = niceHeadings[niceHeading] += 1;
                } else {
                    anchor.href = '#'+ niceHeading;
                    headingElement.id = niceHeading;
                    niceHeadings[niceHeading] = 2;
{'fraction_non_alphanumeric': 0.12575867929109008, 'fraction_numerical': 0.00873998543335761, 'mean_word_length': 1.6175349428208385, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, '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': '1965904', 'n_tokens_mistral': 1134, 'n_tokens_neox': 1057, 'n_words': 211}