<commit_before>package org.apereo.cas.services.web;

import lombok.extern.slf4j.Slf4j;
import org.thymeleaf.engine.AbstractTemplateHandler;
import org.thymeleaf.model.ICloseElementTag;
import org.thymeleaf.model.IOpenElementTag;
import org.thymeleaf.model.IText;
import lombok.NoArgsConstructor;

/**
 * This is {@link CasThymeleafOutputTemplateHandler}.
 *
 * @author <NAME>
 * @since 5.2.0
 */
@Slf4j
@NoArgsConstructor
public class CasThymeleafOutputTemplateHandler extends AbstractTemplateHandler {

    private boolean writeWhitespace;

    @Override
    public void handleText(final IText text) {
        final String contentString = text.getText();
        if (!contentString.isEmpty()) {
            if (!writeWhitespace) {
                return;
            }
            writeWhitespace = false;
        }
        super.handleText(text);
    }

    @Override
    public void handleCloseElement(final ICloseElementTag tag) {
        super.handleCloseElement(tag);
        writeWhitespace = true;
    }<commit_msg>Revert change from 0f1d011 (#3285)<commit_after>package org.apereo.cas.services.web;

import lombok.extern.slf4j.Slf4j;
import org.thymeleaf.engine.AbstractTemplateHandler;
import org.thymeleaf.model.ICloseElementTag;
import org.thymeleaf.model.IOpenElementTag;
import org.thymeleaf.model.IText;
import lombok.NoArgsConstructor;

/**
 * This is {@link CasThymeleafOutputTemplateHandler}.
 *
 * @author <NAME>
 * @since 5.2.0
 */
@Slf4j
@NoArgsConstructor
public class CasThymeleafOutputTemplateHandler extends AbstractTemplateHandler {

    private boolean writeWhitespace;

    @Override
    public void handleText(final IText text) {
        final String contentString = text.getText();
        if (!contentString.isEmpty() && contentString.trim().isEmpty()) {
            if (!writeWhitespace) {
                return;
            }
            writeWhitespace = false;
        }
        super.handleText(text);
    }

    @Override
    public void handleCloseElement(final ICloseElementTag tag) {
        super.handleCloseElement(tag);
        writeWhitespace = true;
    }
{'fraction_non_alphanumeric': 0.09471680152308425, 'fraction_numerical': 0.009995240361732508, 'mean_word_length': 3.2464646464646463, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5541935', 'n_tokens_mistral': 652, 'n_tokens_neox': 631, 'n_words': 123}