Class Nanoc::Filters::RelativizePaths
In: lib/nanoc/filters/relativize_paths.rb
Parent: Nanoc::Filter

Methods

Included Modules

Nanoc::Helpers::LinkTo

Constants

SELECTORS = [ '*/@href', '*/@src', 'object/@data', 'param[@name="movie"]/@content', 'comment()' ]

Public Instance methods

Relativizes all paths in the given content, which can be HTML, XHTML, XML or CSS. This filter is quite useful if a site needs to be hosted in a subdirectory instead of a subdomain. In HTML, all `href` and `src` attributes will be relativized. In CSS, all `url()` references will be relativized.

@param [String] content The content to filter

@option params [Symbol] :type The type of content to filter; can be

  `:html`, `:xhtml`, `:xml` or `:css`.

@option params [Array] :select The XPath expressions that matches the

  nodes to modify. This param is useful only for the `:html`, `:xml` and
  `:xhtml` types.

@option params [Hash] :namespaces The pairs `prefix => uri` to define

  any namespace you want to use in the XPath expressions. This param
  is useful only for the `:xml` and `:xhtml` types.

@return [String] The filtered content

Protected Instance methods

[Validate]