class Octopress::Tags::PullQuote::Tag

Public Class Methods

new(tag_name, markup, tokens) click to toggle source
Calls superclass method
# File lib/octopress-pullquote-tag.rb, line 9
def initialize(tag_name, markup, tokens)
  @markup = markup
  super
end

Public Instance Methods

render(context) click to toggle source
Calls superclass method
# File lib/octopress-pullquote-tag.rb, line 14
def render(context)
  output = super
  quotemarks = /\{"\s*(.+?)\s*"\}/m
  if output =~ quotemarks

    output.gsub!(quotemarks, '\1')

    quote = RubyPants.new($1).to_html

    alignment = @markup.scan(/(left|right|center)/i).first || 'right'
    classnames = @markup.sub(/left|right|center/i, '').strip

    output = "<span class='pullquote-#{alignment} #{classnames}' data-pullquote='#{quote}'></span>#{output}"

    Utils.parse_content(output, context)
  else
    raise "PullQuote Error: Surround your pullquote like this {\" text to be quoted \"}"
  end
end