Subject: | [PATCH] support nested rules |
There are nested rules in LESS[1], but CSS::LESSp does not support it, yet.
This is a patch to support this:
etecture@ubuntu:/usr/local/share/perl/5.10.1/CSS$ diff -u LESSp.pm.old
LESSp.pm
--- LESSp.pm.old 2011-05-03 01:11:15.623783012 -0700
+++ LESSp.pm 2011-05-03 01:13:39.355783003 -0700
@@ -75,8 +75,11 @@
my @prenames = $parent->{'name'} =~ /\,/ ? split(/\s*\,\s*/,
$parent->{'name'}) : ($parent->{'name'});
my @postnames = ();
for my $prename ( @prenames ) {
- for my $name ( @names ) {
- push @postnames, $prename.( $name =~ /^\:/ ? "" : " " ).$name;
+ for my $name ( @names ) {
+ my $space = $name =~ /^(?:&|:)/
? '' : ' ';
+ $name =~ s/^&//;
+
+ push @postnames, $prename . $space .$name;
}
}
@names = @postnames;
[1] http://lesscss.org/#docs
Subject: | LESSp.pm.patch |
etecture@ubuntu:/usr/local/share/perl/5.10.1/CSS$ diff -u LESSp.pm.old LESSp.pm
--- LESSp.pm.old 2011-05-03 01:11:15.623783012 -0700
+++ LESSp.pm 2011-05-03 01:13:39.355783003 -0700
@@ -75,8 +75,11 @@
my @prenames = $parent->{'name'} =~ /\,/ ? split(/\s*\,\s*/, $parent->{'name'}) : ($parent->{'name'});
my @postnames = ();
for my $prename ( @prenames ) {
- for my $name ( @names ) {
- push @postnames, $prename.( $name =~ /^\:/ ? "" : " " ).$name;
+ for my $name ( @names ) {
+ my $space = $name =~ /^(?:&|:)/ ? '' : ' ';
+ $name =~ s/^&//;
+
+ push @postnames, $prename . $space .$name;
}
}
@names = @postnames;