source: openpam/trunk/misc/history2wiki.pl

Last change on this file was 937, checked in by Dag-Erling Smørgrav, 3 years ago

Markip nit

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.4 KB
Line 
1#!/usr/bin/perl -Tw
2#-
3# Copyright (c) 2012-2014 Dag-Erling Smørgrav
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14# 3. The name of the author may not be used to endorse or promote
15#    products derived from this software without specific prior written
16#    permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28# SUCH DAMAGE.
29#
30# $Id$
31#
32
33use strict;
34use warnings;
35
36my $CVEURL = "http://web.nvd.nist.gov/view/vuln/detail?vulnId=";
37
38while (<>) {
39    if (m/^OpenPAM ([A-Z][a-z]+)\t+(\d\d\d\d-\d\d-\d\d)\s*$/) {
40        my ($relname, $reldate) = ($1, $2);
41        my $changes;
42        while (<>) {
43            last if m/^=+$/;
44            $changes .= $_;
45        }
46        $changes =~ s/^ - ([A-Z]+): / - '''$1''' /gm;
47        $changes =~ s/([\w.-]+\(\d*\))/`$1`/gs;
48        $changes =~ s/([^'`])\b([A-Z_]{4,}(?:\s+[A-Z_]{4,})*)\b([^'`])/$1`$2`$3/gs;
49        $changes =~ s/(CVE-\d{4}-\d+)/[$CVEURL$1 $1]/gs;
50        $changes =~ s/([.!?])\n +(\w)/$1  $2/gs;
51        $changes =~ s/(\S)\n +(\S)/$1 $2/gs;
52        open(my $fh, ">", "$relname.txt")
53            or die("$relname.txt: $!\n");
54        print($fh "= OpenPAM $relname =\n",
55              "\n",
56              "OpenPAM $relname was released on $reldate.\n",
57              $changes,
58              "\n",
59              "[http://sourceforge.net/projects/openpam/files/openpam/$relname/ Download from Sourceforge]\n");
60        close($fh);
61        print("|| $reldate || [[Releases/$relname|$relname]] ||\n");
62    }
63}
64
651;
Note: See TracBrowser for help on using the repository browser.