#!/usr/bin/perl -w
# extract from Release notes to produce an html doc news.html
use strict;
use warnings;
sub extract($$) {
my $fic = shift (@_);
my $tout = shift (@_);
my $skip = 1;
open( FIC, '<', $fic ) or die "can not open $fic : $!\n";
while (<FIC>) {
chomp;
if ($skip) {
next unless (m/^release \d/);
$skip = 0;
}
if (m/^release ([\d\.]+)/) {
my $version = $1;
print "<li><a href=\"#v$version\">$version</a></li>\n";
print "<hr />\n";
print "2015-07-03 Eric Gerbier <<a href=\"mailto:gerbier\@users.sourceforge.net\">gerbier\@users.sourceforge.net</a>><a name=\"v$version\" id=\"v$version\">$version</a>\n";
print "<ul>\n";
} elsif (m/^(\w+)/) {
my $chapter = $1;
print "</ul></li>\n";
print "<li>$chapter<ul>\n";
} elsif (m/^\s*\*\s(.*)/) {
my $change = $1;
print " <li>$change</li>\n";
} elsif ( m/^\*\*\*/ ) {
next;
} elsif (m /^$/) {
next;
} elsif (m/-----------------------------------------------------------------/) {
print "</ul></li>\n";
print "</ul>\n";
last;
} else {
print STDERR "strange line : $_\n";
}
}
close(FIC);
}
my $log = $ARGV[0] || "../src/Release-notes";
my $tout = $ARGV[1]; # if set, will display all file
extract($log, $tout);