about summary refs log tree commit homepage
path: root/Documentation/update-footer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/update-footer.rb')
-rwxr-xr-xDocumentation/update-footer.rb24
1 files changed, 14 insertions, 10 deletions
diff --git a/Documentation/update-footer.rb b/Documentation/update-footer.rb
index a6e16cb..dfc1b1a 100755
--- a/Documentation/update-footer.rb
+++ b/Documentation/update-footer.rb
@@ -3,22 +3,26 @@
 # License: GPL-3.0+ <http://www.gnu.org/licenses/gpl-3.0.txt>
 # frozen_string_literal: true
 contact = %q{
-All feedback welcome via plain-text mail to: <dtas-all@nongnu.org>\
-Mailing list archives available at <http://80x24.org/dtas-all/> and
-<ftp://lists.gnu.org/dtas-all/>\
+All feedback welcome via plain-text mail to: L<mailto:dtas-all@nongnu.org>
+
+Mailing list archives available at L<http://80x24.org/dtas-all/>
+and L<ftp://lists.gnu.org/dtas-all/>
+
 No subscription is necessary to post to the mailing list.
 }
 
 copyright = %q{
-Copyright %s all contributors <dtas-all@nongnu.org>.\
-License: GPL-3.0+ <http://www.gnu.org/licenses/gpl-3.0.txt>
+Copyright %s all contributors L<mailto:dtas-all@nongnu.org>
+
+License: GPL-3.0+ L<http://www.gnu.org/licenses/gpl-3.0.txt>
 }
 
 ENV['TZ'] = 'UTC'
 now_year = Time.now.strftime("%Y")
 ARGV.each do |file|
-  cmd = %W(git log --reverse --pretty=format:%ad --date=short -- #{file})
-  beg_year = IO.popen(cmd, &:gets).split('-')[0]
+  cmd = %W(git log --follow -M1 --pretty=format:%ad --date=short
+           -- #{file})
+  beg_year = IO.popen(cmd, &:read).split("\n")[-1].split('-')[0]
   years = beg_year == now_year ? beg_year : "#{beg_year}-#{now_year}"
 
   File.open(file, "r+") do |fp|
@@ -27,7 +31,7 @@ ARGV.each do |file|
     sec = { state => ''.dup }
     fp.each_line do |l|
       case l
-      when /^(#.+)$/
+      when /^(=head.+)$/
         state = $1.freeze
         sections << state
         sec[state] = ''.dup
@@ -38,8 +42,8 @@ ARGV.each do |file|
 
     fp.truncate(0)
     fp.rewind
-    sec["# CONTACT"] = contact
-    sec["# COPYRIGHT"] = sprintf(copyright, years)
+    sec["=head1 CONTACT"] = contact
+    sec["=head1 COPYRIGHT"] = sprintf(copyright, years)
     while section = sections.shift
       fp.puts(section) if String === section
       blob = sec[section].sub(/\A\n+/, '').sub(/\n+\z/, '')