From 74fec84a0663bc797225261a69859d835871873f Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Sun, 31 Oct 2010 13:26:07 +0000
Subject: [PATCH] Store entries in an array of hashes so we can later add the
 indentation level.

---
 utils/changelog2doc.pl | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/utils/changelog2doc.pl b/utils/changelog2doc.pl
index d6751598..bfa23b01 100755
--- a/utils/changelog2doc.pl
+++ b/utils/changelog2doc.pl
@@ -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" .
-- 
2.49.0