# File lib/nanoc/base/compilation/compiler.rb, line 230
    def route_reps
      reps.each do |rep|
        # Find matching rules
        rules = rules_collection.routing_rules_for(rep)
        raise Nanoc::Errors::NoMatchingRoutingRuleFound.new(rep) if rules[:last].nil?

        rules.each_pair do |snapshot, rule|
          # Get basic path by applying matching rule
          basic_path = rule.apply_to(rep, :compiler => self)
          next if basic_path.nil?
          if basic_path !~ %r{^/}
            raise RuntimeError, "The path returned for the #{rep.inspect} item representation, “#{basic_path}”, does not start with a slash. Please ensure that all routing rules return a path that starts with a slash."
          end

          # Get raw path by prepending output directory
          rep.raw_paths[snapshot] = @site.config[:output_dir] + basic_path

          # Get normal path by stripping index filename
          rep.paths[snapshot] = basic_path
          @site.config[:index_filenames].each do |index_filename|
            if rep.paths[snapshot][-index_filename.length..-1] == index_filename
              # Strip and stop
              rep.paths[snapshot] = rep.paths[snapshot][0..-index_filename.length-1]
              break
            end
          end
        end
      end
    end