<commit_before>/* global define */

define(function (require, exports, module) {
    "use strict";

    function _getTypeClass(name) {
        var classes = {
            "#": "id",
            ".": "class",
            "@": "at-rules",
            "[": "attribute"
        };
        return " outline-entry-css-" + (classes[name[0]] || "tag");
    }

    function _createListEntry(name, line, ch) {
        var $elements = [];
        var $name = $(document.createElement("span"));
        var typeClass = _getTypeClass(name);
        $name.text(name);
        $elements.push($name);
        return {
            name: name,
            line: line,
            ch: ch,
            classes: "outline-entry-css outline-entry-icon" + typeClass,
            $html: $elements
        };
    }

    /**
     * Create the entry list of functions language dependent.
     * @param   {Array} lines Array that contains the lines of text.
     * @returns {Array} List of outline entries.
     */
    function getOutlineList(lines) {
        var regex =  /([^\r\n,{}]+)((?=[^}]*\{)|\s*\{)/g;
        var result = [];
        lines.forEach(function (line, index) {
            var match = regex.exec(line);
            while (match !== null) {
                var name = match[1].trim();
                result.push(_createListEntry(name, index, line.length));
                match = regex.exec(line);
            }
        });
        return result;
    }<commit_msg>Fixed issue #5 where selectors with curly braces on the subsequent line wouldn't be detected<commit_after>/* global define */

define(function (require, exports, module) {
    "use strict";

    function _getTypeClass(name) {
        var classes = {
            "#": "id",
            ".": "class",
            "@": "at-rules",
            "[": "attribute"
        };
        return " outline-entry-css-" + (classes[name[0]] || "tag");
    }

    function _createListEntry(name, line, ch) {
        var $elements = [];
        var $name = $(document.createElement("span"));
        var typeClass = _getTypeClass(name);
        $name.text(name);
        $elements.push($name);
        return {
            name: name,
            line: line,
            ch: ch,
            classes: "outline-entry-css outline-entry-icon" + typeClass,
            $html: $elements
        };
    }

    /**
     * Create the entry list of functions language dependent.
     * @param   {Array} lines Array that contains the lines of text.
     * @returns {Array} List of outline entries.
     */
    function getOutlineList(lines) {
        var regex =  /([^\r\n,{}]+)((?=[^}]*\{)|\s*\{)/g;
        var result = [];
        lines = lines.join("\n").replace(/(\n*)\{/g, "{$1").split("\n");
        lines.forEach(function (line, index) {
            var match = regex.exec(line);
            while (match !== null) {
                var name = match[1].trim();
                result.push(_createListEntry(name, index, line.length));
                match = regex.exec(line);
            }
        });
        return result;
    }
{'fraction_non_alphanumeric': 0.15916503587736464, 'fraction_numerical': 0.0019569471624266144, 'mean_word_length': 1.7432915921288015, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, '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': '7208451', 'n_tokens_mistral': 880, 'n_tokens_neox': 867, 'n_words': 213}