forked from collectd/collectd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwiki2changelog.pl
executable file
·75 lines (55 loc) · 1.19 KB
/
wiki2changelog.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/perl
use strict;
use warnings;
=head1 NAME
wiki2changelog.pl
=head1 DESCRIPTION
This script takes the change log from one of the "Version x.y" pages in
collectd's wiki and converts it to the format used by the "ChangeLog" file.
This is usually done as part of the release process.
=cut
our $TextWidth = 80;
sub format_entry
{
my $in = shift;
my $out = '';
my $line = "\t*";
my $line_len = 9;
for (split (' ', $in)) {
my $word = $_;
my $word_len = 1 + length $word;
if (($line_len + $word_len) > $TextWidth) {
$out .= "$line\n";
$line = "\t ";
$line_len = 9;
}
$line .= " $word";
$line_len += $word_len;
}
if ($line_len != 9) {
$out .= "$line\n";
}
return $out;
}
while (<>)
{
chomp;
my $line = $_;
if ($line =~ m#^\* (.*)#) {
$line = $1;
} else {
next;
}
$line =~ s#<#<#g;
$line =~ s#>#>#g;
$line =~ s# # #g;
$line =~ s#"#"#g;
$line =~ s#\{\{Plugin\|([^}]+)\}\}#$1 plugin#g;
$line =~ s@\{\{Issue\|([^}]+)\}\}@#$1@g;
$line =~ s#\[\[[^|\]]+\|([^\]]+)\]\]#$1#g;
$line =~ s#\[\[([^|\]]+)\]\]#$1#g;
$line =~ s#'''(.*?)'''#*$1*#g;
$line =~ s#''(.*?)''#$1#g;
$line =~ s#<code>(.*?)</code>#"$1"#gi;
print format_entry($line);
}