<commit_before>'use strict';

const cheerio = require('cheerio');

/**
 * SVG Document
 * - Generates SVG content.
 * - Parses the content of a SVG document.
 */
class SvgDocument {

    /**
     * Parses the given content.
     * @param {string} content - the content of a SVG file.
     */
    constructor(content) {
        const $ = cheerio.load(content, { normalizeWhitespace: true, xmlMode: true });

        this.$ = $;
        this.$svg = $('svg');
    }

    /**
     * Creates an SVG document with the given contents.
     * @param {...string} contents - contents to be included in the document.
     * @returns {string}
     */
    static create(...contents) {
        const $contents = cheerio.load(contents.join(''), { normalizeWhitespace: true, xmlMode: true });

        const defs = Array.from($contents('defs').map((i, el) => {
            const $ = cheerio.load(el);
            const html = $(el).html();

            $(el).remove();

            return html;
        })).join();

        const clipPaths = Array.from($contents('clipPath').map((i, el) => {
            const $ = cheerio.load(el);
            const html = $.html(el);

            $(el).remove();

            return html;
        })).join('');
<commit_msg>Fixed commas being added between <defs> items<commit_after>'use strict';

const cheerio = require('cheerio');

/**
 * SVG Document
 * - Generates SVG content.
 * - Parses the content of a SVG document.
 */
class SvgDocument {

    /**
     * Parses the given content.
     * @param {string} content - the content of a SVG file.
     */
    constructor(content) {
        const $ = cheerio.load(content, { normalizeWhitespace: true, xmlMode: true });

        this.$ = $;
        this.$svg = $('svg');
    }

    /**
     * Creates an SVG document with the given contents.
     * @param {...string} contents - contents to be included in the document.
     * @returns {string}
     */
    static create(...contents) {
        const $contents = cheerio.load(contents.join(''), { normalizeWhitespace: true, xmlMode: true });

        const defs = Array.from($contents('defs').map((i, el) => {
            const $ = cheerio.load(el);
            const html = $(el).html();

            $(el).remove();

            return html;
        })).join('');

        const clipPaths = Array.from($contents('clipPath').map((i, el) => {
            const $ = cheerio.load(el);
            const html = $.html(el);

            $(el).remove();

            return html;
        })).join('');

{'fraction_non_alphanumeric': 0.16123907863383638, 'fraction_numerical': 0.0, 'mean_word_length': 2.0386007237635706, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2084532', 'n_tokens_mistral': 750, 'n_tokens_neox': 725, 'n_words': 200}