def route_reps
reps.each do |rep|
rules = rules_collection.routing_rules_for(rep)
raise Nanoc::Errors::NoMatchingRoutingRuleFound.new(rep) if rules[:last].nil?
rules.each_pair do |snapshot, 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
rep.raw_paths[snapshot] = @site.config[:output_dir] + basic_path
rep.paths[snapshot] = basic_path
@site.config[:index_filenames].each do |index_filename|
if rep.paths[snapshot][-index_filename.length..-1] == index_filename
rep.paths[snapshot] = rep.paths[snapshot][0..-index_filename.length-1]
break
end
end
end
end
end