Просмотр исходного кода

ColorScheme 'none' will generate the color gradient again, the gradient is dropped with HiCell="".

Christoph Berg 21 лет назад
Родитель
Сommit
210e715f6c
4 измененных файлов с 15 добавлено и 11 удалено
  1. 3 0
      docs/Changelog
  2. 6 2
      docs/pisg-doc.xml
  3. 2 2
      modules/Pisg.pm
  4. 4 7
      modules/Pisg/HTMLGenerator.pm

+ 3 - 0
docs/Changelog

@@ -1,4 +1,7 @@
 pisg (0.68) - ??
 pisg (0.68) - ??
+   Christoph:
+     + ColorScheme 'none' will generate the color gradient again, the gradient
+       is dropped with HiCell="".
    Torbjörn:
    Torbjörn:
      + Generate stats in multiple languages in a single run.
      + Generate stats in multiple languages in a single run.
 
 

+ 6 - 2
docs/pisg-doc.xml

@@ -751,7 +751,7 @@
     name or URL (i.e. a color scheme name with .css or a path), the file will
     name or URL (i.e. a color scheme name with .css or a path), the file will
     be linked to instead. Using "none" will cause pisg to write only the body
     be linked to instead. Using "none" will cause pisg to write only the body
     of the page; use this to include the statistics into a custom page. See
     of the page; use this to include the statistics into a custom page. See
-    also <xref linkend="CssDir" />,
+    also <xref linkend="CssDir" />, <xref linkend="AltColorScheme" />,
     <link linkend="HiCell">HiCell/HiCell2</link>.
     <link linkend="HiCell">HiCell/HiCell2</link>.
     </para>
     </para>
     </refsect1>
     </refsect1>
@@ -3756,6 +3756,7 @@
     <refsynopsisdiv><programlisting>
     <refsynopsisdiv><programlisting>
       <![CDATA[
       <![CDATA[
         <set HiCell="#BABADD" HiCell2="#CCCCCC">
         <set HiCell="#BABADD" HiCell2="#CCCCCC">
+        <set HiCell="">
       ]]>
       ]]>
     </programlisting></refsynopsisdiv>
     </programlisting></refsynopsisdiv>
 
 
@@ -3764,7 +3765,10 @@
     <para>
     <para>
     <command>HiCell</command> and <command>HiCell2</command> define the colors
     <command>HiCell</command> and <command>HiCell2</command> define the colors
     to be used for the color gradient in the most active nicks section. They should
     to be used for the color gradient in the most active nicks section. They should
-    match your <xref linkend="ColorScheme" />.
+    match your <xref linkend="ColorScheme" />. When setting
+    <command>HiCell</command> the empty string (""), pisg will not generate a color
+    gradient; you might want to use this with <xref linkend="ColorScheme" />="none"
+    or <xref linkend="AltColorScheme" />.
     </para>
     </para>
     </refsect1>
     </refsect1>
     <refsect1>
     <refsect1>

+ 2 - 2
modules/Pisg.pm

@@ -363,7 +363,7 @@ sub init_config
             my ($channel, $settings, $tmp) = ($2, $3, {});
             my ($channel, $settings, $tmp) = ($2, $3, {});
             $tmp->{$channel}->{channel} = $channel;
             $tmp->{$channel}->{channel} = $channel;
             $self->{cfg}->{chan_done}{$self->{cfg}->{channel}} = 1; # don't parse channel in $self->{cfg}->{channel} if a channel statement is present
             $self->{cfg}->{chan_done}{$self->{cfg}->{channel}} = 1; # don't parse channel in $self->{cfg}->{channel} if a channel statement is present
-            while ($settings =~ s/\s([^=]+)=(["'])(.+?)\2//) {
+            while ($settings =~ s/\s([^=]+)=(["'])(.*?)\2//) {
                 my $var = lc($1);
                 my $var = lc($1);
                 my $val = $3;
                 my $val = $3;
                 if ($var eq "logdir" || $var eq "logfile") {
                 if ($var eq "logdir" || $var eq "logfile") {
@@ -380,7 +380,7 @@ sub init_config
                     push @{ $self->{chans} }, $tmp;
                     push @{ $self->{chans} }, $tmp;
                     last;
                     last;
                 }
                 }
-                if ($_ =~ /^\s*(\w+)\s*=\s*(["'])(.+?)\2/) {
+                if ($_ =~ /^\s*(\w+)\s*=\s*(["'])(.*?)\2/) {
                     my $var = lc($1);
                     my $var = lc($1);
                     my $val = $3;
                     my $val = $3;
                     unless ((($var eq "logdir" || $var eq "logfile") && scalar(@{$self->{override_cfg}->{$var}}) > 0) || (($var ne "logdir" && $var ne "logfile") && $self->{override_cfg}->{$var})) {
                     unless ((($var eq "logdir" || $var eq "logfile") && scalar(@{$self->{override_cfg}->{$var}}) > 0) || (($var ne "logdir" && $var ne "logfile") && $self->{override_cfg}->{$var})) {

+ 4 - 7
modules/Pisg/HTMLGenerator.pm

@@ -563,10 +563,7 @@ sub _activenicks
             $visiblenick = $self->_format_word($nick);
             $visiblenick = $self->_format_word($nick);
         }
         }
 
 
-        my $style = '';
-        if ($self->{cfg}->{colorscheme} ne 'none') {
-            $style = "style=\"background-color: ". $self->generate_colors($c) ."\"";
-        }
+        my $style = $self->generate_colors($c);
 
 
         my $class = 'rankc';
         my $class = 'rankc';
         if ($c == 1) {
         if ($c == 1) {
@@ -685,10 +682,10 @@ sub generate_colors
     my $self = shift;
     my $self = shift;
     my $c = shift;
     my $c = shift;
 
 
-    my $h = $self->{cfg}->{hicell};
+    my $h = $self->{cfg}->{hicell} or return "class=\"hicell\"";
     $h =~ s/^#//;
     $h =~ s/^#//;
     $h = hex $h;
     $h = hex $h;
-    my $h2 = $self->{cfg}->{hicell2};
+    my $h2 = $self->{cfg}->{hicell2} or return "class=\"hicell\"";
     $h2 =~ s/^#//;
     $h2 =~ s/^#//;
     $h2 = hex $h2;
     $h2 = hex $h2;
     my $f_b = $h & 0xff;
     my $f_b = $h & 0xff;
@@ -701,7 +698,7 @@ sub generate_colors
     my $green  = sprintf "%0.2x", abs int(((($t_g - $f_g) / $self->{cfg}->{activenicks}) * +$c) + $f_g);
     my $green  = sprintf "%0.2x", abs int(((($t_g - $f_g) / $self->{cfg}->{activenicks}) * +$c) + $f_g);
     my $red  = sprintf "%0.2x", abs int(((($t_r - $f_r) / $self->{cfg}->{activenicks}) * +$c) + $f_r);
     my $red  = sprintf "%0.2x", abs int(((($t_r - $f_r) / $self->{cfg}->{activenicks}) * +$c) + $f_r);
 
 
-    return "#$red$green$blue";
+    return "style=\"background-color: #$red$green$blue\"";
 }
 }
 
 
 sub _html
 sub _html