]> Savannah Git Hosting - gnulib.git/commitdiff
update-copyright: use en dashes in .texi ranges * build-aux/update-copyright: Update...
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 14 Oct 2019 20:36:44 +0000 (13:36 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 14 Oct 2019 20:37:43 +0000 (13:37 -0700)
ChangeLog
build-aux/update-copyright

index ae7adbbd52d8e4aab79470ca8e7acc80e9f1c4fb..db63a4be070b06290fbc4c80887f9398a3218075 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,10 @@
 2019-10-14  Paul Eggert  <eggert@cs.ucla.edu>
 
-       update-copyright: allow en dashes in year ranges
+       update-copyright: use en dashes in .texi ranges
        * build-aux/update-copyright: Match year ranges like "1998--2019",
-       which are used in the Autoconf manual.
+       which are used in the Autoconf manual.  Also, update ranges in
+       .tex, .texi, and .texinfo files to use en dashes instead of
+       hyphens.
 
 2019-10-13  Paul Eggert  <eggert@cs.ucla.edu>
 
index 89ca9bac9650ad8c2d595be28add125459166c3b..e4809f620d632bcf6d02f03a6c1fade5ad73b2a7 100755 (executable)
@@ -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.