lib/nanoc3/base/compiler_dsl.rb in nanoc3-3.1.9 vs lib/nanoc3/base/compiler_dsl.rb in nanoc3-3.2.0a1

- old
+ new

@@ -31,17 +31,17 @@ # # An item rep will be compiled by calling the given block and passing the # rep as a block argument. # # @param [String] identifier A pattern matching identifiers of items that - # should be compiled using this rule + # should be compiled using this rule # # @option params [Symbol] :rep (:default) The name of the representation - # that should be compiled using this rule + # that should be compiled using this rule # # @yield The block that will be executed when an item matching this - # compilation rule needs to be compiled + # compilation rule needs to be compiled # # @return [void] # # @example Compiling the default rep of the `/foo/` item # @@ -75,17 +75,17 @@ # # The path of an item rep will be determined by calling the given block # and passing the rep as a block argument. # # @param [String] identifier A pattern matching identifiers of items that - # should be routed using this rule + # should be routed using this rule # # @option params [Symbol] :rep (:default) The name of the representation - # that should be routed using this rule + # that should be routed using this rule # # @yield The block that will be executed when an item matching this - # compilation rule needs to be routed + # compilation rule needs to be routed # # @return [void] # # @example Routing the default rep of the `/foo/` item # @@ -101,30 +101,31 @@ def route(identifier, params={}, &block) # Require block raise ArgumentError.new("#route requires a block") unless block_given? # Get rep name - rep_name = params[:rep] || :default + rep_name = params[:rep] || :default + snapshot_name = params[:snapshot] || :last # Create rule - rule = Rule.new(identifier_to_regex(identifier), rep_name, block) + rule = Rule.new(identifier_to_regex(identifier), rep_name, block, :snapshot_name => snapshot_name) @site.compiler.item_routing_rules << rule end # Creates a layout rule for all layouts whose identifier match the given # identifier, which may either be a string containing the * wildcard, or a # regular expression. The layouts matching the identifier will be filtered # using the filter specified in the second argument. The params hash # contains filter arguments that will be passed to the filter. # # @param [String] identifier A pattern matching identifiers of layouts - # that should be filtered using this rule + # that should be filtered using this rule # # @param [Symbol] filter_name The name of the filter that should be run - # when processing the layout + # when processing the layout # # @param [Hash] params Extra filter arguments that should be passed to the - # filter when processing the layout (see {Nanoc3::Filter#run}) + # filter when processing the layout (see {Nanoc3::Filter#run}) # # @return [void] # # @example Specifying the filter to use for a layout #