<commit_before>(function (templateLayout) {

    var generator, log;
    log = wef.logger("templateLayout.generator");

    log.info("load generator module");

    function generateRootTemplate(template) {
        //here is document
        //if template.isLeaf() creates DOM and append to parentDOM
        //else traverse TOM

        function generateLeaf(template, parentHtmlNode) {
            log.info("leaf:", template.selectorText, "(parent:", parentHtmlNode.localName, ")");
            var childElement = document.querySelector(template.selectorText);
            parentHtmlNode.appendChild(childElement);
        }

        function generateTemplate(template, parentHtmlNode) {
            var rootElement, tableDiv, rowDiv, cellDiv;

            if (template.isLeaf()) {
                generateLeaf(template, parentHtmlNode);
            } else {
                log.info("no leaf:", template.selectorText, "(parent:", parentHtmlNode.localName, ")");
                rootElement = document.querySelector(template.selectorText);
                parentHtmlNode.appendChild(rootElement);

                //create container
                tableDiv = document.createElement("div");
                tableDiv.className = "templateLayoutDiv templateLayoutTable";
                tableDiv.style.display = "table";
                //append container to parent
                rootElement.appendChild(tableDiv);

                template.grid.rows.forEach(function (row) {
                    log.info("row:", row.rowText);

                    //create container
                    rowDiv = document.createElement("div");
                    rowDiv.className = "templateLayoutDiv templateLayoutRow";
                    rowDiv.style.display = "table-row";
                    //append to parent
                    tableDiv.appendChild(rowDiv);

                    row.slotIdentifier.forEach(function (slotId) {
                        log.info("slot:", slotId.slotText);
                        //each slot can have multiple elements
                        template.grid.slots[slotId.slotText].forEach(function (templateInSlot) {
                            log.info("slotELEMENT ", templateInSlot.selectorText);

                            //create container
                            cellDiv = document.createElement("div");
                            cellDiv.className = "templateLayoutDiv templateLayoutCell";
                            cellDiv.style.display = "table-cell";
                            rowDiv.appendChild(cellDiv);
                            //generate children and append to this container
                            generateTemplate(templateInSlot, cellDiv);
                        });
                        if (template.grid.slots[slotId.slotText]) {
                        }
                    });
                });<commit_msg>Fix output html policy<commit_after>(function (templateLayout) {

    var generator, log;
    log = wef.logger("templateLayout.generator");

    log.info("load generator module");

    function generateRootTemplate(template) {
        //here is document
        //if template.isLeaf() creates DOM and append to parentDOM
        //else traverse TOM

        function generateLeaf(template, parentHtmlNode) {
            log.info("leaf:", template.selectorText, "(parent:", parentHtmlNode.localName, ")");
            var childElement = document.querySelector(template.selectorText);
            parentHtmlNode.appendChild(childElement);
        }

        function generateTemplate(template, parentHtmlNode) {
            var rootElement, tableDiv, rowDiv, cellDiv;

            if (template.isLeaf()) {
                generateLeaf(template, parentHtmlNode);
            } else {
                log.info("no leaf:", template.selectorText, "(parent:", parentHtmlNode.localName, ")");
                rootElement = document.querySelector(template.selectorText);
                parentHtmlNode.appendChild(rootElement);

                //create container
                tableDiv = document.createElement("table");
                tableDiv.className = "templateLayoutDiv templateLayoutTable";
                //append container to parent
                rootElement.appendChild(tableDiv);

                template.grid.rows.forEach(function (row) {
                    log.info("row:", row.rowText);

                    //create container
                    rowDiv = document.createElement("tr");
                    rowDiv.className = "templateLayoutDiv templateLayoutRow";
                    //append to parent
                    tableDiv.appendChild(rowDiv);

                    row.slotIdentifier.forEach(function (slotId) {
                        log.info("slot:", slotId.slotText);
                        //each slot can have multiple elements
                        template.grid.slots[slotId.slotText].forEach(function (templateInSlot) {
                            log.info("slotELEMENT ", templateInSlot.selectorText);

                            //create container
                            cellDiv.className = "templateLayoutDiv templateLayoutCell";
                            rowDiv.appendChild(cellDiv);
                            //generate children and append to this container
                            generateTemplate(templateInSlot, cellDiv);
                        });
                        cellDiv = document.createElement("td");
                        if (template.grid.slots[slotId.slotText]) {
                        }
                    });
                });
{'fraction_non_alphanumeric': 0.09421457997492387, 'fraction_numerical': 0.0, 'mean_word_length': 1.6032634032634032, 'pattern_counts': {'":': 0, '<': 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': '2340283', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1171, 'n_words': 245}