Class: Yuzu::Filters::CurrentpathFilter

Inherits:
Filter show all
Includes:
Helpers
Defined in:
lib/yuzu/filters/currentpath.rb

Instance Attribute Summary

Attributes inherited from Filter

#directive, #name

Instance Method Summary collapse

Methods inherited from Filter

#default, filters, #get_match, #match, #process, registry, #value

Constructor Details

#initializeCurrentpathFilter

Returns a new instance of CurrentpathFilter.



8
9
10
11
# File 'lib/yuzu/filters/currentpath.rb', line 8

def initialize
  @name = :currentpath
  @directive = "CURRENTPATH"
end

Instance Method Details

#filter_typeObject



13
14
15
16
17
# File 'lib/yuzu/filters/currentpath.rb', line 13

def filter_type
  # Filter the LINKROOT in IMAGES and other path-dependent tags first, so they have the proper
  # paths to search for. Then process LINKROOT afterwards.
  [:prefilter, :postfilter]
end

#get_value(website_file) ⇒ Object



23
24
25
26
27
# File 'lib/yuzu/filters/currentpath.rb', line 23

def get_value(website_file)
  linkroot = website_file.config.linkroot
  pathname = website_file.path.dirname
  Url.new(pathname, prefix=linkroot)
end

#regexObject



19
20
21
# File 'lib/yuzu/filters/currentpath.rb', line 19

def regex
  /CURRENTPATH/
end

#replacement(website_file, processing_contents = nil) ⇒ Object



29
30
31
# File 'lib/yuzu/filters/currentpath.rb', line 29

def replacement(website_file, processing_contents=nil)
  get_value(website_file)
end