2 #***************************************************************************
3 #* Copyright (C) 2003-2010 Polytechnique.org *
4 #* http://opensource.polytechnique.org/ *
6 #* This program is free software; you can redistribute it and/or modify *
7 #* it under the terms of the GNU General Public License as published by *
8 #* the Free Software Foundation; either version 2 of the License, or *
9 #* (at your option) any later version. *
11 #* This program is distributed in the hope that it will be useful, *
12 #* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 #* GNU General Public License for more details. *
16 #* You should have received a copy of the GNU General Public License *
17 #* along with this program; if not, write to the Free Software *
18 #* Foundation, Inc., *
19 #* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 #***************************************************************************
27 my $red="\e[1;37;31m";
28 my $yel="\e[1;37;33m";
29 my $blu="\e[1;37;34m";
30 my $whi="\e[1;37;16m";
38 while(my $a = readdir DIR
) {
39 if( -d
$dir."/".$a ) {
40 push @dirs,$dir."/".$a unless($a eq '.' or $a eq '..' or $a eq 'CVS');
42 &parse_file
($dir."/".$a) if($a =~ /\.(php|tpl|htm[l]?)$/i);
46 foreach $dir (@dirs) { &parse_dir($dir); }
52 my $text = join '',(<FILE>);
53 $text =~ s/[\s\t\n]+/ /g;
54 &get_classes($file,$text);
61 while ($text =~ /<( *[^\/](?:->|[^>])*) *>(.*)$/) {
71 if (defined($classes{"$tag.$class"})) {
72 $classes{"$tag.$class"} .= " $file";
74 $classes{"$tag.$class"} = $file;
82 # tag interdits en xhtml
83 print STDERR "${red
}XHTML error
: ${yel
}<$1> (majuscules
) ${blu
}($file)${gra
}\n"
84 if($tag =~ /^((?:[A-Z]+[a-z]*)+)( |$)/);
85 print STDERR "${red
}XHTML error
: ${yel
}<$1> ${blu
}($file)${gra
}\n"
86 if($tag =~ /^(b|i|u|big|small|font|center)( |$)/);
87 print STDERR "${red
}XHTML error
: ${yel
}<$1> sans
'/' ${blu
}($file)${gra
}\n"
88 if($tag =~ /^(br|hr|img|link|input)( [^\/]*)?$/);
90 print STDERR "${red
}XHTML error
: ${yel
}attribut
$1 sans
= ${blu
}($file)${gra
}\n"
91 if($tag =~ / (checked|disabled|multiple|readonly)( |$)/);
92 print STDERR "${red
}XHTML error
: ${yel
}attribut
$1 ${blu
}($file)${gra
}\n"
93 if($tag =~ / (align|width|border|color|valign)=/);
95 # récupération des classes utilisées ...
96 if($tag =~ /^(\w+).* class=('{[^}]*}'|"{[^}]*}"|'[^{}']*'|"[^{}"]*")/) {
98 $2 =~ /^['"](.*)['"]$/;
100 if($c =~ /^{ ?cycle.* values=('[^']*'|"[^"]*")/) {
101 my @cycle = split /['",]/,$1;
102 foreach my $cl (@cycle) {
103 &class_add($file,$t,$cl) if($cl);
106 &class_add($file,$t,$c);
110 #récupération des styles utilisés ...
111 if($tag =~ /^(\w+).* style=('{[^}]*}'|"{[^}]*}"|'[^{}']*'|"[^{}"]*")/) {
113 $2 =~ /^['"](.*)['"]$/;
115 if (defined($styles{"$t => $s"})) {
116 $styles{"$t => $s"} .= " $file";
118 $styles{"$t => $s"} = $file;
123 foreach my $dir (@ARGV) {
127 print "\n$blu..:: Classes
::..$gra\n\n";
128 foreach my $key (sort(keys(%classes))) {
132 print "\n$blu..:: Styles
::..$gra\n\n";
133 foreach my $key (sort(keys(%styles))) {
134 print $key,"\t",$whi,$styles{$key},$gra,"\n";
139 # vim:set et ts=4 sts=4 sw=4: