<commit_before>class TextFieldTag < FieldTag
  def initialize(tag_name, markup, tokens)
    begin
      super(tag_name, markup, tokens)
    rescue Liquid::SyntaxError => e
      raise Liquid::SyntaxError.new("Syntax Error in 'text_field' - Valid syntax: text_field [name]")
    end
  end

  private

  def html_attributes
    @no_hidden_checkbox = parse_attribute(attributes.delete('no_hidden')).to_boolean
    @input_type = "text"
    html_attributes = ""
    attributes.each do |key, value|
      case key
      when 'hidden'
        @input_type = "hidden"
      when 'password'
        @input_type = "password"
      when 'radio'
        @input_type = "radio"
        if form_options[:found_in_model] && form_options[:found_value] == context_value(attributes['value']).to_s
          html_attributes += render_attribute("checked", "checked")
        end
        html_attributes.gsub!("id=\"#{attributes['id']}\"", "id=\"#{attributes['id']}_#{context_value(attributes['value'])}\"")
        attributes['id'] += "_#{attributes['value']}"
      when 'checkbox'
        @input_type = "checkbox"
        if form_options[:found_in_model]
          if form_option[:found_array] && form_option[:found_value_array].contains(parse_attribute(attributes['value']).to_s)
            html_attributes += render_attribute("checked", "checked")
          elsif @context.registers[form_options[:register_key]].respond_to?("#{@name}?".to_sym) && @context.registers[form_options[:register_key]].send("#{@name}?".to_sym)
            html_attributes += render_attribute("checked", "checked")
          end
        end
      else
        html_attributes += render_attribute(key, value)
      end
    end
    html_attributes
  end

  def field_html
    # call before to load @input_type
    html_attribute_string = html_attributes
    # create field
    rvalue = ""
    if @input_type == "checkbox" && !@no_hidden_checkbox
      rvalue += HiddenFieldTag.new(<commit_msg>forgot the s<commit_after>class TextFieldTag < FieldTag
  def initialize(tag_name, markup, tokens)
    begin
      super(tag_name, markup, tokens)
    rescue Liquid::SyntaxError => e
      raise Liquid::SyntaxError.new("Syntax Error in 'text_field' - Valid syntax: text_field [name]")
    end
  end

  private

  def html_attributes
    @no_hidden_checkbox = parse_attribute(attributes.delete('no_hidden')).to_boolean
    @input_type = "text"
    html_attributes = ""
    attributes.each do |key, value|
      case key
      when 'hidden'
        @input_type = "hidden"
      when 'password'
        @input_type = "password"
      when 'radio'
        @input_type = "radio"
        if form_options[:found_in_model] && form_options[:found_value] == context_value(attributes['value']).to_s
          html_attributes += render_attribute("checked", "checked")
        end
        html_attributes.gsub!("id=\"#{attributes['id']}\"", "id=\"#{attributes['id']}_#{context_value(attributes['value'])}\"")
        attributes['id'] += "_#{attributes['value']}"
      when 'checkbox'
        @input_type = "checkbox"
        if form_options[:found_in_model]
          if form_options[:found_array] && form_options[:found_value_array].contains(parse_attribute(attributes['value']).to_s)
            html_attributes += render_attribute("checked", "checked")
          elsif @context.registers[form_options[:register_key]].respond_to?("#{@name}?".to_sym) && @context.registers[form_options[:register_key]].send("#{@name}?".to_sym)
            html_attributes += render_attribute("checked", "checked")
          end
        end
      else
        html_attributes += render_attribute(key, value)
      end
    end
    html_attributes
  end

  def field_html
    # call before to load @input_type
    html_attribute_string = html_attributes
    # create field
    rvalue = ""
    if @input_type == "checkbox" && !@no_hidden_checkbox
      rvalue += HiddenFieldTag.new(
{'fraction_non_alphanumeric': 0.13336753013593228, 'fraction_numerical': 0.0, 'mean_word_length': 3.4267877412031784, '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': '5421212', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1158, 'n_words': 219}