#!/usr/bin/perl5.8.0
# Create the documentation for the Mail::Box module.
# This script can be called as part of the mkdist procedure, but also
# on its own.

use warnings;
use strict;

use lib '../OODoc';   # use my latest version of OODoc
use lib 'tests';
use OODoc;

my $verbose      = $ARGV[0] || 0;

##### Synchronize these constants with the mkdist script.
my $distribution = '/tmp/MailBox';

##### Other constants
my $module       = 'Mail::Box';
my $name         = 'E-mail handling with Mail::Box';
my $version      = '2.043';         # Change this for each release!!!

my $pod_format   = 'pod2';
#my $pod_format  = 'pod';
my $html_format  = 'html';

print "*** Producing $module version $version\n" if $verbose;

my $web          = 'public_html';
my $website      = 'http://perl.overmeer.net/mailbox/';

my $html_root    = "/mailbox/html";  # usually empty, but not for me
my $css          = "$html_root/mailbox.css";

#
# The OODoc object is created.  It is used to collect all the manual
# information in.
#

my $doc  = OODoc->new
 ( module     => $name
 , version    => $version
 , verbose    => $verbose
 );

#
# Reading all the manual pages
# This could be called more than once to combine different sets of
# manual pages in different formats.
#

print "* Processing files\n" if $verbose;
$doc->processFiles
 ( workdir => $distribution
 , select  => qr/^Mail.*\.(pod|pm)$/
 );

#
# Prepare the collected information
# Expanding the inheritance relations and such, to simplify the
# production of manual pages in their different formats.
#

print "* Preparation phase\n" if $verbose;
$doc->prepare;

#
# Create POD
# Produce manual pages in the usual Perl style.
#

print "* Creating POD\n" if $verbose;

$doc->create
  ( $pod_format
  , workdir => $distribution
  , append => <<TEXT);

=head1 REFERENCES

See the $module website at L<$website> for more details.

=head1 COPYRIGHTS

Module version $version.
Written by Mark Overmeer (mark\@overmeer.net).  See the ChangeLog for
other contributors.

Copyright (c) 2001-2003 by the author(s). All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

TEXT

#
# Create HTML
#

print "* Creating HTML\n" if $verbose;

$doc->create
  ( $html_format
  , workdir        => "$web$html_root"

  , format_options =>
      [ html_root      => $html_root
      , html_meta_data => qq[<link rel="STYLESHEET" href="$css">]
      ]

  , manual_format =>
      [
      ]
  );
