<commit_before>module Hammer
  class EcoParser < Parser

    register_as_default_for_extensions 'eco'
    accepts :eco
    returns :js

    def parse(text)
      if !@original_text
        @original_text = text
        @text = text
        @text = Eco.compile(@text)
        raise "Parse called without @path!" unless @path
        name = File.basename(@path, '.*')
        @text = "if(undefined==window.JST){window.JST={};} window.JST[\"#{name}\"] = #{@text}"
      end
      @text
    end

    def to_format(format)
      if format == :js
        parse(@original_text)
      end
    end
  end
end<commit_msg>Eco parser<commit_after>module Hammer
  class EcoParser < Parser

    register_as_default_for_extensions 'eco'
    accepts :eco
    returns :js

    def parse(text)
      @original_text ||= text
      text = Eco.compile(text)
      raise "Parse called without path! Nothing to name the template." unless @path
      name = File.basename(@path, '.*')
      text = "if(undefined==window.JST){window.JST={};} window.JST[\"#{name}\"] = #{text}"
      text
    end

    def to_format(format)
      parse(@original_text) if format == :js
    end
  end
end
{'fraction_non_alphanumeric': 0.12683347713546161, 'fraction_numerical': 0.0, 'mean_word_length': 2.5692307692307694, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '890976', 'n_tokens_mistral': 381, 'n_tokens_neox': 372, 'n_words': 93}