From: Fabian Keil <fk@fabiankeil.de>
Date: Sun, 31 Oct 2010 13:26:07 +0000 (+0000)
Subject: Store entries in an array of hashes so we can later add the indentation level.
X-Git-Tag: v_3_0_17~67
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/faq/@default-cgi@/static/@default-cgi@show-url-info?a=commitdiff_plain;h=74fec84a0663bc797225261a69859d835871873f;p=privoxy.git

Store entries in an array of hashes so we can later add the indentation level.
---

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" .