[latex3-commits] [git/LaTeX3-latex3-latex3] master: Enable auto-copyright update (a7428a6)

Joseph Wright joseph.wright at morningstar2.co.uk
Sat Jan 12 16:50:21 CET 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/a7428a6544c229fc3cf4f8885508566ad149fa89

>---------------------------------------------------------------

commit a7428a6544c229fc3cf4f8885508566ad149fa89
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sat Jan 12 15:50:21 2019 +0000

    Enable auto-copyright update


>---------------------------------------------------------------

a7428a6544c229fc3cf4f8885508566ad149fa89
 build-config.lua   |   13 +++++++++++++
 l3kernel/build.lua |   13 +++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/build-config.lua b/build-config.lua
index 842083c..9c5e0ce 100644
--- a/build-config.lua
+++ b/build-config.lua
@@ -36,6 +36,19 @@ end
 function update_tag(file,content,tagname,tagdate)
   local iso = "%d%d%d%d%-%d%d%-%d%d"
   local url = "https://github.com/latex3/latex3/compare/"
+  if string.match(content,"Copyright%s*%(C%)%s*[%d%-,]+") then
+    local year = os.date("%Y")
+    content = string.gsub(content,
+      "Copyright%s*%(C%)%s*([%d%-,]+)",
+      "Copyright (C) %1," .. year)
+   content = string.gsub(content,year .. "," .. year,year)
+   content = string.gsub(content,
+     "%-" .. year - 1 .. "," .. year,
+     "-" .. year)
+   content = string.gsub(content,
+     year - 2 .. "," .. year - 1 .. "," .. year,
+     year - 2 .. "-" .. year)
+  end
   if string.match(file,"%.dtx$") then
     content = string.gsub(content,
       "\n\\ProvidesExpl" .. "(%w+ *{[^}]+} *){" .. iso .. "}",
diff --git a/l3kernel/build.lua b/l3kernel/build.lua
index cfb5c7c..a48d68f 100644
--- a/l3kernel/build.lua
+++ b/l3kernel/build.lua
@@ -49,6 +49,19 @@ dofile(maindir .. "/build-config.lua")
 function update_tag(file,content,tagname,tagdate)
   local iso = "%d%d%d%d%-%d%d%-%d%d"
   local url = "https://github.com/latex3/latex3/compare/"
+  if string.match(content,"Copyright%s*%(C%)%s*[%d%-,]+") then
+    local year = os.date("%Y")
+    content = string.gsub(content,
+      "Copyright%s*%(C%)%s*([%d%-,]+)",
+      "Copyright (C) %1," .. year)
+   content = string.gsub(content,year .. "," .. year,year)
+   content = string.gsub(content,
+     "%-" .. year - 1 .. "," .. year,
+     "-" .. year)
+   content = string.gsub(content,
+     year - 2 .. "," .. year - 1 .. "," .. year,
+     year - 2 .. "-" .. year)
+  end
   if string.match(file,"expl3%.dtx$") then
     content = string.gsub(content,
       "\n\\def\\ExplFileDate{" .. iso .. "}%%\n",





More information about the latex3-commits mailing list