class Octopress::Tags::Capture::Tag

Constants

SYNTAX

Public Class Methods

new(tag_name, markup, tokens) click to toggle source
Calls superclass method
# File lib/octopress-capture-tag.rb, line 11
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-capture-tag.rb, line 16
def render(context)
  return unless markup = TagHelpers::Conditional.parse(@markup, context)
  if markup =~ TagHelpers::Var::HAS_FILTERS
    markup = $1
    filters = $2
  end

  if markup =~ SYNTAX
    var      = $1
    operator = $2
    value = super.lstrip

    unless value.nil? || filters.nil?
      value = TagHelpers::Var.render_filters(value, filters, context)
    end

    context = TagHelpers::Var.set_var(var, operator, value, context)
  else
    raise SyntaxError.new("Syntax Error in 'capture' - Valid syntax: capture [var]")
  end
  ''
end