4.2. The Contents.pm File
- The file Contents.pm in the top directory contains the layout of the presentation into sections and sub-sections.
- It is a Perl Module which contains a data-structure with a specific syntax.
- Every hash reference is a node and contains two fields: url which is the URL relative to the upper node, and title which is the title of the node.
- It may optionally contain a subs field that has a reference to an array of sub-nodes as a value. If it does it will be treated as a directory; else as a normal HTML file.
- The images field may be specified to refer to an array of files to be copied to the destination directory as is, without being processed.
- An example is worth a thousand words! Here is the Contents.pm file of this very lecture.
package Contents;
use strict;
my $contents =
{
'title' => "QuaD-Pres - A Perl-based Tool for Presentation",
'subs' =>
[
{
'url' => "intro.html",
'title' => "Introduction",
},
{
'url' => "history.html",
'title' => "The History of QuaD-Pres",
},
{
'url' => "features.html",
'title' => "Quad-Pres Features",
},
{
'url' => "usage",
'title' => "Usage",
'subs' =>
[
{
'url' => "setting-up.html",
'title' => "Setting Up",
},
{
'url' => "Contents.pm.html",
'title' => "The Contents.pm File",
},
{
'url' => "page.html",
'title' => "An Individual Page",
},
{
'url' => "images.html",
'title' => "Including Images",
},
],
'images' => [ 'logo-wml.png' ],
},
{
'url' => "no_wml",
'title' => "Using QuaD-Pres without WebMetaLanguage",
'subs' =>
[
{
'url' => "page.html",
'title' => "An Individual Page",
},
{
'url' => "render-modes.html",
'title' => "The Render Modes",
},
],
},
{
'url' => "finale",
'title' => "Finale",
'subs' =>
[
{
'url' => "samples.html",
'title' => "Sample Presentations",
},
{
'url' => "links.html",
'title' => "Links",
},
],
}
],
'images' =>
[
'style.css',
],
};
sub get_contents
{
return $contents;
}
|