<commit_before>module ToolbarHelper
  # Public interface

  # Render a list of buttons (toolbar) to html
  #
  # Called directly when updating toolbars in an existing page.
  #
  def buttons_to_html(buttons)
    content_tag(:div, :class => 'form-group') do # form-group aroung each toolbar section
      Array(buttons).collect do |button|
        toolbar_top_button(button)
      end.join('').html_safe
    end
  end

  # Request that a toolbar is rendered.
  #
  #   * div_id        -- toolbar div DOM id
  #   * toolbar_name  -- toolbar name (presently means name of the yaml file<commit_msg>Split toolbars to form-groups at separators.<commit_after>module ToolbarHelper
  # Public interface

  # Render a list of buttons (toolbar) to html
  #
  # Called directly when updating toolbars in an existing page.
  #
  def buttons_to_html(buttons_in)
    groups = split_to_groups(Array(buttons_in))

    groups.collect do |buttons|
      content_tag(:div, :class => 'form-group') do # form-group aroung each toolbar section
        Array(buttons).collect do |button|
          toolbar_top_button(button)
        end.join('').html_safe
      end
    end.join('').html_safe
  end

  # Split buttons to group at separators
  #
  def split_to_groups(buttons)
    buttons.slice_before { |props| props['type'] == 'separator' }.to_a
  end

  # Request that a toolbar is rendered.
  #
  #   * div_id        -- toolbar div DOM id
  #   * toolbar_name  -- toolbar name (presently means name of the yaml file
{'fraction_non_alphanumeric': 0.08969210174029452, 'fraction_numerical': 0.0, 'mean_word_length': 3.0188172043010755, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7293568', 'n_tokens_mistral': 468, 'n_tokens_neox': 443, 'n_words': 144}