module Staticpress::Content::StaticContent

Public Class Methods

supported_extensions() click to toggle source
# File lib/staticpress/content/static_content.rb, line 26
def self.supported_extensions
  Tilt.mappings.keys.reject { |mapping| mapping == '' }.map &:to_sym
end

Public Instance Methods

layout() click to toggle source

layout not needed for binary files

Calls superclass method
# File lib/staticpress/content/static_content.rb, line 6
def layout
  static? ? nil : super
end
parse_slug(path, base_path) click to toggle source
# File lib/staticpress/content/static_content.rb, line 10
def parse_slug(path, base_path)
  path_string = path.to_s

  clean = lambda { |str| str.sub(base_path.to_s, '').sub(/^\//, '') }

  if Staticpress::Content::StaticContent.supported_extensions.any? { |ext| path_string.end_with? ext.to_s }
    [ clean.call(extensionless_path(path).to_s), path.extname.sub(/^\./, '').to_sym ]
  else
    [ clean.call(path_string), nil ]
  end
end
render_partial(locals = {}) click to toggle source
Calls superclass method
# File lib/staticpress/content/static_content.rb, line 22
def render_partial(locals = {})
  static? ? template_path_content : super
end