[latex3-commits] [latex3/latex3] main: Avoid code duplicate in tagging routine (ecccd76a5)

github at latex-project.org github at latex-project.org
Mon Dec 11 07:39:29 CET 2023


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/ecccd76a5d5e965bc7a428d2e6c72873724070ae

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

commit ecccd76a5d5e965bc7a428d2e6c72873724070ae
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Dec 11 06:39:29 2023 +0000

    Avoid code duplicate in tagging routine
    
    By adding a hook, we can cover the extra for l3kernel without copy-pasting the entire block.


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

ecccd76a5d5e965bc7a428d2e6c72873724070ae
 build-config.lua   |  5 +++++
 l3kernel/build.lua | 42 ++----------------------------------------
 2 files changed, 7 insertions(+), 40 deletions(-)

diff --git a/build-config.lua b/build-config.lua
index 6b4576fa1..531cbf81c 100644
--- a/build-config.lua
+++ b/build-config.lua
@@ -44,6 +44,7 @@ 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/"
+  content =  update_tag_extra(file,content,tagname,tagdate)
   if string.match(content,"%(C%)%s*[%d%-,]+ The LaTeX Project") then
     local year = os.date("%Y")
     content = string.gsub(content,
@@ -83,6 +84,10 @@ function update_tag(file,content,tagname,tagdate)
   return content
 end
 
+function update_tag_extra(file,content,tagname,tagdate)
+  return(content)
+end
+
 -- Need to build format files
 local function fmt(engines,dest)
   local function mkfmt(engine)
diff --git a/l3kernel/build.lua b/l3kernel/build.lua
index 024abd70a..c8348c3f0 100644
--- a/l3kernel/build.lua
+++ b/l3kernel/build.lua
@@ -51,52 +51,14 @@ typesetdeps = typesetdeps
 dofile(maindir .. "/build-config.lua")
 
 -- Detail how to set the version automatically
-function update_tag(file,content,tagname,tagdate)
+function update_tag_extra(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,"%(C%)%s*[%d%-,]+ The LaTeX Project") then
-    local year = os.date("%Y")
-    content = string.gsub(content,
-      "%(C%)%s*([%d%-,]+) The LaTeX Project",
-      "(C) %1," .. year .. " The LaTeX Project")
-   content = string.gsub(content,year .. "," .. year,year)
-   content = string.gsub(content,
-     "%-" .. tonumber(year) - 1 .. "," .. year,
-     "-" .. year)
-   content = string.gsub(content,
-     tonumber(year) - 2 .. "," .. tonumber(year) - 1 .. "," .. year,
-     tonumber(year) - 2 .. "-" .. year)
-  end
   if string.match(file,"expl3%.dtx$") then
     content = string.gsub(content,
       "\n\\def\\ExplFileDate{" .. iso .. "}%%\n",
       "\n\\def\\ExplFileDate{" .. tagname .. "}%%\n")
-  elseif string.match(file,"l3debug%.dtx$") then
-    content = string.gsub(content,
-      "\n\\ProvidesExplFile{l3debug%.def}{" .. iso .. "}",
-      "\n\\ProvidesExplFile{l3debug.def}{" .. tagname .. "}")
-  end
-  if string.match(file,"%.dtx$") or string.match(file,"%.tex$") then
-    return string.gsub(content,
-      "\n(%%*%s*)\\date{Released " .. iso .. "}\n",
-      "\n%1\\date{Released " .. tagname .. "}\n")
-  elseif string.match(file, "%.md$") then
-    if string.match(file,"CHANGELOG.md") then
-      local previous = string.match(content,"compare/(" .. iso .. ")%.%.%.HEAD")
-      if tagname == previous then return content end
-      content = string.gsub(content,
-        "## %[Unreleased%]",
-        "## [Unreleased]\n\n## [" .. tagname .."]")
-      return string.gsub(content,
-        iso .. "%.%.%.HEAD",
-        tagname .. "...HEAD\n[" .. tagname .. "]: " .. url .. previous
-          .. "..." .. tagname)
-    end
-    return string.gsub(content,
-      "\nRelease " .. iso .. "\n",
-      "\nRelease " .. tagname .. "\n")
   end
-  return content
+  return(content)
 end
 
 uploadconfig = {





More information about the latex3-commits mailing list.