2018-02-05 13:38:02 +01:00
|
|
|
#!/usr/bin/env perl
|
2016-02-24 21:15:34 +01:00
|
|
|
# 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/;
|
2016-02-25 12:11:53 +01:00
|
|
|
use HTML::Entities qw/decode_entities/;
|
2016-02-24 21:15:34 +01:00
|
|
|
|
2018-11-01 12:34:43 +01:00
|
|
|
pod2usage(1) if @ARGV!=2;
|
2016-02-24 21:15:34 +01:00
|
|
|
|
2018-11-01 12:34:43 +01:00
|
|
|
my ($version,$releasename) = @ARGV;
|
2016-02-24 21:15:34 +01:00
|
|
|
|
|
|
|
my ($news,$tempfile) = tempfile();
|
|
|
|
|
2020-06-10 02:00:22 +02:00
|
|
|
open my $in, "NEWS.md";
|
2016-02-24 21:15:34 +01:00
|
|
|
while(<$in>) {
|
|
|
|
print $news $_;
|
2020-06-10 02:00:22 +02:00
|
|
|
last if /^Change history for the QGIS Project/;
|
2016-02-24 21:15:34 +01:00
|
|
|
}
|
|
|
|
|
2020-02-21 13:21:48 +01:00
|
|
|
my $content = `curl -A Mozilla -s https://changelog.qgis.org/en/qgis/version/$version/gnu/`;
|
2016-02-24 21:15:34 +01:00
|
|
|
die "Couldn't get it!" unless defined $content;
|
|
|
|
|
2020-06-10 02:00:22 +02:00
|
|
|
print $news "\n# What's new in Version $version '$releasename'?\n\n";
|
2016-02-24 21:15:34 +01:00
|
|
|
print $news "This release has following new features:\n\n";
|
|
|
|
|
2018-11-01 12:34:43 +01:00
|
|
|
die "Invalid changelog" unless $content =~ /^Changelog for QGIS/;
|
|
|
|
|
2016-02-24 21:15:34 +01:00
|
|
|
for $_ (split /\n/, $content) {
|
|
|
|
next if /^Changelog /;
|
|
|
|
next if /^------/;
|
|
|
|
next if /^\s*$/;
|
|
|
|
|
2016-02-25 12:11:53 +01:00
|
|
|
$_ = decode_entities($_);
|
|
|
|
|
2016-02-24 21:15:34 +01:00
|
|
|
s/^\*\s+/- /;
|
|
|
|
s/ : /: /;
|
|
|
|
s/\s+$//;
|
|
|
|
|
|
|
|
print $news "$_\n";
|
|
|
|
}
|
|
|
|
|
2016-02-24 21:33:35 +01:00
|
|
|
print $news "-\n\n";
|
2016-02-24 21:15:34 +01:00
|
|
|
|
|
|
|
while(<$in>) {
|
|
|
|
print $news $_;
|
|
|
|
}
|
|
|
|
|
|
|
|
close $news;
|
|
|
|
close $in;
|
|
|
|
|
2021-03-23 15:11:31 +01:00
|
|
|
copy($tempfile, "NEWS.md");
|
2016-02-24 21:15:34 +01:00
|
|
|
|
2020-06-10 02:00:22 +02:00
|
|
|
system "pandoc --table-of-contents --toc-depth=1 -s -o doc/NEWS.html NEWS.md --metadata title=\"QGIS News\"";
|
2016-02-24 21:15:34 +01:00
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2020-04-14 09:39:56 +10:00
|
|
|
update_news.pl - updates the news file from changelog.qgis.org
|
2016-02-24 21:15:34 +01:00
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
2020-04-14 09:39:56 +10:00
|
|
|
update_news.pl version releasename
|
2016-02-24 21:15:34 +01:00
|
|
|
|
|
|
|
=cut
|