Class: Stic::Page

Inherits:
File show all
Includes:
Layoutable, Metadata, Renderable
Defined in:
lib/stic/page.rb

Instance Attribute Summary

Attributes included from Readable

#name, #path, #source

Attributes included from SiteBase

#data, #site

Instance Method Summary collapse

Methods included from Layoutable

#layout, #layout_name, #render

Methods included from Metadata

#initialize, parse, parsers

Methods included from Renderable

#locals, #render, #render_content, #render_name, #renderer

Methods included from Readable

#content, #initialize, #read, #render, #source_path

Methods inherited from Blob

#mime_type, #relative_target_path, #relative_url, #target_path, #to_s, #write

Methods included from SiteBase

#initialize

Instance Method Details

#default_layoutObject



26
27
28
29
30
31
32
# File 'lib/stic/page.rb', line 26

def default_layout
  if target_extension == 'html'
    super
  else
    nil
  end
end

#target_extensionObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/stic/page.rb', line 14

def target_extension
  return data[:format] if data.key?(:format)
  case path.extensions.first
    when 'css', 'scss', 'sass', 'styl', 'less'
      'css'
    when 'js', 'coffeescript'
      'js'
    else
      'html'
  end
end

#url_templateObject



10
11
12
# File 'lib/stic/page.rb', line 10

def url_template
  path.replace_extensions(target_extension).as_absolute
end