Sha256: e4865785c500c80810cc978a9782e4661c25df5d8652af8cc02e1b4ead66ba1a

Contents?: true

Size: 801 Bytes

Versions: 8

Compression:

Stored size: 801 Bytes

Contents

require 'spiderfw/templates/template_blocks'

module Spider; module TemplateBlocks
    
    class TagIf < Block
        
        def compile(options={})
            init = ""
            cond = vars_to_scene(@el.attributes['sp:tag-if'])
            @el.remove_attribute('sp:tag-if')
            html = HTML.new(@el, @template)
            c = "if (#{cond})\n"
            c += "  $out <<  '#{html.get_start(options)}'\n"
            c += "end\n"
            c, init = html.compile_content(c, init, options)
            tag_end = html.get_end
            if (tag_end)
                c += "if (#{cond})\n"
                c += "  $out <<  '#{tag_end}'\n"
                c += "end\n"
            end
            return CompiledBlock.new(init, c)
        end
        
        
    end
    
    
end; end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spiderfw-0.5.7 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.6 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.5 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.4 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.3 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.2 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.1 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5 lib/spiderfw/templates/blocks/tag_if.rb