<commit_before>/*
 * Emulation layer for Google gadgets.
 *
 * Load and parse locale data.
 *
 * author: <NAME> <<EMAIL>>
 */

#include "google-gadget-internal.h"
#include "parser.h"
#include "url-stream.h"
#include "http-response.h"
#include "processor.h"

static void
gg_msg_finish(struct google_gadget *gg)
{
    if (!gg->msg.in_msg_tag)
        return;

    if (gg->msg.key != NULL)
        istream_subst_add(gg->subst, gg->msg.key, gg->msg.value);

    gg->msg.in_msg_tag = 0;<commit_msg>strip messages<commit_after>/*
 * Emulation layer for Google gadgets.
 *
 * Load and parse locale data.
 *
 * author: <NAME> <<EMAIL>>
 */

#include "google-gadget-internal.h"
#include "parser.h"
#include "url-stream.h"
#include "http-response.h"
#include "processor.h"
#include "strutil.h"

static const char *
gg_msg_strip(pool_t pool, const char *value)
{
    size_t length;

    while (*value != 0 && char_is_whitespace(*value))
        ++value;

    length = strlen(value);
    while (length > 0 && char_is_whitespace(value[length - 1]))
        --length;

    return p_strndup(pool, value, length);
}

static void
gg_msg_finish(struct google_gadget *gg)
{
    if (!gg->msg.in_msg_tag)
        return;

    if (gg->msg.key != NULL)
        istream_subst_add(gg->subst, gg->msg.key,
                          gg_msg_strip(gg->pool, gg->msg.value));

    gg->msg.in_msg_tag = 0;
{'fraction_non_alphanumeric': 0.15574963609898107, 'fraction_numerical': 0.00363901018922853, 'mean_word_length': 3.141566265060241, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, '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': '886776', 'n_tokens_mistral': 524, 'n_tokens_neox': 509, 'n_words': 110}