def add_filter(name, loc)
      unless name.is_a? Symbol
        raise ArgumentError,
              "Invalid filter name #{name.inspect} (must be a symbol)"
      end

      case loc
        when :first
          @filter_chain.unshift(name)
        when :last
          @filter_chain.push(name)
        when Hash
          if loc.length != 1
            raise ArgumentError,
                  "Invalid location specifier"
          end
          if ([:before, :after] && loc.keys).empty?
            raise ArgumentError,
                  "Invalid location specifier"
          end

          next_to  = loc.values.first
          relative = loc.keys.first

          i = @filter_chain.index(next_to)
          if i.nil?
            raise ArgumentError,
                  "Unknown filter #{next_to.inspect}"
          end

          i += 1 if relative == :after
          @filter_chain.insert(i, name)
        else
          raise ArgumentError,
                "Invalid location specifier"
      end
    end
def add_filter(name, loc)
      unless name.is_a? Symbol
        raise ArgumentError,
              "Invalid filter name #{name.inspect} (must be a symbol)"
      end

      case loc
        when :first
          @filter_chain.unshift(name)
        when :last
          @filter_chain.push(name)
        when Hash
          if loc.length != 1
            raise ArgumentError,
                  "Invalid location specifier"
          end
          if ([:before, :after] && loc.keys).empty?
            raise ArgumentError,
                  "Invalid location specifier"
          end

          next_to  = loc.values.first
          relative = loc.keys.first

          i = @filter_chain.index(next_to)
          if i.nil?
            raise ArgumentError,
                  "Unknown filter #{next_to.inspect}"
          end

          i += 1 if relative == :after
          @filter_chain.insert(i, name)
        else
          raise ArgumentError,
                "Invalid location specifier"
      end
    end
Public: Add an additional link to the filter chain.

 name - A symbol which represents the name of a class under the
        Gollum::Render namespace to insert into the chain.

 loc  - A "location specifier" -- that is, where to put the new
        filter in the chain.  This can be one of `:first`, `:last`,
        `:before => :SomeElement`, or `:after => :SomeElement`, where
        `:SomeElement` (if specified) is a symbol already in the
        filter chain.  A `:before` or `:after` which references a
        filter that doesn't exist will cause `ArgumentError` to be
        raised.

 Returns nothing.