######################################################################## # COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED. # # Module name : JatsDocTools.pm # Module type : Makefile system # Compiler(s) : Perl # Environment(s): jats # # Description : Create HTML documentation and release note # #......................................................................# package JatsDocTools; use strict; use warnings; use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(UpdateHTML); our $VERSION = '1.0.0000'; sub WriteTOC { require JatsDocTools::TOC; my $dir = $JatsDocTools::TOC::dirbase; return unless -d $dir; my($file,$toc); require JatsDocTools::TOC::HTML; $toc = JatsDocTools::TOC::HTML->new->TOC(); $file = "$dir/JatsToc.html"; unlink($file); my $fh; unless (open($fh, '>', $file)) { warn "Can't open '$file': $!"; return; } print $fh $toc; close($fh) or die "Can't write '$file': $!"; return 1; } #------------------------------------------------------------------------------- # Function : WriteRelease # # Description : Create an HTML like Release note # # Inputs : changeLog - Path to text Change log # # Returns : # sub WriteRelease { my ($changeLog) = @_; my $pre_mode = 0; require JatsDocTools::TOC; my $dir = $JatsDocTools::TOC::dirbase; return unless -d $dir; my $file = "$dir/release.html"; unlink($file); my $fh; unless (open($fh, '>', $file)) { warn "Can't open '$file': $!"; return; } my $ifile; unless (open($ifile, '<', $changeLog)) { warn "Can't open '$changeLog': $!"; return; } print $fh <<'HERE';
";
} else {
print $fh "";
}
$pre_mode = $next_pre;
}
print $fh $line . "\n";
}
print $fh "\n" if $pre_mode;
print $fh "\n";
close($fh) or die "Can't write '$file': $!";
}
sub UpdateHTML {
my %args = @_;
require JatsDocTools::TOC;
$JatsDocTools::TOC::dirbase = $args{htmldir} || 'html';
$JatsDocTools::TOC::cacheDir = $args{cacheDir} || '';
unless ( -d $JatsDocTools::TOC::dirbase )
{
print "Dir not found: $JatsDocTools::TOC::dirbase\n";
return;
}
require JatsDocTools::Tree::HTML;
eval {
if ( $args{force} >= 0 ) {
JatsDocTools::Tree::HTML::Update(
verbose => $args{verbose},
force => $args{force},
htmldir => $args{htmldir},
prefix => $args{prefix},
cacheDir => $args{cacheDir},
index => $args{index},
podpath => ['TOOLS'],
);
}
WriteTOC();
WriteRelease($args{ChangeLog});
};
if ($@) {
die $@;
}
}
1;