public
Description: Liquid markup language. Save, customer facing template language for flexible web apps.
Homepage: http://www.liquidmarkup.org
Clone URL: git://github.com/tobi/liquid.git
Click here to lend your support to: liquid and make a donation at www.pledgie.com !
liquid / lib / liquid / tags / ifchanged.rb
100644 20 lines (16 sloc) 0.418 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Liquid
  class Ifchanged < Block
            
    def render(context)
      context.stack do
        
        output = render_all(@nodelist, context)
        
        if output != context.registers[:ifchanged]
          context.registers[:ifchanged] = output
          output
        else
          ''
        end
      end
    end
  end
  
  Template.register_tag('ifchanged', Ifchanged)
end