<commit_before>module Hamlit
  module Filters
    class Plain
      def compile(lines)
        ast = [:multi]
        lines.each_with_index do |line, index|
          ast << [:static, "\n"] if index > 0
          ast << [:haml, :text, line]
        end
        ast
      end
    end
  end
end<commit_msg>Follow haml's weird behavior<commit_after>module Hamlit
  module Filters
    class Plain
      def compile(lines)
        ast = [:multi]
        text = lines.join("\n")
        ast << [:haml, :text, text]
        ast << [:static, "\n"] if string_interpolated?(text)
        ast
      end

      private

      def string_interpolated?(text)
        text =~ /\#{[^\#{}]*}/
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.12375533428165007, 'fraction_numerical': 0.001422475106685633, 'mean_word_length': 1.816, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 4, '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': '6858292', 'n_tokens_mistral': 233, 'n_tokens_neox': 227, 'n_words': 63}