<commit_before>module Precious
  module Views
    class Compare < Layout
      attr_reader :page, :diff, :versions

      def title
        "Comparison of #{@page.title}"
      end

      def path
        @page.path
      end

      def before
        @versions[0][0..6]
      end

      def after
        @versions[1][0..6]
      end

      def lines
        lines = []
        @diff.diff.split("\n")[2..-1].each_with_index do |line, line_index|
          lines << { :line => line,
                     :class => line_class(line),
                     :ldln => left_diff_line_number(0, line),
                     :rdln => right_diff_line_number(0, line) }
        end
        lines
      end<commit_msg>fix compare view if there is no diff between 2 versions<commit_after>module Precious
  module Views
    class Compare < Layout
      attr_reader :page, :diff, :versions

      def title
        "Comparison of #{@page.title}"
      end

      def path
        @page.path
      end

      def before
        @versions[0][0..6]
      end

      def after
        @versions[1][0..6]
      end

      def lines
        lines = []
        @diff.diff.split("\n")[2..-1].each_with_index do |line, line_index|
          lines << { :line => line,
                     :class => line_class(line),
                     :ldln => left_diff_line_number(0, line),
                     :rdln => right_diff_line_number(0, line) }
        end if @diff
        lines
      end
{'fraction_non_alphanumeric': 0.10882956878850103, 'fraction_numerical': 0.014373716632443531, 'mean_word_length': 1.4991452991452991, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '1670771', 'n_tokens_mistral': 449, 'n_tokens_neox': 427, 'n_words': 111}