Subject: | Relative paths in url strings fail to parse |
We've got a bunch of CSS files with URLs that are relative, up a
directory and down into an images directory for instance. They fail to
parse because the dots "." are not present in the rules macro_string1,
macro_string2 or URI itself. Adding "\\." to the respective regexes
fixed it for us. See attached.
Subject: | CSS-Parse-PRDGrammar.pm.diff |
--- CSS/Parse/PRDGrammar.pm 2011-03-23 09:30:09.000000000 +1030
+++ /apps/webteam/lib/perl/CSS/Parse/PRDGrammar.pm 2011-10-26 11:18:16.000000000 +1030
@@ -72,7 +72,7 @@
DIMENSION: macro_num macro_ident {$return = $item[1].$item[2]}
URI: 'url(' macro_w macro_string macro_w ')' {$return = "url(".$item[3].")"}
| 'url(' macro_w (
- /[\!#$%&*-~]/ {$return = $item[1]}
+ /[\\.\!#$%&*-~]/ {$return = $item[1]}
| macro_nonascii {$return = $item[1]}
| macro_escape {$return = $item[1]}
)(s?) macro_w ')' {$return = "url(".join('',@{$item[3]}).")"}
@@ -103,14 +103,14 @@
macro_string: macro_string1 {$return = $item[1]}
| macro_string2 {$return = $item[1]}
macro_string1: '"' (
- /[\\t \!#$%&(-~]/ {$return = $item[1]}
+ /[\\.\\t \!#$%&(-~]/ {$return = $item[1]}
| '\\\\' macro_nl {$return = ''}
| "'" {$return = $item[1]}
| macro_nonascii {$return = $item[1]}
| macro_escape {$return = $item[1]}
)(s?) '"' {$return = '"'.join('', @{$item[2]}).'"'}
macro_string2: "'" (
- /[\\t \!#$%&(-~]/ {$return = $item[1]}
+ /[\\.\\t \!#$%&(-~]/ {$return = $item[1]}
| '\\\\' macro_nl {$return = ''}
| '"' {$return = $item[1]}
| macro_nonascii {$return = $item[1]}