]> Savannah Git Hosting - gnulib.git/commitdiff
Update \(en in copyright notices
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 18 Jun 2023 07:27:52 +0000 (00:27 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 18 Jun 2023 07:28:35 +0000 (00:28 -0700)
* build-aux/update-copyright (ndash_re): New var, matching \(en too.
(stmt_remainder_re, stmt): Use it.
(stmt): Match year in constructs like "\(en2023".
(ndash): Now \(en in man pages.

ChangeLog
build-aux/update-copyright

index 381c5037e357c70eaf15d8dd548eb3a839184e06..dece396c4aa48e330efa507e76b0cab191c6df06 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-06-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Update \(en in copyright notices
+       * build-aux/update-copyright (ndash_re): New var, matching \(en too.
+       (stmt_remainder_re, stmt): Use it.
+       (stmt): Match year in constructs like "\(en2023".
+       (ndash): Now \(en in man pages.
+
 2023-06-17  Bruno Haible  <bruno@clisp.org>
 
        gettext: Update to gettext 0.22.
index 99196fceef64172e40cde577386cfc12a16890ee..0343eaa72c134009ef2985db86b42b6792a84852 100755 (executable)
@@ -98,7 +98,8 @@
 #   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 "--".  Whitespace may appear after commas.
+#      commas, "-", "--", or "\(en" (for troff).  Whitespace may appear
+#      after commas.
 #
 # Environment variables:
 #
 eval 'exec perl -wSx -0777 -pi "$0" "$@"'
      if 0;
 
-my $VERSION = '2023-01-11.04:24'; # UTC
+my $VERSION = '2023-06-18.01:14'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
@@ -148,6 +149,7 @@ use warnings;
 
 my $copyright_re = 'Copyright';
 my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|&copy;|©)';
+my $ndash_re = '(?:--?|\\\\\(en)';
 my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
 $holder ||= 'Free Software Foundation, Inc.';
 my $prefix_max = 5;
@@ -192,7 +194,7 @@ while (/(^|\n)(.{0,$prefix_max})$copyright_re/g)
     $holder_re =~ s/\s/$ws_re/g;
     my $stmt_remainder_re =
       "(?:$ws_re$circle_c_re)?"
-      . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|--?))*"
+      . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|$ndash_re))*"
       . "((?:\\d\\d)?\\d\\d)$ws_re$holder_re";
     if (/\G$stmt_remainder_re/)
       {
@@ -215,7 +217,7 @@ if (defined $stmt_re)
     if ($final_year != $this_year)
       {
         # Update the year.
-        $stmt =~ s/\b$final_year_orig\b/$final_year, $this_year/;
+        $stmt =~ s/(^|[^\d])$final_year_orig\b/$1$final_year, $this_year/;
       }
     if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'})
       {
@@ -231,17 +233,19 @@ 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})$ndash_re(\d{4})/join(', ', $1..$2)/eg;
           }
         else
           {
-            my $ndash = $ARGV =~ /\.tex(i(nfo)?)?$/ ? "--" : "-";
+            my $ndash = ($ARGV =~ /\.tex(i(nfo)?)?$/ ? "--"
+                         : $ARGV =~ /\.(\d[a-z]*|man)$/ ? "\\(en"
+                         : "-");
 
             $stmt =~
               s/
                 (\d{4})
                 (?:
-                  (,\ |--?)
+                  (,\ |$ndash_re)
                   ((??{
                     if   ($2 ne ', ') { '\d{4}'; }
                     elsif (!$3)       { $1 + 1;  }
@@ -252,7 +256,7 @@ if (defined $stmt_re)
 
             # 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$ndash$2/;
+              and $stmt =~ s/(^|[^\d])(\d{4})\b.*(?:[^\d])(\d{4})\b/$1$2$ndash$3/;
           }
 
         # Format within margin.