lib/spiderfw/templates/blocks/attr_if.rb in spiderfw-0.5.13 vs lib/spiderfw/templates/blocks/attr_if.rb in spiderfw-0.5.14
- old
+ new
@@ -14,21 +14,21 @@
def compile(options={})
init = ""
attr_if = @el.get_attribute('sp:attr-if')
@el.remove_attribute('sp:attr-if')
- @el.set_attribute("tmp-attr-if", attr_if)
+ @el.set_attribute("tmp-attr-if", '---')
compiled = Spider::TemplateBlocks.parse_element(@el, @allowed_blocks, @template).compile(options)
c, init = compiled.run_code, compiled.init_code
cond, name, val = attr_if.split(',')
if val && val.strip[0].chr == '@'
val = "'+#{var_to_scene(val)}+'"
end
cond = vars_to_scene(cond)
full_attr = val ? "#{name}=\"#{val}\"" : "#{name}"
replace = "'+"+"( (#{cond}) ? '#{full_attr}' : '' )"+"+'"
# debug("ATTR IF REPLACe")
- c.sub!('tmp-attr-if="'+attr_if+'"', replace)
+ c.sub!('tmp-attr-if="---"', replace)
return CompiledBlock.new(init, c)
end
end
\ No newline at end of file