<commit_before># HAML Coffee helper module
#
define ->

  # HAML Coffee html escape function.
  #
  # @param text [String] the text to escape
  # @return [String] the escaped text
  #
  escape: (text) ->
    ("" + text)
      .replace(/&/g, "&amp;")
      .replace(/</g, "&lt;")
      .replace(/>/g, "&gt;")
      .replace(/"/g, "&quot;")
      .replace(/'/g, "&#39;")
      .replace(/\//g, "&#47;")

  # HAML Coffee clean value function. Beside just
  # cleaning `null` and `undefined` values, it
  # adds a hidden unicode marker character to
  # boolean values, so that the render time boolean
  # logic can distinguish between real booleans and
  # boolean-like strings.
  #
  # @param text [String] the text to be cleaned
  # @return [String] the cleaned text
  #
  cleanValue: (text) ->
    switch text
      when null, undefined then ''
      when true, false then '\u0093' + text
      else
         text

  # Preserve newlines in the text
  #
  # @param text [String] the text to preserve
  # @return [String] the preserved text
  #
  preserve: (text) ->
    text.replace /\n/g, '&#x000A;'

  # Find and preserve newlines in the preserving tags
  #
  # @param text [String] the text to preserve
  # @return [String] the preserved text
  #
  findAndPreserve: (text) ->
    tags = '<%= ::HamlCoffeeAssets.config.preserveTags %>'.split(',').join('|')
    text = text.replace(/\r/g, '').replace ///<(#{ tags })>([\s\S]*?)<\/\1>/// g, (str, tag, content) ->
      "<#{ tag }>#{ <%= ::HamlCoffeeAssets.config.customPreserve %>(content) }</#{ tag }>"

  # The surround helper surrounds the function output
  # with the start and end string without whitespace in between.
  #
  # @param [String] start the text to prepend to the text
  # @param [String] end the text to append to the text
  # @param [Function] fn the text generating function
  # @return [String] the surrounded text
  #
  surround: (start, end, fn) ->
    start + fn.call(@)?.replace(/^\s+|\s+$/g, '') + end

  # The succeed helper appends text to the function output
  # without whitespace in between.
  #
  # @param [String] end the text to append to the text
  # @param [Function] fn the text generating function
  # @return [String] the succeeded text
  #<commit_msg>fix regexp syntax<commit_after># HAML Coffee helper module
#
define ->

  # HAML Coffee html escape function.
  #
  # @param text [String] the text to escape
  # @return [String] the escaped text
  #
  escape: (text) ->
    ("" + text)
      .replace(/&/g, "&amp;")
      .replace(/</g, "&lt;")
      .replace(/>/g, "&gt;")
      .replace(/"/g, "&quot;")
      .replace(/'/g, "&#39;")
      .replace(/\//g, "&#47;")

  # HAML Coffee clean value function. Beside just
  # cleaning `null` and `undefined` values, it
  # adds a hidden unicode marker character to
  # boolean values, so that the render time boolean
  # logic can distinguish between real booleans and
  # boolean-like strings.
  #
  # @param text [String] the text to be cleaned
  # @return [String] the cleaned text
  #
  cleanValue: (text) ->
    switch text
      when null, undefined then ''
      when true, false then '\u0093' + text
      else
         text

  # Preserve newlines in the text
  #
  # @param text [String] the text to preserve
  # @return [String] the preserved text
  #
  preserve: (text) ->
    text.replace /\n/g, '&#x000A;'

  # Find and preserve newlines in the preserving tags
  #
  # @param text [String] the text to preserve
  # @return [String] the preserved text
  #
  findAndPreserve: (text) ->
    tags = '<%= ::HamlCoffeeAssets.config.preserveTags %>'.split(',').join('|')
    text = text.replace(/\r/g, '').replace ///<(#{ tags })>([\s\S]*?)<\/\1>///g, (str, tag, content) ->
      "<#{ tag }>#{ <%= ::HamlCoffeeAssets.config.customPreserve %>(content) }</#{ tag }>"

  # The surround helper surrounds the function output
  # with the start and end string without whitespace in between.
  #
  # @param [String] start the text to prepend to the text
  # @param [String] end the text to append to the text
  # @param [Function] fn the text generating function
  # @return [String] the surrounded text
  #
  surround: (start, end, fn) ->
    start + fn.call(@)?.replace(/^\s+|\s+$/g, '') + end

  # The succeed helper appends text to the function output
  # without whitespace in between.
  #
  # @param [String] end the text to append to the text
  # @param [Function] fn the text generating function
  # @return [String] the succeeded text
  #
{'fraction_non_alphanumeric': 0.15175184110689577, 'fraction_numerical': 0.005355947333184557, 'mean_word_length': 2.897391304347826, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 31, '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': '2399385', 'n_tokens_mistral': 1482, 'n_tokens_neox': 1433, 'n_words': 511}