[latex3-commits] [git/LaTeX3-latex3-l3build] master: Enable tagging of CHANGELOG.md (03dde28)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Sep 21 13:54:23 CEST 2018


Repository : https://github.com/latex3/l3build
On branch  : master
Link       : https://github.com/latex3/l3build/commit/03dde28d55b95d01170e46b56bff2e39b7e54a10

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

commit 03dde28d55b95d01170e46b56bff2e39b7e54a10
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Sep 21 12:51:44 2018 +0100

    Enable tagging of CHANGELOG.md


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

03dde28d55b95d01170e46b56bff2e39b7e54a10
 build.lua |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/build.lua b/build.lua
index 8f9e639..bc0075e 100644
--- a/build.lua
+++ b/build.lua
@@ -23,6 +23,7 @@ tagfiles     = {"l3build.1", "l3build.dtx", "*.md", "l3build.lua"}
 -- Detail how to set the version automatically
 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/"
   if string.match(file, "%.1$") then
     return string.gsub(content,
       '%.TH l3build 1 "' .. iso .. '"\n',
@@ -32,6 +33,16 @@ function update_tag(file,content,tagname,tagdate)
       "\n%% \\date{Released " .. iso .. "}\n",
       "\n%% \\date{Released " .. tagname .. "}\n")
   elseif string.match(file, "%.md$") then
+    if string.match(file,"CHANGELOG.md") then
+      content = string.gsub(content,
+        "## %[Unreleased%]",
+        "## [Unreleased]\n\n## [" .. tagname .."]")
+      local previous = string.match(content,"compare/(" .. iso .. ")%.%.%.HEAD")
+      return string.gsub(content,
+        iso .. "%.%.%.HEAD",
+        tagname .. "...HEAD\n[" .. tagname .. "]: " .. url .. previous
+          .. "..." .. tagname)
+    end
     return string.gsub(content,
       "\nRelease " .. iso .. "\n",
       "\nRelease " .. tagname .. "\n")





More information about the latex3-commits mailing list