Subversion Repositories wimsdev

Rev

Rev 4835 | Rev 11177 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #!/usr/bin/perl
  2. ## create the file public_html/bases/sys/css_classes from the css of public_html/themes/standard
  3. ## use in documentation
  4. use warnings;
  5. use strict;
  6. #use Text::Balanced qw (extract_bracketed extract_tagged);
  7.  
  8. $/ = undef;
  9. for my $theme ('default','Nikaia','standard'){
  10.  my $dir="public_html/themes/$theme";
  11.  my $outfile="public_html/bases/sys/css_classes_$theme" ;
  12.  my $TEXT="generated by bin/css.pl - do not change by hand \n" ;
  13.  for my $file (glob("$dir/*.css")) {
  14.   $TEXT  .= "\n\n\n/*generated from file : $file */\n" ;
  15.   my $text=treate_file($file) ;
  16.   $TEXT .= "\n$text" ;
  17.  }
  18.  for my $file (glob("$dir/*/*.css")) {
  19.   $TEXT  .= "\n\n\n/*generated from file : $file */\n" ;
  20.   my $text=treate_file($file) ;
  21.   $TEXT .= "\n$text" ;
  22.  }
  23.  
  24.  out($outfile, $TEXT) ;
  25. }
  26.  
  27. sub treate_file { my ($file)=@_;
  28.  open(IN, $file) ;
  29.   my $text = <IN>; close(IN);
  30.   $text =~ s/\n\t+//g ;
  31.   $text =~ s/\n}/}/g ;
  32.   $text =~ s/{[^{]+}/{ }/g ;
  33.   $text =~ s/{ }(.)/{ }\n$1/g ;
  34.   $text ;
  35.   }
  36. sub out { my ($bloc, $text) = @_;
  37.   open  (OUT, ">$bloc") ;
  38.   print OUT $text ; close OUT;
  39. }