Skip to content

Commit

Permalink
"style" tags should be rendered like any html tag (no asset renaming …
Browse files Browse the repository at this point in the history
…here).
  • Loading branch information
gaspard committed Jun 30, 2012
1 parent 0e0b661 commit 51fc0d0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 28 deletions.
16 changes: 0 additions & 16 deletions lib/zafu/parsing_rules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,6 @@ def scan_tag(opts={})
opts.merge!(:text=>'') if is_end_tag
opts.merge!(:method => 'rename_asset', :html_tag_params => params, :params => params, :html_tag => html_tag)
make(:asset, opts)
elsif html_tag == 'style'
opts.merge!(:params => params, :html_tag => html_tag)
make(:style, opts)
else
#puts "PLAIN:<#{html_tag}#{raw}#{is_end_tag ? '/' : ''}>"
# plain html tag
Expand Down Expand Up @@ -347,19 +344,6 @@ def scan_inside_asset
end
end

def scan_style
if @text =~ /\A(.*?)<\/style>/m
flush $&
@method = 'rename_asset'
@markup.tag = 'style'
leave(:style)
else
# error
@method = 'void'
flush
end
end

# Helper during compilation to make a block
def add_block(text_or_opts, at_start = false)
# avoid wrapping objects in [void][/void]
Expand Down
1 change: 0 additions & 1 deletion lib/zafu/process/html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def r_rename_asset
type = :link
end
when 'style'
@markup.done = true
return expand_with.gsub(/url\(('|")(.*?)\1\)/) do
if $2[0..6] == 'http://'
$&
Expand Down
12 changes: 11 additions & 1 deletion test/integration/zafu_compiler/asset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,14 @@ rename_asset:

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

change_style_url:
src: |
<style>
#super { background:url('<r:image in='site' do='path' format='data'/>');}
</style>
res: |
<style>
#super { background:url('/oo/image40.jpg?1144713600');}
</style>
10 changes: 0 additions & 10 deletions test/unit/zena/parser/zafu_asset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,3 @@ change_script_src:
<script src='/test_script/functions.js' type='text/javascript'>
var = 'hello world!'
</script>
change_style_url:
src: |
<style>
#super { background:url('images/logo.png');}
</style>
res: |
<style>
#super { background:url('/test_/images/logo.png');}
</style>

0 comments on commit 51fc0d0

Please sign in to comment.