Django Static Precompiler provides template tags and filters to compile CoffeeScript, LiveScript, SASS / SCSS, LESS, Stylus, Babel and Handlebars. It works with both inline code and external files.
Other
222
stars
60
forks
source link
fix url_converter.py using greedy regex to find URLs #139
Note the stray double-quote character in media(min-width: 768px").
This happens because the repetition quantifier in the regex used is greedy, and runs all the way up until the very last ')' in the file. The solution is to use a lazy quantifier, which runs to the first ')' that it sees.
Note that this is an incomplete fix - regex is not suitable for parsing CSS, and this regex cannot parse things like:
url("file_\"with\"quotes_in_name.png") or
url("file (Copy).png")
The url_converters uses a greedy regex to find URLs, and can cause incorrect output. Here is a simple test case:
Note the stray double-quote character in
media(min-width: 768px")
.This happens because the repetition quantifier in the regex used is greedy, and runs all the way up until the very last ')' in the file. The solution is to use a lazy quantifier, which runs to the first ')' that it sees.
Note that this is an incomplete fix - regex is not suitable for parsing CSS, and this regex cannot parse things like:
url("file_\"with\"quotes_in_name.png")
orurl("file (Copy).png")
For that, a real parser would be needed.