-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
update-news.pl
executable file
·73 lines (49 loc) · 1.52 KB
/
update-news.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
#!/usr/bin/perl
# updates the news file from changelog.qgis.org
# Copyright (C) 2016 Jürgen E. Fischer <jef@norbit.de>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
use strict;
use warnings;
use Pod::Usage;
use File::Temp qw/tempfile/;
use File::Copy qw/copy/;
use HTML::Entities qw/decode_entities/;
pod2usage(1) if @ARGV!=3;
my ($major,$minor,$releasename) = @ARGV;
my ($news,$tempfile) = tempfile();
open my $in, "doc/news.t2t";
while(<$in>) {
print $news $_;
last if /^Last Change/;
}
my $content = `curl -s http://changelog.qgis.org/en/qgis/version/$major.$minor.0/gnu/`;
die "Couldn't get it!" unless defined $content;
print $news "\n= What's new in Version $major.$minor '$releasename'? =\n\n";
print $news "This release has following new features:\n\n";
for $_ (split /\n/, $content) {
next if /^Changelog /;
next if /^------/;
next if /^\s*$/;
$_ = decode_entities($_);
s/^\*\s+/- /;
s/ : /: /;
s/\s+$//;
print $news "$_\n";
}
print $news "-\n\n";
while(<$in>) {
print $news $_;
}
close $news;
close $in;
copy($tempfile, "doc/news.t2t");
system "txt2tags --encoding=utf-8 -odoc/news.html -t html doc/news.t2t";
system "txt2tags --encoding=utf-8 -oNEWS -t txt doc/news.t2t";
=head1 NAME
update-news.pl - updates the news file from changelog.qgis.org
=head1 SYNOPSIS
update-news.pl major minor releasename
=cut