From b829068bd5138c29a10815ad8d9b56543a17974d Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Wed, 2 Oct 2024 00:00:15 -0300 Subject: [PATCH] Update AnonymousFilter --- nanoc/lib/nanoc/extension/anonymous_filter.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nanoc/lib/nanoc/extension/anonymous_filter.rb b/nanoc/lib/nanoc/extension/anonymous_filter.rb index 3140b23..164c5ab 100644 --- a/nanoc/lib/nanoc/extension/anonymous_filter.rb +++ b/nanoc/lib/nanoc/extension/anonymous_filter.rb @@ -9,9 +9,8 @@ module Nanoc::Extension require "securerandom" ## # @example - # compile "/sitemap.xml.erb" do - # filter(:erb) - # filter Proc.new { _1.each_line.reject { |s| s.strip.empty? }.join } + # compile "/sitemap.xml" do + # filter proc { _1.chomp } # write("/sitemap.xml") # end # @param [Proc, Symbol] fn @@ -21,9 +20,9 @@ module Nanoc::Extension # @return [void] def filter(fn, options = {}) if Proc === fn - id = anonymous_id - Nanoc::Filter.define(id) { fn.call(_1, _2) } - super(id, options) + anonid = anonymous_id + Nanoc::Filter.define(anonid) { fn.call(_1, _2) } + super(anonid, options) else super(fn, options) end