Module: Toto::PageHelpers

Includes:
ConfigHelpers
Included in:
Site, Site::Context
Defined in:
lib/toto.rb

Instance Method Summary collapse

Methods included from ConfigHelpers

#[], #[]=

Instance Method Details

#archives(filter = "") ⇒ Object



68
69
70
71
72
73
74
75
# File 'lib/toto.rb', line 68

def archives filter = ""
  entries = ! self.articles.empty??
    self.articles.select do |a|
      filter !~ /^\d{4}/ || a.path =~ /^\/#{filter}/
    end : []

  return Archives.new(entries, @config)
end

#articles(ext = ) ⇒ Object



81
82
83
84
85
# File 'lib/toto.rb', line 81

def articles ext = self[:ext]
  Dir["#{Paths[:articles]}/*.#{ext}"].map do |article|
      Article.new article, @config
  end
end

#import(file) ⇒ Object



91
92
93
94
# File 'lib/toto.rb', line 91

def import(file)
    file = "#{Paths[:templates]}/#{file}" unless file =~ /^#{Paths[:templates]}/
    ERB.new(File.read(file)).result(binding)
end

#rootObject



87
88
89
# File 'lib/toto.rb', line 87

def root
  self[:root]
end

#titleObject



77
78
79
# File 'lib/toto.rb', line 77

def title
  self[:title]
end