Store entries in an array of hashes so we can later add the indentation level.
[privoxy.git] / utils / changelog2doc.pl
index d675159..bfa23b0 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: changelog2doc.pl,v 1.2 2008/09/26 16:49:09 fabiankeil Exp $
+# $Id: changelog2doc.pl,v 1.3 2010/10/31 13:25:47 fabiankeil Exp $
 # $Source: /cvsroot/ijbswa/current/utils/changelog2doc.pl,v $
 
 # Filter to parse the ChangeLog and translate the changes for
@@ -27,22 +27,25 @@ sub read_entries() {
 
         if (/^-/) {
             $i++; 
-            $entries[$i] = '';
+            $entries[$i]{description} = '';
         }
         s@^-?\s*@@;
 
-        $entries[$i] .= $_;
+        $entries[$i]{description} .= $_;
     }
     print "Parsed " . @entries . " entries.\n";
 }
 
 sub create_listitem_markup($) {
     my $entry = shift;
+    my $description = $entry->{description};
 
-    $entry =~ s@\n@\n    @g;
+    chomp $description;
+
+    $description =~ s@\n@\n    @g;
     return "  <listitem>\n" .
            "   <para>\n" .
-           "    " . $entry . "\n" .
+           "    " . $description . "\n" .
            "   </para>\n" .
            "  </listitem>\n";
 }
@@ -54,8 +57,7 @@ sub generate_markup() {
                " <itemizedlist>\n";
 
     foreach my $entry (@entries) {
-        chomp $entry;
-        $markup .= create_listitem_markup($entry);
+        $markup .= create_listitem_markup(\%{$entry});
     }
 
     $markup .= " </itemizedlist>\n" .