Class: Locomotive::Liquid::Tags::Hybrid

Inherits:
Liquid::Block
  • Object
show all
Defined in:
lib/locomotive/liquid/tags/hybrid.rb

Direct Known Subclasses

LinkTo

Instance Method Summary collapse

Instance Method Details

#parse(tokens) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/locomotive/liquid/tags/hybrid.rb', line 5

def parse(tokens)
  nesting = 0
  tokens.each do |token|
    next unless token =~ IsTag
    if token =~ FullToken
      if nesting == 0 && $1 == block_delimiter
        @render_as_block = true
        super
        return
      elsif $1 == block_name
        nesting += 1
      elsif $1 == block_delimiter
        nesting -= 1
      end
    end
  end
end