Export website in HTML

PPresenter
Manual
Export
Website
HTML

Simple Website
Options
Use an Exporter
Own Contents
Override
Structure
Example

Portable Presenter is a package designed to give presentations. Doing the presentation is one thing, but you like to have this show publicly available afterwards.

The most popular way to present your slides after "the real thing" is by creating a website. The module PPresenter::Export::Website::HTML.pm can do this for you, although this is not a really easy thing: you need a bit more knowledge about Perl for this.

This export option is useless whithout Image::Magick installed.

A Simple Website

Exporters are not automatically added to your show. It is not (but could be) a part of a style. So: anywhere in your program you have to add the line
   $show->addExporter('PPresenter::Export::Website::HTML');
Start the show. When the compilation of the exporter module is successful, you can access the options of the module via the background module.

Some basic changes can be made, like the format and the width of the images to be produced (the height of the image is scaled the same as the width is). Most changes you want to make to the produced site require you to write your own exporter module.

Options

The Website object extends to IM_Images object and the general Export object. Next to those options, you may set:
-slideAs => way-to-dump
-notesAs => way-to-dump
The default settings how the slides should be included in the webpages. The way-do-dump value is one of
IMAGE
Requires Image::Magick. The screens are copied using XWD and then converted into the specified format and width.
TABLE
The template should have a makeHTMLTable function and the formatter shall provide a toHTML function for this to work. The text is transformed into HTML which should show similar to the screen.
LINEAR
The formatter should provide a makeHTMLLinear function for this to work. The template layout be be lost, but the content of slides is translated into HTML.
SKIP

-outputDir => directory
The specified directory will contain the site. If this directory does not exist, it will be created.

-indexFile => file
Each slide will be stored in a seperate directory, in a file under this name. All links between the pages will be very explicit about the filename specified here, although it is the default of the machine where the site resides. Because of that, you can test your site with the file: primitive too.

Using an Exporter

You can only use an export if you invoke it explicitly in your presentation program. There are two ways to do this:
   my $show   = PPresenter->new(options);
   my $export =
       $show->addExporter('PPresenter::Export::Website::HTML');
   $export->change(options);
or
   my $show   = PPresenter->new(options);
   my $export =
       PPresenter::Export::Website::HTML->new(options);

Your own Website Contents

Each website is different. An option-menu is not sufficient to all demands. Therefore, if you want to produce your own layout, you have to override parts of the standard exporter.

Perl offers two ways to override the functionality: a very dirty but fast one, and a pretty OO-version which is a bit more work.

The dirty way:

    $show->addExporter('PPresenter::Export::Website::HTML');

    sub PPresenter::Export:Website::HTML::PageLogo($$)
    {   my ($export, $show, $slide) = @_;
        my $file = $slide ? "../logo.gif" : "logo.gif";
        "<IMG SRC=$file WIDTH=150 HEIGHT=107>";
    }
and the nice OO-way:
    $show->addExporter('MyWebsite');
file MyWebsite.pm
    package MyWebsite;
    use PPresenter::Export:Website::HTML';
    use base 'PPresenter::Export:Website::HTML';

    sub PageLogo($$)
    {   my ($export, $show, $slide) = @_;
        my $file = $slide ? "../logo.gif" : "logo.gif";
        "<IMG SRC=$file WIDTH=150 HEIGHT=107>";
    }

    1;

The Functions to Override

The Page table built by calling a huge amount of functions, which all can be overridden when needed. The main structure of the default webpages is:
Normal pages:Front page:
Commercial
PageLogoChapter
VerticalIndex SlideExports
ExtraText
HorizontalIndex

Signature
Commercial
PageLogoChapter
VerticalIndex ExtraText
MainPageIndex
HorizontalIndex

Signature

Now the name of the functions. The parameters show which arguments are passed on. In each case, the $slide can have the value undef to indicate that the result is used in the frontpage.

$export->Title($show, $slide)
Constructs the text to be included in the TITLE container of the web-page. This should be kept short.
$export->Chapter($show, $slide)
The main header of the page. This will be included in a H1 container of each produced page.
$export->PageLogo($show, $slide)
The piece of code which is locked-up in the top-left corner of each page. This will usually be an image, optionally enclosed in by a link.
$export->VerticalIndex($show, $slide, $previous, $next)
As good practice, the left column of a page is used to refer to other related pages. It may also contain an index of the same page, when this page gets too long.
$export->ExtraText($show, $slide)
Text you want to add to a page. Most useful for the frontpage to tell the site's visitor where the slides are about.
$export->MainPageIndex($show)
This function produces a table of defined slides, by default.
$export->HorizontalIndex($show, $slide, $previous, $next)
Like the vertical index, but now horizontally. Usually produces a pointer to the previous and to the next slide in the presentation.
$export->Commercial($show, $slide)
May produce text which is included in the HTML as first in the BODY. This may be used to show commercial messages, and such alike.
$export->Signature($show, $slide)
Displayed at the bottom of the page.
There are more routines which you can override, but then the programming gets tough. Look at the source to see how this is done.

Change the Structure

The structure of the produced sites is controled by the following functions (can be overruled too)
sub $export->slideDir($slide)
Returns the directory where the slide's page for that phase is stored. By default, this is the slide's sequence-number, followed by a dash, followed by the actual slide's phase.
For example: "23-2".
sub $export->slide2filename($slide)
The filename of the slide. For example: "website/3/index.html".
sub $export->slide2main()
The path to follow to go from slide to the main page. By default, this is one directory up, and there the -indexFile. For example: "../index.html".
sub $export->main2slide($slide)
The path to follow from the main page to a slide. For example: "23-2/index.html".
sub $export->slide2slide($slide)
How to refer from one slide to the other. May result in "../23-2/index.html".
With these functions, you can change the structure of the pages produced, but it is not adviced to do so.

An Example

As example, a exporter module which has some things changed to personal whishes.
package MyWebsite;

use PPresenter::Export::Website::HTML;
use base 'PPresenter::Export::Website::HTML';

sub PageLogo($$)
{   my ($export, $show, $slide) = @_;
    my $file = $slide ? "../logo.gif" : "logo.gif";
    "<IMG SRC=$file WIDTH=150 HEIGHT=107 HSPACE=5 VSPACE=5>";
}

sub ExtraText($$)
{   my ($export, $show, $slide) = @_;

    return '' if $slide;   # only extra text for the intro page.

    <<INTRO;
This presentation was given for....
INTRO
}

In the main program, you have to add the one line:

$show->addExporter('MyWebsite');

Start your presentation and select in your background menu the entry export/Website. After pressing EXPORT and OK, followed by a cup of coffee, you'll have your site.

 
Portable Presenter is written and maintained by Mark Overmeer. Copyright (C) 2000-2002, Free Software Foundation FSF.