Skip to content

Commit

Permalink
Improve git-release-notes.pl to handle UTF8 and multiple langs in a c…
Browse files Browse the repository at this point in the history
…ommit.
  • Loading branch information
jralls committed Mar 27, 2021
1 parent df45762 commit ec94975
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions util/git-release-notes.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env perl
use 5.012;
use warnings;
use strict;

use Encode;
use Git;
use Cwd qq(getcwd);
use Text::Wrap;

binmode(STDOUT, ":utf8");

sub print_notes {
my $notes = shift;
Expand Down Expand Up @@ -76,7 +78,7 @@ sub html_format_other {
my ($revs, $c) = $repo->command_output_pipe('log', '--topo-order', '--format=%s<|>%b<|>%N<{}>', "$tag..HEAD");
my $item = "";
while(<$revs>) {
my $rev = $_;
my $rev = decode('UTF-8', $_);
chomp($rev);
$item .= ' ' if $item;
$item .= $rev;
Expand All @@ -88,9 +90,7 @@ sub html_format_other {
} elsif ($item =~ m/^[Ll]10[Nn]:([a-z]{2}(?:[-_][A-Z]{2})?)/) {
$l10n{$1}++ unless ($item =~ /glossary/i);
}elsif ($item =~ m/^Translation/) {
if ($item =~ m[GnuCash/Program \(([[:alpha:] ]+)\)]) {
$l10n{$1}++;
}
map { $l10n{$_}++ } $item =~ m/GnuCash\/Program \(([[:alpha:][:punct:][:space:]]+)\)/g;
} elsif ($item =~ m/^(?:Merge|[Ll]1[08][Nn]|[Ii]1[08][Nn])/) {
my ($sum, $desc, $notes) = split('\<\|\>', $item);
push @improves, $item if ($desc || $notes);
Expand Down

0 comments on commit ec94975

Please sign in to comment.