Selaa lähdekoodia

* CSS file can be linked to instead of being included statically.
* Documented HiCell and HiCell2 options.

Christoph Berg 21 vuotta sitten
vanhempi
commit
7ce5fac636
3 muutettua tiedostoa jossa 61 lisäystä ja 16 poistoa
  1. 3 0
      docs/Changelog
  2. 44 7
      docs/pisg-doc.xml
  3. 14 9
      modules/Pisg/HTMLGenerator.pm

+ 3 - 0
docs/Changelog

@@ -7,6 +7,9 @@ pisg (0.62) - ??
    * wordlist_regexp uses quotemeta.
    * wordlist_regexp uses quotemeta.
    * New ShowActiveNicks option (defaulting to 1).
    * New ShowActiveNicks option (defaulting to 1).
    * Added lulubot parser (thanks, Vianney Lecroart).
    * Added lulubot parser (thanks, Vianney Lecroart).
+   * Yet another URL parsing fix (certainly not the last).
+   * CSS file can be linked to instead of being included statically.
+   * Documented HiCell and HiCell2 options.
    Changes by Morten Brix Pedersen:
    Changes by Morten Brix Pedersen:
    * Fixed typo in French translation.
    * Fixed typo in French translation.
 
 

+ 44 - 7
docs/pisg-doc.xml

@@ -277,8 +277,9 @@
 
 
     <para>
     <para>
     There are a few predefined color schemes for you to use, use the
     There are a few predefined color schemes for you to use, use the
-    ColorScheme option when using them. The available colorschemes are:
-    'default', 'darkgalaxy', 'ocean', 'darkred'.
+    <link linkend="ColorScheme">ColorScheme</link> option when using them. The
+    colorschemes distributed with pisg are: default (which is the default),
+    darkgalaxy, darkred, justgrey, ocean, orange_grey, pisg, softgreen.
     </para>
     </para>
 
 
     <para>
     <para>
@@ -292,8 +293,8 @@
     directory. In it resides <filename>default.css</filename> which is the
     directory. In it resides <filename>default.css</filename> which is the
     file being included onto the HTML page. Open it in a text editor like
     file being included onto the HTML page. Open it in a text editor like
     vi or notepad. Then change it until you're happy with it. Be aware that
     vi or notepad. Then change it until you're happy with it. Be aware that
-    you might want to look at the hicell and hicell2 options through
-    pisg.cfg for changing the last two colors.
+    you might want to look at the <link linkend="HiCell">HiCell and HiCell2</link>
+    options through pisg.cfg for changing the last two colors.
     </para>
     </para>
 
 
 
 
@@ -736,8 +737,12 @@
     <para>
     <para>
     <command>ColorScheme</command> is used to define the color scheme used
     <command>ColorScheme</command> is used to define the color scheme used
     for the statistics page. Actually it's the CSS file being included.
     for the statistics page. Actually it's the CSS file being included.
-    Available options are: default, darkgalaxy, darkred, justgrey, ocean,
-    softgreen, orange_grey.
+    CSS files distributed with pisg are: darkgalaxy, darkred, default,
+    justgrey, ocean, orange_grey, pisg, softgreen (omit the .css). The file
+    will be included statically in the generated HTML page. If you give a file
+    name or URL (i.e. a color scheme name with .css or a path), the file will
+    be linked to instead. See also <link linkend="CssDir">CssDir</link>,
+    <link linkend="HiCell">HiCell/HiCell2</link>.
     </para>
     </para>
     </refsect1>
     </refsect1>
     <refsect1>
     <refsect1>
@@ -3227,7 +3232,9 @@
     <title>Description</title>
     <title>Description</title>
     <para>
     <para>
     <command>CssDir</command> is used to define the paths to the CSS files
     <command>CssDir</command> is used to define the paths to the CSS files
-    (the color schemes). Usually you don't need to change this.
+    (the <link linkend="ColorScheme">ColorScheme</link>s). Usually you don't
+    need to change this. This setting is only used when statically including
+    the CSS file.
     </para>
     </para>
     </refsect1>
     </refsect1>
     <refsect1>
     <refsect1>
@@ -3236,6 +3243,36 @@
     </refsect1>
     </refsect1>
     </refentry>
     </refentry>
 
 
+    <!-- *** HICELL *** -->
+    <refentry id="HiCell">
+
+    <refmeta> <refentrytitle>HiCell, HiCell2</refentrytitle> </refmeta>
+
+    <refnamediv>
+    <refname>HiCell, HiCell2</refname>
+    <refpurpose>colors for color gradient in most active nicks section</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv><programlisting>
+      <![CDATA[
+        <set HiCell="#BABADD" HiCell2="#CCCCCC">
+      ]]>
+    </programlisting></refsynopsisdiv>
+
+    <refsect1>
+    <title>Description</title>
+    <para>
+    <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
+    match your <link linkend="ColorScheme">ColorScheme</link>.
+    </para>
+    </refsect1>
+    <refsect1>
+    <title>Default</title>
+    <para> #BABADD, #CCCCCC </para>
+    </refsect1>
+    </refentry>
+
     <!-- *** LOGTYPE *** -->
     <!-- *** LOGTYPE *** -->
     <refentry id="LogType">
     <refentry id="LogType">
 
 

+ 14 - 9
modules/Pisg/HTMLGenerator.pm

@@ -183,12 +183,18 @@ sub _htmlheader
         nicks      => scalar keys %{ $self->{stats}->{lines} }
         nicks      => scalar keys %{ $self->{stats}->{lines} }
     );
     );
 
 
-    my $css_file = $self->{cfg}->{cssdir} . $self->{cfg}->{colorscheme} . ".css";
-
-    # Get the chosen CSS file
-    open(FILE, $css_file) or open (FILE, $self->{cfg}->{search_path} . "/$css_file") or die("$0: Unable to open stylesheet($css_file): $!\n");
-
-    my @CSS = <FILE>;
+    my $CSS;
+    if($self->{cfg}->{colorscheme} =~ /[^\w]/) { # use external CSS file
+        $CSS = "<link rel=\"stylesheet\" type=\"text/css\" href=\"$self->{cfg}->{colorscheme}\">";
+    } else { # read the chosen CSS file
+        my $css_file = $self->{cfg}->{cssdir} . $self->{cfg}->{colorscheme} . ".css";
+        open(FILE, $css_file) or open (FILE, $self->{cfg}->{search_path} . "/$css_file") or die("$0: Unable to open stylesheet $css_file: $!\n");
+        {
+            local $/; # enable "slurp" mode
+            $CSS = "<style type=\"text/css\">\n". <FILE>. "</style>";
+        }
+        close FILE;
+    }
 
 
     my $title = $self->_template_text('pagetitle1', %hash);
     my $title = $self->_template_text('pagetitle1', %hash);
     print OUTPUT <<HTML;
     print OUTPUT <<HTML;
@@ -197,9 +203,8 @@ sub _htmlheader
 <head>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=$self->{cfg}->{charset}" />
 <meta http-equiv="Content-Type" content="text/html; charset=$self->{cfg}->{charset}" />
 <title>$title</title>
 <title>$title</title>
-<style type="text/css">
-@CSS
-</style></head>
+$CSS
+</head>
 <body>
 <body>
 <div align="center">
 <div align="center">
 HTML
 HTML