From 1ce2386b601b84285c423f1f9545bc2ed6dd420e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Oct 2019 13:36:44 -0700 Subject: update-copyright: use en dashes in .texi ranges * build-aux/update-copyright: Update ranges in .tex, .texi, and .texinfo files to use en dashes instead of hyphens. --- build-aux/update-copyright | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'build-aux/update-copyright') diff --git a/build-aux/update-copyright b/build-aux/update-copyright index 89ca9bac96..e4809f620d 100755 --- a/build-aux/update-copyright +++ b/build-aux/update-copyright @@ -98,7 +98,7 @@ # 6. Blank lines, even if preceded by the prefix, do not appear # within the FSF copyright statement. # 7. Each copyright year is 2 or 4 digits, and years are separated by -# commas or dashes. Whitespace may appear after commas. +# commas, "-", or "--". Whitespace may appear after commas. # # Environment variables: # @@ -231,26 +231,28 @@ if (defined $stmt_re) # Make the use of intervals consistent. if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS}) { - $stmt =~ s/(\d{4})-(\d{4})/join(', ', $1..$2)/eg; + $stmt =~ s/(\d{4})--?(\d{4})/join(', ', $1..$2)/eg; } else { + my $ndash = $ARGV =~ /\.tex(i(nfo)?)?$/ ? "--" : "-"; + $stmt =~ s/ (\d{4}) (?: - (,\ |-) + (,\ |--?) ((??{ - if ($2 eq '-') { '\d{4}'; } + if ($2 ne ', ') { '\d{4}'; } elsif (!$3) { $1 + 1; } else { $3 + 1; } })) )+ - /$1-$3/gx; + /$1$ndash$3/gx; # When it's 2, emit a single range encompassing all year numbers. $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2 - and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1-$2/; + and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1$ndash$2/; } # Format within margin. -- cgit v1.2.1