class Lurker::BasePresenter

Attributes

options[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/lurker/presenters/base_presenter.rb, line 8
def initialize(options = {})
  @options = options
end

Public Instance Methods

asset_path(asset) click to toggle source
# File lib/lurker/presenters/base_presenter.rb, line 24
def asset_path(asset)
  "#{html_directory}/#{assets[asset] || asset}"
end
assets() click to toggle source
# File lib/lurker/presenters/base_presenter.rb, line 20
def assets
  options[:assets] || {}
end
html_directory() click to toggle source
# File lib/lurker/presenters/base_presenter.rb, line 12
def html_directory
  options[:url_base_path] || options[:html_directory] || ""
end
index_path(subdirectory = "") click to toggle source
# File lib/lurker/presenters/base_presenter.rb, line 28
def index_path(subdirectory = "")
  html_path = File.join(html_directory, subdirectory)
  if options[:static_html]
    File.join(html_path, 'index.html')
  else
    html_path
  end
end
markup(content) click to toggle source
# File lib/lurker/presenters/base_presenter.rb, line 48
def markup(content)
  return unless content
  Lurker.safe_require 'kramdown'
  defined?(Kramdown) ? Kramdown::Document.new(content).to_html : content
end
tag_with_anchor(tag, content, anchor_slug = nil) click to toggle source
# File lib/lurker/presenters/base_presenter.rb, line 37
  def tag_with_anchor(tag, content, anchor_slug = nil)
    anchor_slug ||= content.downcase.gsub(' ', '_')
    <<-EOS
    <#{tag} id="#{anchor_slug}">
      <a href="##{anchor_slug}" class="anchor">
        #{content}
      </a>
    </#{tag}>
    EOS
  end
url_base_path() click to toggle source
# File lib/lurker/presenters/base_presenter.rb, line 16
def url_base_path
  options[:url_base_path] || '/'
end