3 # $Id: changelog2doc.pl,v 1.5 2010/10/31 13:27:03 fabiankeil Exp $
4 # $Source: /cvsroot/ijbswa/current/utils/changelog2doc.pl,v $
6 # Filter to parse the ChangeLog and translate the changes for
7 # the most recent version into something that looks like markup
8 # for the documentation but still needs fine-tuning.
16 my $section_reached = 0;
21 last if $section_reached;
25 next unless $section_reached;
29 my $indentation = length($1);
30 if ($i > 1 and $entries[$i]{indentation} > $indentation) {
31 $entries[$i]{last_list_item} = 1;
34 $entries[$i]{description} = '';
35 $entries[$i]{indentation} = $indentation;
38 $entries[$i]{list_header} = 1;
43 $entries[$i]{description} .= $_;
45 if ($entries[$i]{indentation} != 0) {
46 $entries[$i]{last_list_item} = 1;
48 print "Parsed " . @entries . " entries.\n";
51 sub create_listitem_markup($) {
53 my $description = $entry->{description};
55 my $default_lws = ' ';
56 my $lws = $default_lws x ($entry->{indentation} ? 2 : 1);
60 $description =~ s@\n@\n ${lws}@g;
62 $markup .= $lws . "<listitem>\n" .
65 $markup .= $lws . " " . $description . "\n";
67 if (defined $entry->{list_header}) {
68 $markup .= $lws . " <itemizedlist>\n";
71 if (defined $entry->{last_list_item}) {
72 $markup .= $lws . " </para>\n";
73 $markup .= $lws . "</itemizedlist>\n";
76 $markup .= $lws . " </para>\n" .
77 $lws . "</listitem>\n";
83 sub wrap_in_para_itemlist_markup($) {
85 my $markup = "<para>\n" .
88 " </itemizedlist>\n" .
93 sub generate_markup() {
96 foreach my $entry (@entries) {
97 $markup .= create_listitem_markup(\%{$entry});
100 print wrap_in_para_itemlist_markup($markup);