<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># Subroutines for converting R documentation into HTML

# Copyright (C) 1997-2000 R Development Core Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the GNU
# General Public License for more details.
#
# A copy of the GNU General Public License is available via WWW at
# http://www.gnu.org/copyleft/gpl.html.	 You can also obtain it by
# writing to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA  02111-1307  USA.

# The head of a html page (e.g. used for packages list)
# Arguments:
#  $title      of the page
#  $top        relative path to $R_HOME/doc/html (must be "." if we
#              already are there)
#  $up         filename of the upper file
#  $uptext     alternate text for upper file
#  $prev       filename of the previous file (for button bar)
#  $prevtext   alternate text for previous file
#  $next       filename of next file
#  $nextext    alternate text for next file
#
# If no previous or next button should be displayed, leave the
# corresponding filenames empty.

sub html_pagehead
{
    my ($title, $top, $up, $uptext, $prev, $prevtext, $next, $nextext) = @_;

    my $retval = "&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;R: $title&lt;/TITLE&gt;" .
	"&lt;LINK REL=STYLESHEET TYPE=\"text/css\" HREF=\"$top/R.css\"&gt;" .
	"&lt;/HEAD&gt;&lt;BODY&gt;\n" .
	"&lt;h1&gt;$title " .
	"&lt;img class=toplogo src=\"$top/logo.jpg\" alt=\"[R logo]\"&gt;&lt;/h1&gt;\n\n" .
        "&lt;hr&gt;\n\n" .
        "&lt;div align=\"center\"&gt;\n";

    $retval .= "&lt;A HREF=\"$prev\"&gt;&lt;IMG SRC=\"$top/left.jpg\"\n" .
	"ALT=\"[$prevtext]\" WIDTH=\"30\" HEIGHT=\"30\" BORDER=\"0\"&gt;&lt;/A&gt;\n"
	    if $prev;

    $retval .=
	"&lt;A HREF=\"$up\"&gt;&lt;IMG SRC=\"$top/up.jpg\"" .
        "ALT=\"[$uptext]\" WIDTH=\"30\" HEIGHT=\"30\" BORDER=\"0\"&gt;&lt;/A&gt;\n"
	    if $up;

    $retval .= "&lt;A HREF=\"$next\"&gt;&lt;IMG SRC=\"$top/right.jpg\"\n" .
    "ALT=\"[$nextext]\" WIDTH=\"30\" HEIGHT=\"30\" BORDER=\"0\"&gt;&lt;/A&gt;\n"
	if $next;

    $retval .= "&lt;/DIV&gt;\n\n";

    $retval;
}



# The header &amp; footer of a function page

sub html_functionhead
{
    my ($title, $pkgname, $name) = @_;

    my $retval = "&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;R: $title&lt;/TITLE&gt;\n" .
	"&lt;LINK REL=STYLESHEET TYPE=\"text/css\" HREF=\"../../../doc/html/R.css\"&gt;" .
	"&lt;/HEAD&gt;&lt;BODY&gt;\n\n";

    if($pkgname){
	$retval .= "&lt;TABLE WIDTH=\"100%\"&gt;&lt;TR&gt;" .
	    "&lt;TD&gt;$name {$pkgname}&lt;/TD&gt;" .
	    "&lt;TD ALIGN=\"right\"&gt;R Documentation&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;";
    }

    $retval .= html_title2($title);
}

sub html_functionfoot
{
    my $retval;

    if($HTML){
	$retval .= "\n\n&lt;hr&gt;&lt;div align=\"center\"&gt;" .
	    "&lt;a href=\"00Index.$HTML\"&gt;[Package Contents]&lt;/a&gt;&lt;/div&gt;\n\n";
    }

    $retval .= "&lt;/BODY&gt;&lt;/HTML&gt;\n";
}

# A Title of level 2

sub html_title2
{
    my $title = $_[0];

    if($opt_chm) {
	"\n&lt;h2 align=\"center\"&gt;&lt;FONT COLOR=\"#0000FF\"&gt;" .
	    "&lt;tt&gt;$title&lt;/tt&gt;&lt;/FONT&gt;&lt;/h2&gt;\n\n";
    } else {
	"\n&lt;h2&gt;$title&lt;/h2&gt;\n\n";
    }
}

sub html_title3
{
    my $title = $_[0];

    if($opt_chm) {
	"\n&lt;h3&gt;&lt;FONT COLOR=\"#666666\"&gt;" .
	    "&lt;tt&gt;$title&lt;/tt&gt;&lt;/FONT&gt;&lt;/h3&gt;\n\n";
    } else {
	"\n&lt;h3&gt;$title&lt;/h3&gt;\n\n";
    }
}


## produce alphabet for head of pages
## optional argument gives array ofg letters to use
sub html_alphabet
{
    my @letters = @_;

    @letters = (A..Z) if $#letters&lt;0;
    my $retval = "&lt;p align=\"center\"&gt;\n";
    foreach $letter (sort(@letters)){
	$retval .= "&lt;A HREF=\"#${letter}\"&gt;${letter}&lt;/A&gt;\n";
    }
    $retval;
}

sub chm_pagehead
{
    my ($title) = @_;

    my $retval = "&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;$title&lt;/TITLE&gt;&lt;/HEAD&gt;\n" .
	"&lt;BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" " .
	"LINK=\"#0000F0\" VLINK=\"#660066\" ALINK=\"#FF0000\" " .
	"BACKGROUND=\"white\"&gt;\n" .
	"&lt;h1 align=\"center\"&gt;\n" .
        "&lt;FONT COLOR=\"#999999\" " .
        "size=\"+3\"&gt;&lt;tt&gt;\n" .
        "$title\n" .
        "&lt;/tt&gt;&lt;/FONT&gt;&lt;img src=\"logo.jpg\" alt=\"[R logo]\" align=\"center\"&gt;&lt;/h1&gt;\n\n" .
        "&lt;hr&gt;\n\n";
    $retval .= "&lt;OBJECT TYPE=\"application/x-oleobject\" CLASSID=\"clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e\"&gt;\n";
    $retval .= "&lt;PARAM NAME=\"Keyword\" VALUE=\".. Contents\"&gt;\n" .
	"&lt;/OBJECT&gt;\n\n";
    $retval;
}

sub chm_functionhead
{
    my ($title, $pkgname, $name) = @_;

    my $retval = "&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;$title&lt;/TITLE&gt;&lt;/HEAD&gt;\n" .
	"&lt;BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" " .
	"LINK=\"#0000F0\" VLINK=\"#660066\" ALINK=\"#FF0000\" " .
	"BACKGROUND=\"white\"&gt;\n\n";

    if($pkgname){
	$retval .= "&lt;TABLE WIDTH=\"100%\"&gt;&lt;TR&gt;" .
	    "&lt;TD&gt;$name($pkgname)&lt;/TD&gt;" .
	    "&lt;TD ALIGN=\"right\"&gt;R Documentation&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;";
    }

    $retval .= "&lt;OBJECT TYPE=\"application/x-oleobject\" CLASSID=\"clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e\"&gt;\n";
    foreach(@aliases) {
#	print "alias: $_\n";
	$retval .= "&lt;PARAM NAME=\"Keyword\" VALUE=\"R:   $_\"&gt;\n";
    }
    $title =~ s/\"/'/go;  #'
    $title =~ s/,//go;  # commas seem to give problems
    $retval .= "&lt;PARAM NAME=\"Keyword\" VALUE=\" $title\"&gt;\n" .
	"&lt;/OBJECT&gt;\n\n";
    $retval .= html_title2($title);

}

1;
</pre></body></html>