Skip Menu |

This queue is for tickets about the CSS CPAN distribution.

Report information
The Basics
Id: 71933
Status: open
Priority: 0/
Queue: CSS

People
Owner: Nobody in particular
Requestors: SPACEBAT [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.09
Fixed in: (no value)



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]}
BTW thanks for this very useful module!
I was mistaken sorry, this is not the bug that I thought. Will post a new bug with a patch when I've figured it out.
you may have better luck with the 2.x trunk here: https://github.com/iamcal/perl-CSS it's a work-in-progress, but it adheres more closely to the published grammars
Subject: Re: [rt.cpan.org #71933] Relative paths in url strings fail to parse
Date: Thu, 27 Oct 2011 15:58:58 +1030
To: bug-CSS [...] rt.cpan.org
From: Andrew Kirkpatrick <ubermonk [...] gmail.com>
Hey thanks for the link, I'm stuck for some time on an old perl and can't get most CSS modules to run. CSS and CSS::Simple do though. I'm looking for something that will let me pull out an AST or DOM of sorts and walk it, removing styles with no properties, expanding imports and so on prior to minification. I've looked at subclassing CSS and CSS::Style so they'd carry the path to the file that the style came from, but it looks like it would get pretty dependent on the superclass' internals. I see that there is now a sheets property in 2.x, perhaps that's something along these lines. I'll fork it sometime soon and have a play. Cheers. Andy (spacebat) On 26 October 2011 12:09, Cal Henderson via RT <bug-CSS@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=71933 > > > you may have better luck with the 2.x trunk here: > https://github.com/iamcal/perl-CSS > > it's a work-in-progress, but it adheres more closely to the published > grammars >