class Jekyll::LanguagePlugin::Tags::LanguageTag

Public Class Methods

new(tag_name, markup, tokens) click to toggle source
Calls superclass method
# File lib/jekyll/language-plugin/tags/language.rb, line 8
def initialize(tag_name, markup, tokens)
  super
  @markup = markup
end

Public Instance Methods

render(context) click to toggle source
# File lib/jekyll/language-plugin/tags/language.rb, line 13
def render(context)
  p = Liquid::Parser.new(@markup)
  name = Liquid::Expression.parse(exp = p.expression)
  key = context.evaluate(name)
  raise Liquid::SyntaxError.new("Invalid language key expression: #{exp}") if key.nil?

  tokens = Array.new
  if p.consume?(:colon)
    loop do
      arg = Liquid::Expression.parse(exp = p.expression)
      token = context.evaluate(arg)
      raise Liquid::SyntaxError.new("Invalid parameter expression: #{exp}") if token.nil?
      tokens.push(token)
      break if !p.consume?(:comma)
    end
  end

   Jekyll::LanguagePlugin::LiquidContext.get_language_string(context, key, tokens)
end