<commit_before># encoding: utf-8
#
#  = Application Helpers
#
#  These methods are available to all templates in the application:
#
################################################################################

module ApplicationHelper
  include AutocompleteHelper
  include DescriptionHelper
  include ExporterHelper
  include FooterHelper
  include JavascriptHelper
  include LocalizationHelper
  include MapHelper
  include ObjectLinkHelper
  include TabsHelper
  include ThumbnailHelper
  include VersionHelper

  def safe_empty; "".html_safe; end
  def safe_br; "<br/>".html_safe; end
  def safe_nbsp; "&nbsp;".html_safe; end

  # Return escaped HTML.
  #
  #   "<i>X</i>"  -->  "&lt;i&gt;X&lt;/i&gt;"
  def escape_html(html)
		h(html.to_str)
	end

  # Call link_to with query params added.
  def link_with_query(name = nil, options = nil, html_options = nil)
    link_to(name, add_query_param(options), html_options)
  end

  # Create an in-line white-space element approximately the given width in
  # pixels.  It should be non-line-breakable, too.
  def indent(w=10)
    "<span style='margin-left:#{w}px'>&nbsp;</span>".html_safe
  end

  # Wrap content in tag if condition is true, else nil
  # 1st arg is condition, which wraps content_tag
  def content_tag_if(condition, name, content_or_options_with_block = nil,
                     options = nil, escape = true, &block)
    return unless condition
    content_tag(name, content_or_options_with_block, options, escape, &block)
  end

  # Wrap content in tag unless condition is true, else nil
  def content_tag_unless(condition, name, content_or_options_with_block = nil,
                         options = nil, escape = true, &block)
    content_tag_if(!condition, name, content_or_options_with_block,
                   options, escape, &block)
  end

  # Wrap an html object in '<span title="blah">' tag.  This has the effect of
  # giving it context help (mouse-over popup) in most modern browsers.
  #
  #   <%= add_context_help(link, "Click here to do something.") %>
  #
  def add_context_help(object, help)
    content_tag(:span, object, title: help, data: {toggle: "tooltip"})
  end

  # Add something to the header from within view.  This can be called as many
  # times as necessary -- the application layout will mash them all together
  # and stick them at the end of the <tt>&gt;head&lt;/tt> section.
  #
  #   <%
  #     add_header(GMap.header)       # adds GMap general header
  #     gmap = make_map(@locations)
  #     add_header(finish_map(gmap))  # adds map-specific header<commit_msg>Removed some comments in application_helper per code review<commit_after># encoding: utf-8
#
#  = Application Helpers
#
#  These methods are available to all templates in the application:
#
################################################################################

module ApplicationHelper
  include AutocompleteHelper
  include DescriptionHelper
  include ExporterHelper
  include FooterHelper
  include JavascriptHelper
  include LocalizationHelper
  include MapHelper
  include ObjectLinkHelper
  include TabsHelper
  include ThumbnailHelper
  include VersionHelper

  def safe_empty; "".html_safe; end
  def safe_br; "<br/>".html_safe; end
  def safe_nbsp; "&nbsp;".html_safe; end

  # Return escaped HTML.
  #
  #   "<i>X</i>"  -->  "&lt;i&gt;X&lt;/i&gt;"
  def escape_html(html)
		h(html.to_str)
	end

  # Call link_to with query params added.
  def link_with_query(name = nil, options = nil, html_options = nil)
    link_to(name, add_query_param(options), html_options)
  end

  # Create an in-line white-space element approximately the given width in
  # pixels.  It should be non-line-breakable, too.
  def indent(w=10)
    "<span style='margin-left:#{w}px'>&nbsp;</span>".html_safe
  end

  def content_tag_if(condition, name, content_or_options_with_block = nil,
                     options = nil, escape = true, &block)
    return unless condition
    content_tag(name, content_or_options_with_block, options, escape, &block)
  end

  def content_tag_unless(condition, name, content_or_options_with_block = nil,
                         options = nil, escape = true, &block)
    content_tag_if(!condition, name, content_or_options_with_block,
                   options, escape, &block)
  end

  # Wrap an html object in '<span title="blah">' tag.  This has the effect of
  # giving it context help (mouse-over popup) in most modern browsers.
  #
  #   <%= add_context_help(link, "Click here to do something.") %>
  #
  def add_context_help(object, help)
    content_tag(:span, object, title: help, data: {toggle: "tooltip"})
  end

  # Add something to the header from within view.  This can be called as many
  # times as necessary -- the application layout will mash them all together
  # and stick them at the end of the <tt>&gt;head&lt;/tt> section.
  #
  #   <%
  #     add_header(GMap.header)       # adds GMap general header
  #     gmap = make_map(@locations)
  #     add_header(finish_map(gmap))  # adds map-specific header
{'fraction_non_alphanumeric': 0.12300955414012739, 'fraction_numerical': 0.001393312101910828, 'mean_word_length': 3.67877094972067, 'pattern_counts': {'":': 0, '<': 21, '<?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': '4917410', 'n_tokens_mistral': 1557, 'n_tokens_neox': 1506, 'n_words': 473}