Update of /cvsroot/perl-css/CSS-SAC
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12696
Modified Files:
Changes SAC.pm
Log Message:
merge with CPAN 0.05
Index: Changes
===================================================================
RCS file: /cvsroot/perl-css/CSS-SAC/Changes,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Changes 17 Aug 2001 19:55:25 -0000 1.4
+++ Changes 19 Sep 2004 19:13:20 -0000 1.5
@@ -1,6 +1,16 @@
Revision history for Perl extension CSS::SAC.
-0.04 Ddd Mmm dd hh:mm:ss yyyy (in progress)
+0.06 ...
+ - ...
+
+0.05 2003-07-07 19:56
+ - changed some code (it's not really a bugfix, it changes from a
+ bug to a less likely one -- a real fix will come later) thanks
+ to a report and patch from Briac Pilpré.
+ - fixed a bug to parse attr(color, color) correctly, thanks to
+ Bjoern Hoehrmann.
+
+0.04 Sat Jul 06 16:13 2001
- fixed a bug in Text::Balanced that caused blocks to be
incorrectly extracted when they contained backslashed followed by
a newline. As a result Text::Balanced 1.84 is now required.
@@ -16,7 +26,6 @@
- added _ to the IDENT characters (it's in CSS2 Errata)
- fixed @page parsing (patch by SG)
-
0.03 Mon Apr 23 16:44:16 2001
- switched all to Class::ArrayObjects (which used to be CSS::SAC::Helpers::ArrayObjects)
- provide both standard and perlified names for methods
Index: SAC.pm
===================================================================
RCS file: /cvsroot/perl-css/CSS-SAC/SAC.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- SAC.pm 11 Aug 2003 02:55:43 -0000 1.11
+++ SAC.pm 19 Sep 2004 19:13:20 -0000 1.12
@@ -20,7 +20,7 @@
%DIM_MAP
%FUNC_MAP
);
-$VERSION = '0.03_90';
+$VERSION = '0.06';
use CSS::SAC::ConditionFactory qw();
use CSS::SAC::SelectorFactory qw();
@@ -438,7 +438,18 @@
# parse the rule
my $rule;
warn "[SAC] parsing rule\n" if DEBUG;
- ($rule,$css,undef) = Text::Balanced::extract_bracketed($css,q/{}'"/,qr/\s*/); #"
+
+ ### BUG
+ # The Text::Balanced extractions below are not correct since they don't take
+ # comments into account. With the first one, it'll fail on apostrophes in
+ # comments, with the latter, on unbalanced apos and } in comments and
+ # apos-strings. The latter is used currently because it is less likely to fail,
+ # but what is needed is a real parser that steps inside the black parsing out
+ # comments and property values. The good news is that we have most of the bits
+ # to do that right already.
+
+ #($rule,$css,undef) = Text::Balanced::extract_bracketed($css,q/{}'"/,qr/\s*/); #"
+ ($rule,$css,undef) = Text::Balanced::extract_bracketed($css,q/{}"/,qr/\s*/); #"
$sac->parse_rule(\$rule);
# end of the rule
@@ -1192,6 +1203,7 @@
sub parse_property_value {
my $sac = shift;
my $css = shift;
+ my $att = shift || 0;
$$css =~ s/^\s*//;
@@ -1203,7 +1215,7 @@
$sac->parse_comments($css);
# exit conditions
- if (! length($$css) or $$css =~ m/^\s*(?:;|!)/) {
+ if (! length($$css) or $$css =~ m/^\s*(?:;|!)/ or ($att and $$css =~ s/^\s*(?:\))//)) {
last;
}
@@ -1275,18 +1287,21 @@
}
# functions
- elsif (
- ($value,$$css,$text) = Text::Balanced::extract_bracketed($$css,q/()'"/,qr/$RE_IDENT/)
- and
- length $text
- ) {
+# elsif (
+# ($value,$$css,$text) = Text::Balanced::extract_bracketed($$css,q/()'"/,qr/$RE_IDENT/)
+# and
+# length $text
+# ) {
+ elsif ($$css =~ s/^($RE_IDENT)\(//) {
# cleanup the func and args
- $text = lc $text;
- $value =~ s/^\(\s*//;
- $value =~ s/\s*\)$//;
- $value =~ s/^(?:"|')//; #"
- $value =~ s/(?:"|')$//; #"
+# $text = lc $text;
+# $value =~ s/^\(\s*//;
+# $value =~ s/\s*\)$//;
+# $value =~ s/^(?:"|')//; #"
+# $value =~ s/(?:"|')$//; #"
+ $text = lc $1;
+ $value = $sac->parse_property_value($css, 1);
# get the appropriate type
if ($FUNC_MAP{$text}) {
|