%leader = (); %body = ();
$append_to = \%leader;
while (<>) {
if (/^(Incompatible changes|Incompatibility) with/) {
die "No date found: $_" unless /(\d\d\d\d\d\d\d\d)/;
$append_to = \%body;
$prefix = "[Incompat $1] ";
while (<>) {
last if /^====/;
}
next;
}
if (/^Major changes with/) {
die "No date found: $_" unless /(\d\d\d\d\d\d\d\d)/;
$append_to = \%body;
$prefix = "[Feature $1] ";
while (<>) {
last if /^====/;
}
next;
}
if (/^\s*\n/) {
if ($paragraph) {
for $class (@classes) {
${$append_to}{$class} .= $paragraph . $_;
}
$paragraph = "";
}
} else {
if ($paragraph eq "") {
if ($append_to eq \%leader) {
@classes = ("default");
$paragraph = $_;
} elsif (/^\[([^]]+)\]\s*(.*)/s) {
$paragraph = $prefix . $2;
($junk = $1) =~ s/\s*,\s*/,/g;
$junk =~ s/^\s+//;
$junk =~ s/\s+$//;
@classes = split(/,+/, $junk);
} else {
$paragraph = $_;
}
} else {
$paragraph .= $_;
}
}
}
if ($paragraph) {
for $class (@classes) {
${$append_to}{$class} .= $prefix . $paragraph . $_;
}
}
print $leader{"default"};
for $class (sort keys %body) {
print "Major changes - $class\n";
($junk = "Major changes - $class") =~ s/./-/g;
print $junk, "\n\n";
print $body{$class};
}