2012-05-03 18:32:18 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
2012-06-28 03:42:39 +00:00
|
|
|
# $Id: changelog2doc.pl,v 1.2 2008/09/26 16:49:09 fabiankeil Exp $
|
|
|
|
# $Source: /cvsroot/ijbswa/current/utils/changelog2doc.pl,v $
|
|
|
|
|
2012-05-03 18:32:18 +00:00
|
|
|
# Filter to parse the ChangeLog and translate the changes for
|
|
|
|
# the most recent version into something that looks like markup
|
|
|
|
# for the documentation but still needs fine-tuning.
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
my @entries;
|
|
|
|
|
|
|
|
sub read_entries() {
|
|
|
|
my $section_reached = 0;
|
|
|
|
my $i = -1;
|
|
|
|
|
|
|
|
while (<>) {
|
|
|
|
if (/^\*{3} /) {
|
|
|
|
last if $section_reached;
|
|
|
|
$section_reached = 1;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
next unless $section_reached;
|
|
|
|
next if /^\s*$/;
|
|
|
|
|
2012-06-28 03:42:39 +00:00
|
|
|
if (/^-/) {
|
2012-05-03 18:32:18 +00:00
|
|
|
$i++;
|
2012-06-28 03:42:39 +00:00
|
|
|
$entries[$i] = '';
|
2012-05-03 18:32:18 +00:00
|
|
|
}
|
2012-06-28 03:42:39 +00:00
|
|
|
s@^-?\s*@@;
|
2012-05-03 18:32:18 +00:00
|
|
|
|
2012-06-28 03:42:39 +00:00
|
|
|
$entries[$i] .= $_;
|
2012-05-03 18:32:18 +00:00
|
|
|
}
|
|
|
|
print "Parsed " . @entries . " entries.\n";
|
|
|
|
}
|
|
|
|
|
2012-06-28 03:17:49 +00:00
|
|
|
sub generate_markup() {
|
|
|
|
my $markup = '';
|
2012-05-03 18:32:18 +00:00
|
|
|
|
2012-06-28 03:42:39 +00:00
|
|
|
$markup .= "<para>\n" .
|
|
|
|
" <itemizedlist>\n";
|
|
|
|
|
2012-05-03 18:32:18 +00:00
|
|
|
foreach my $entry (@entries) {
|
2012-06-28 03:42:39 +00:00
|
|
|
chomp $entry;
|
|
|
|
$entry =~ s@\n@\n @g;
|
|
|
|
$markup .= " <listitem>\n" .
|
|
|
|
" <para>\n" .
|
|
|
|
" " . $entry . "\n" .
|
|
|
|
" </para>\n" .
|
|
|
|
" </listitem>\n"
|
|
|
|
;
|
2012-05-03 18:32:18 +00:00
|
|
|
}
|
2012-06-28 03:42:39 +00:00
|
|
|
$markup .= " </itemizedlist>\n" .
|
|
|
|
"</para>\n";
|
2012-05-03 18:32:18 +00:00
|
|
|
|
2012-06-28 03:42:39 +00:00
|
|
|
print $markup;
|
2012-05-03 18:32:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub main () {
|
|
|
|
read_entries();
|
|
|
|
generate_markup();
|
|
|
|
}
|
|
|
|
|
|
|
|
main();
|