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

implemented the "none" color scheme

Christoph Berg 21 лет назад
Родитель
Сommit
bfcc9786c0
3 измененных файлов с 19 добавлено и 8 удалено
  1. 2 1
      docs/Changelog
  2. 8 5
      docs/pisg-doc.xml
  3. 9 2
      modules/Pisg/HTMLGenerator.pm

+ 2 - 1
docs/Changelog

@@ -8,7 +8,8 @@ pisg (0.62) - ??
    * New ShowActiveNicks option (defaulting to 1).
    * 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.
+   * CSS file can be linked to instead of being included statically;
+     using "none" will make pisg omit the HTML header.
    * Documented HiCell and HiCell2 options.
    Changes by Morten Brix Pedersen:
    * Fixed typo in French translation.

+ 8 - 5
docs/pisg-doc.xml

@@ -286,9 +286,6 @@
     When changing it, you need a fair knowledge of CSS (Cascading Style
     Sheets). CSS is what most of the web uses today to define styles and
     layout on HTML pages.
-    </para>
-
-    <para>
     With the pisg distribution, look in the <filename>layout</filename>
     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
@@ -297,13 +294,17 @@
     options through pisg.cfg for changing the last two colors.
     </para>
 
-
     <para>
     If you have created a nice stylesheet which other can take advantage of,
     you are encouraged to send it to the pisg mailing list so that it can be
     distributed with the next version of pisg.
     </para>
 
+    <para>
+    If you want to embed the statistics into another page, use the "none" color scheme.
+    Pisg will then omit the HTML header and write only the body part.
+    </para>
+
    </sect1>
    <sect1 id="running-pisg">
     <title>Running pisg</title>
@@ -741,7 +742,9 @@
     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>,
+    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
+    also <link linkend="CssDir">CssDir</link>,
     <link linkend="HiCell">HiCell/HiCell2</link>.
     </para>
     </refsect1>

+ 9 - 2
modules/Pisg/HTMLGenerator.pm

@@ -186,7 +186,7 @@ sub _htmlheader
     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
+    } elsif($self->{cfg}->{colorscheme} ne "none") { # 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");
         {
@@ -197,7 +197,8 @@ sub _htmlheader
     }
 
     my $title = $self->_template_text('pagetitle1', %hash);
-    print OUTPUT <<HTML;
+    if($self->{cfg}->{colorscheme} ne "none") {
+        print OUTPUT <<HTML;
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
 <head>
@@ -208,6 +209,7 @@ $CSS
 <body>
 <div align="center">
 HTML
+    }
     _html("<span class=\"title\">$title</span><br />");
     _html("<br />");
     _html($self->_template_text('pagetitle2', %hash) . " " . $self->get_time());
@@ -289,10 +291,15 @@ $stats_gen<br />
 $author_text<br />
 $stats_text
 </span>
+HTML
+
+    if($self->{cfg}->{colorscheme} ne "none") {
+        print OUTPUT <<HTML;
 </div>
 </body>
 </html>
 HTML
+    }
 }
 
 sub _headline