Sha256: 0aefe7593cf01818f79d3295b580433d3fc3671abb546d8a15bedc460db1134f

Contents?: true

Size: 784 Bytes

Versions: 11

Compression:

Stored size: 784 Bytes

Contents

require 'spiderfw/templates/template_blocks'

module Spider; module TemplateBlocks
    
    class TagIf < Block
        
        def compile(options={})
            init = ""
            cond = vars_to_scene(@el.get_attribute('sp:tag-if'))
            @el.remove_attribute('sp:tag-if')
            html = HTML.new(@el, @template)
            c = "if (#{cond})\n"
            c += html.get_start(options)
            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

11 entries across 11 versions & 1 rubygems

Version Path
spiderfw-0.5.19 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.18 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.17 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.16 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.15 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.14 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.13 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.12 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.11 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.10 lib/spiderfw/templates/blocks/tag_if.rb
spiderfw-0.5.9 lib/spiderfw/templates/blocks/tag_if.rb