<commit_before>require 'sprockets'
require 'barber'
require 'ember/handlebars/template'
require 'ember/emblem/rails' if defined?(Rails)

module Ember
  module Emblem
    autoload :VERSION, 'ember/emblem/version'
    autoload :Config, 'ember/emblem/config'
    autoload :Precompiler, 'ember/emblem/precompiler'

    class Template < Ember::Handlebars::Template
      def self.setup(env)
        env.register_engine '.emblem', self
      end

      def evaluate(scope, locals, &block)
        template = data

        if config.precompile
          template = precompile_ember_emblem(template, config.ember_template)
        else
          template = compile_ember_emblem(template, config.ember_template)
        end

        target = global_template_target(scope.logical_path, config)
        "#{target} = #{template}\n"
      end

      private

      def global_template_target(module_name, config)
        "Ember.TEMPLATES[#{template_path(module_name, config).inspect}]"
      end

      def template_path(path, config)
        root = config.templates_root

        if root.kind_of? Array
          root.each do |r|
            path.sub!(/#{Regexp.quote(r)}\//, '')
          end
        else
          unless root.empty?
            path.sub!(/#{Regexp.quote(root)}\/?/, '')
          end
        end

        path = path.split('/')

        path.join(config.templates_path_separator)
      end

      def compile_ember_emblem(string, ember_template = 'handlebars')
        handlebars = Precompiler.compile(string)
        "Ember.#{ember_template}.compile(#{indent(handlebars).inspect});"
      end

      def precompile_ember_emblem(string, ember_template = 'handlebars')
        handlebars = Precompiler.compile(string)
        "Ember.#{ember_template}.template(#{Barber::Ember::Precompiler.compile(handlebars)});"
      end
    end
  end
end
<commit_msg>make sure we're using our config, not the one we're inheriting from.<commit_after>require 'sprockets'
require 'barber'
require 'ember/handlebars/template'
require 'ember/emblem/rails' if defined?(Rails)

module Ember
  module Emblem
    autoload :VERSION, 'ember/emblem/version'
    autoload :Config, 'ember/emblem/config'
    autoload :Precompiler, 'ember/emblem/precompiler'

    class Template < Ember::Handlebars::Template
      def self.setup(env)
        env.register_engine '.emblem', self
      end

      def evaluate(scope, locals, &block)
        template = data

        if config.precompile
          template = precompile_ember_emblem(template, config.ember_template)
        else
          template = compile_ember_emblem(template, config.ember_template)
        end

        target = global_template_target(scope.logical_path, config)
        "#{target} = #{template}\n"
      end

      private

      def global_template_target(module_name, config)
        "Ember.TEMPLATES[#{template_path(module_name, config).inspect}]"
      end

      def template_path(path, config)
        root = config.templates_root

        if root.kind_of? Array
          root.each do |r|
            path.sub!(/#{Regexp.quote(r)}\//, '')
          end
        else
          unless root.empty?
            path.sub!(/#{Regexp.quote(root)}\/?/, '')
          end
        end

        path = path.split('/')

        path.join(config.templates_path_separator)
      end

      def compile_ember_emblem(string, ember_template = 'handlebars')
        handlebars = Precompiler.compile(string)
        "Ember.#{ember_template}.compile(#{indent(handlebars).inspect});"
      end

      def precompile_ember_emblem(string, ember_template = 'handlebars')
        handlebars = Precompiler.compile(string)
        "Ember.#{ember_template}.template(#{Barber::Ember::Precompiler.compile(handlebars)});"
      end

      def config
        @config ||= Config.new
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.11189358372456965, 'fraction_numerical': 0.0, 'mean_word_length': 2.628192999053926, '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': '1180720', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1135, 'n_words': 222}