Skip to content

Commit

Permalink
Fixed bug in script when reading external src
Browse files Browse the repository at this point in the history
  • Loading branch information
gaspard committed Jun 7, 2011
1 parent 677199b commit b10fd7f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/zena/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def rename_prop(list, old_key, new_key)
if list.first.kind_of?(Node)
list = list.map(&:visible_versions).flatten
end

list.each do |rec|
prop = rec.prop
value = prop.delete(old_key)
Expand All @@ -27,7 +28,7 @@ def rename_prop(list, old_key, new_key)
Zena::Db.execute "UPDATE #{rec.class.table_name} SET properties=#{Zena::Db.quote(rec.class.encode_properties(prop))} WHERE id=#{rec[:id]}"
end
end
true
"Renamed '#{old_key}' to '#{new_key}' in #{list.size} #{list.first.class.to_s.downcase.pluralize}"
end

def field_to_prop(list, native_key, prop_key)
Expand Down
2 changes: 1 addition & 1 deletion lib/zena/parser/zafu_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def r_rename_asset

src = @params[key]
if src && src[0..0] != '/' && src[0..6] != 'http://'
@params[key] = @options[:helper].send(:template_url_for_asset, :src => src, :base_path => @options[:base_path], :type => type)
@params[key] = @options[:helper].send(:template_url_for_asset, :src => src, :base_path => @options[:base_path], :type => type) || @params[key]
end

res = "<#{@html_tag}#{params_to_html(@params)}"
Expand Down
6 changes: 5 additions & 1 deletion test/integration/zafu_compiler/asset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ default:

rename_asset:
src: "<link href='/Default skin/style.css' rel='Stylesheet' type='text/css'/>"
tem: "<link href='/en/textdocument53.css?1144713600' rel='Stylesheet' type='text/css'/>"
tem: "<link href='/en/textdocument53.css?1144713600' rel='Stylesheet' type='text/css'/>"

should_not_change_script:
src: "<script type='text/javascript' src='http://example.com'></script>"
tem: "<script src='http://example.com' type='text/javascript'></script>"

0 comments on commit b10fd7f

Please sign in to comment.