Add a filter to make updating the "What's New in this Release"
[privoxy.git] / utils / changelog2doc.pl
diff --git a/utils/changelog2doc.pl b/utils/changelog2doc.pl
new file mode 100755 (executable)
index 0000000..adf2f92
--- /dev/null
@@ -0,0 +1,66 @@
+#!/usr/bin/perl
+
+# $Id:$
+# $Source:$
+
+# 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*$/;
+
+        if (/^-/) {
+            $i++; 
+            $entries[$i] = '';
+        }
+        s@^-?\s*@@;
+
+        $entries[$i] .= $_;
+    }
+    print "Parsed $i entries.\n";
+}
+
+sub generate_markup() {
+    my $markup = '';
+
+    $markup .= "<para>\n" .
+               " <itemizedlist>\n";
+
+    foreach my $entry (@entries) {
+        chomp $entry;
+        $entry =~ s@\n@\n    @g;
+        $markup .= "  <listitem>\n" .
+                   "   <para>\n" .
+                   "    " . $entry . "\n" .
+                   "   </para>\n" .
+                   "  </listitem>\n"
+                   ;
+    }
+    $markup .= " </itemizedlist>\n" .
+               "</para>\n";
+
+    print $markup;
+}
+
+sub main () {
+    read_entries();
+    generate_markup();
+}
+
+main();