Skip to content

Commit

Permalink
Merge pull request #433 from ehamiter/master
Browse files Browse the repository at this point in the history
Add '#' to constant NON_REWRITEABLE_URL
  • Loading branch information
cyberdelia committed Mar 8, 2015
2 parents e3dda64 + 52ff8f5 commit d0c073f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ or just made Pipeline more awesome.
* Denis V Seleznyov <code@xy2.ru>
* DJ Sharkey <dj@newscred.com>
* Edwin Lunando <edwinlunando@gmail.com>
* Eric Hamiter <ehamiter@gmail.com>
* Evan Myller <eMyller@7ws.co>
* Fabian Büchler <fabian.buechler@gmail.com>
* Feanil Patel <feanil@edx.org>
Expand Down
2 changes: 1 addition & 1 deletion pipeline/compressors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

URL_DETECTOR = r"""url\((['"]){0,1}\s*(.*?)["']{0,1}\)"""
URL_REPLACER = r"""url\(__EMBED__(.+?)(\?\d+)?\)"""
NON_REWRITABLE_URL = re.compile(r'^(http:|https:|data:|//)')
NON_REWRITABLE_URL = re.compile(r'^(#|http:|https:|data:|//)')

DEFAULT_TEMPLATE_FUNC = "template"
TEMPLATE_FUNC = r"""var template = function(str){var fn = new Function('obj', 'var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(\''+str.replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/<%=([\s\S]+?)%>/g,function(match,code){return "',"+code.replace(/\\'/g, "'")+",'";}).replace(/<%([\s\S]+?)%>/g,function(match,code){return "');"+code.replace(/\\'/g, "'").replace(/[\r\n\t]/g,' ')+"__p.push('";}).replace(/\r/g,'\\r').replace(/\n/g,'\\n').replace(/\t/g,'\\t')+"');}return __p.join('');");return fn;};"""
Expand Down
3 changes: 3 additions & 0 deletions tests/assets/css/urls.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@
.no-protocol-url {
background-image: url(//images/sprite-buttons.png);
}
.anchor-tag-url {
background-image: url(#image-gradient);
}
@font-face{src:url(../fonts/pipeline.eot);src:url(../fonts/pipeline.eot?#iefix) format('embedded-opentype'),url(../fonts/pipeline.woff) format('woff'),url(../fonts/pipeline.ttf) format('truetype');}
3 changes: 3 additions & 0 deletions tests/tests/test_compressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ def test_url_rewrite(self):
.no-protocol-url {
background-image: url(//images/sprite-buttons.png);
}
.anchor-tag-url {
background-image: url(#image-gradient);
}
@font-face{src:url(../pipeline/fonts/pipeline.eot);src:url(../pipeline/fonts/pipeline.eot?#iefix) format('embedded-opentype'),url(../pipeline/fonts/pipeline.woff) format('woff'),url(../pipeline/fonts/pipeline.ttf) format('truetype');}
""", output)

Expand Down

0 comments on commit d0c073f

Please sign in to comment.