Class: Liquid::Document

Inherits:
BlockBody show all
Defined in:
lib/liquid/document.rb

Constant Summary

Constants inherited from BlockBody

BlockBody::ContentOfVariable, BlockBody::FullToken, BlockBody::TAGSTART, BlockBody::VARSTART

Instance Attribute Summary

Attributes inherited from BlockBody

#nodelist

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BlockBody

#blank?, #initialize, #render, #render_token_with_profiling, #warnings

Constructor Details

This class inherits a constructor from Liquid::BlockBody

Class Method Details

.parse(tokens, options) ⇒ Object



3
4
5
6
7
# File 'lib/liquid/document.rb', line 3

def self.parse(tokens, options)
  doc = new
  doc.parse(tokens, options)
  doc
end

Instance Method Details

#parse(tokens, options) ⇒ Object



9
10
11
12
13
# File 'lib/liquid/document.rb', line 9

def parse(tokens, options)
  super do |end_tag_name, end_tag_params|
    unknown_tag(end_tag_name, options) if end_tag_name
  end
end

#unknown_tag(tag, options) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/liquid/document.rb', line 15

def unknown_tag(tag, options)
  case tag
  when 'else'.freeze, 'end'.freeze
    raise SyntaxError.new(options[:locale].t("errors.syntax.unexpected_outer_tag".freeze, :tag => tag))
  else
    raise SyntaxError.new(options[:locale].t("errors.syntax.unknown_tag".freeze, :tag => tag))
  end
end