Merge pull request #1657 from mojavelinux/issue-1656

resolves #1656 don't mangle URL inside tag
This commit is contained in:
Thomas Reynolds 2015-10-26 14:52:30 -07:00
commit ec99a7b28f
3 changed files with 5 additions and 1 deletions

View file

@ -11,6 +11,7 @@ Feature: Alternate between multiple asset hosts
Then I should see 'src="https://code.jquery.com/jquery-2.1.3.min.js"' Then I should see 'src="https://code.jquery.com/jquery-2.1.3.min.js"'
Then I should see content matching %r{http://assets1.example.com/} Then I should see content matching %r{http://assets1.example.com/}
Then I should not see content matching %r{http://assets1.example.com//} Then I should not see content matching %r{http://assets1.example.com//}
Then I should see content matching %r{<a href="https://github.com/angular/angular.js">Angular.js</a>}
Then I should see content matching %r{'//www.example.com/script.js'} Then I should see content matching %r{'//www.example.com/script.js'}
When I go to "/stylesheets/asset_host.css" When I go to "/stylesheets/asset_host.css"
Then I should see content matching %r{http://assets1.example.com/} Then I should see content matching %r{http://assets1.example.com/}
@ -29,6 +30,7 @@ Feature: Alternate between multiple asset hosts
Then I should see 'src="https://code.jquery.com/jquery-2.1.3.min.js"' Then I should see 'src="https://code.jquery.com/jquery-2.1.3.min.js"'
Then I should see content matching %r{http://assets1.example.com/} Then I should see content matching %r{http://assets1.example.com/}
Then I should not see content matching %r{http://assets1.example.com//} Then I should not see content matching %r{http://assets1.example.com//}
Then I should see content matching %r{<a href="https://github.com/angular/angular.js">Angular.js</a>}
Then I should see content matching %r{'//www.example.com/script.js'} Then I should see content matching %r{'//www.example.com/script.js'}
When I go to "/stylesheets/asset_host.css" When I go to "/stylesheets/asset_host.css"
Then I should see content matching %r{http://assets1.example.com/} Then I should see content matching %r{http://assets1.example.com/}

View file

@ -41,4 +41,6 @@
<%= image_tag "blank1033.gif" %> <%= image_tag "blank1033.gif" %>
<%= image_tag "blank1034.gif" %> <%= image_tag "blank1034.gif" %>
<a href="https://github.com/angular/angular.js">Angular.js</a>
<script>(function(a,b,c,d){})(window,document,'script','//www.example.com/script.js');</script> <script>(function(a,b,c,d){})(window,document,'script','//www.example.com/script.js');</script>

View file

@ -328,7 +328,7 @@ module Middleman
Contract String, String, ArrayOf[String], Proc => String Contract String, String, ArrayOf[String], Proc => String
def rewrite_paths(body, _path, exts, &_block) def rewrite_paths(body, _path, exts, &_block)
body.dup.gsub(/([=\'\"\(,]\s*)([^\s\'\"\)]+(#{Regexp.union(exts)}))/) do |match| body.dup.gsub(/([=\'\"\(,]\s*)([^\s\'\"\)>]+(#{Regexp.union(exts)}))/) do |match|
opening_character = $1 opening_character = $1
asset_path = $2 asset_path = $2