module Octopress::Linkblog

Constants

DEFAULT_OPTIONS
VERSION

Public Class Methods

config(options={}) click to toggle source
# File lib/octopress-linkblog/configuration.rb, line 23
def self.config(options={})
  @config ||= Jekyll::Utils.deep_merge_hashes(DEFAULT_OPTIONS, options)
  @config['linkblog']
end
post_link(title, url, classnames) click to toggle source
# File lib/octopress-linkblog.rb, line 96
def self.post_link(title, url, classnames)
  "<a href='#{url}' class='#{classnames}'>#{title}</a>"
end
post_title_html(title, config) click to toggle source
# File lib/octopress-linkblog.rb, line 73
def self.post_title_html(title, config)
  title = unorphan(title)

  return title if !config['marker']

  marker = "<span class='post-marker post-marker-#{config['marker_position']}'>#{config['marker']}</span>"
  position = config['marker_position']

  if config['marker_position'] == 'before'
    title = "#{marker}&nbsp;#{title}"
  else
    title = "#{title}&nbsp;#{marker}"
  end

  title
end
post_title_link(data) click to toggle source
# File lib/octopress-linkblog.rb, line 90
def self.post_title_link(data)
  classname = "article-link"
  classname << " linkpost" if data['linkpost']
  post_link(data['title_html'], data['title_url'], classname)
end
post_title_text(title, config) click to toggle source
# File lib/octopress-linkblog.rb, line 100
def self.post_title_text(title, config)
  return title if !config['marker']
  position = config['marker_position']

  if config['marker_position'] == 'before'
    "#{config['marker']} #{title}"
  else
    "#{title} #{config['marker']}"
  end
end
unorphan(title) click to toggle source
# File lib/octopress-linkblog.rb, line 65
def self.unorphan(title)
  if Linkblog.config['unorphan']
    title.sub(/\s+(\S+)\s*$/, '&nbsp;\1')
  else
    title
  end
end