[latex3-commits] [latex3/l3build] main: Simplify logic for updating copyright (5d99fcc)

github at latex-project.org github at latex-project.org
Mon Dec 18 09:20:50 CET 2023


Repository : https://github.com/latex3/l3build
On branch  : main
Link       : https://github.com/latex3/l3build/commit/5d99fccfc870d8052bdf5ab34da68189d34e4bd8

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

commit 5d99fccfc870d8052bdf5ab34da68189d34e4bd8
Author: Yukai Chou <muzimuzhi at gmail.com>
Date:   Fri Dec 15 05:55:09 2023 +0800

    Simplify logic for updating copyright


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

5d99fccfc870d8052bdf5ab34da68189d34e4bd8
 build.lua | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/build.lua b/build.lua
index 54efe26..18eaaf7 100644
--- a/build.lua
+++ b/build.lua
@@ -50,20 +50,17 @@ function update_tag(file,content,tagname,tagdate)
   local iso = "%d%d%d%d%-%d%d%-%d%d"
   local url = "https://github.com/latex3/l3build/compare/"
   -- update copyright
-  -- copied from https://github.com/latex3/latex3/blob/76104b03a42246726556384f2ca34083bc6955aa/build-config.lua#L48-L60
-  if string.match(content,"%(C%)%s*[%d%-,]+ The LaTeX Project") then
-    local year = os.date("%Y")
+  local year = os.date("%Y")
+  if string.match(content,"%(C%)%s*" .. (year - 1) .. " The LaTeX Project") then
     content = string.gsub(content,
-      "%(C%)%s*([%d%-,]+) The LaTeX Project",
-      "(C) %1," .. year .. " The LaTeX Project")
-    content = string.gsub(content,year .. "," .. year,year)
+      "%(C%)%s*" .. (year - 1) .. " The LaTeX Project",
+      "(C) " .. year .. " The LaTeX Project")
+  elseif string.match(content,"%(C%)%s*%d%d%d%d%-" .. (year - 1) .. " The LaTeX Project") then
     content = string.gsub(content,
-      "%-" .. math.tointeger(year - 1) .. "," .. year,
-      "-" .. year)
-    content = string.gsub(content,
-      math.tointeger(year - 2) .. "," .. math.tointeger(year - 1) .. "," .. year,
-      math.tointeger(year - 2) .. "-" .. year)
+      "%(C%)%s*(%d%d%d%d%-)" .. (year - 1) .. " The LaTeX Project",
+      "(C) %1" .. year .. " The LaTeX Project")
   end
+  -- update release date
   if string.match(file, "%.1$") then
     return string.gsub(content,
       '%.TH l3build 1 "' .. iso .. '"\n',





More information about the latex3-commits mailing list.