<commit_before>﻿using System.Collections.Generic;
using System.Web.Mvc;

namespace Log4JDash.Web.Mvc
{
    public static class DefaultValueUtil
    {
        public const string MetadataKey = "DefaultValueUtil.Value";

        public static void PopulateHtmlAttributes (ModelMetadata modelMetadata, IDictionary<string, object> htmlAttributes)
        {
            object value;
            if (modelMetadata.AdditionalValues.TryGetValue (MetadataKey, out value))
            {
                htmlAttributes.Add ("data-default", value);
            }
        }
    }
}<commit_msg>Added format support to DefaultValueUtil.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Web.Mvc;

namespace Log4JDash.Web.Mvc
{
    public static class DefaultValueUtil
    {
        public const string MetadataKey = "DefaultValueUtil.Value";

        public static void PopulateHtmlAttributes (ModelMetadata modelMetadata, IDictionary<string, object> htmlAttributes)
        {
            object value;
            if (modelMetadata.AdditionalValues.TryGetValue (MetadataKey, out value))
            {
                object attributeValue;
                if (value == null)
                {
                    attributeValue = modelMetadata.NullDisplayText;
                }
                else if (modelMetadata.EditFormatString != null)
                {
                    attributeValue = String.Format (modelMetadata.EditFormatString, value);
                }
                else
                {
                    attributeValue = value;
                }
                htmlAttributes.Add ("data-default", attributeValue);
                
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.07285546415981199, 'fraction_numerical': 0.0011750881316098707, 'mean_word_length': 1.8195364238410596, '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': '964658', 'n_tokens_mistral': 409, 'n_tokens_neox': 390, 'n_words': 92}