[latex3-commits] [git/LaTeX3-latex3-latex3] master: Enable auto-editing of CHANGELOG.md files (46454da)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Sep 24 00:09:05 CEST 2018


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

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

commit 46454da520abb5c7947df639c5c62dd39c7ef50b
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun Sep 23 22:59:53 2018 +0100

    Enable auto-editing of CHANGELOG.md files


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

46454da520abb5c7947df639c5c62dd39c7ef50b
 build-config.lua |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/build-config.lua b/build-config.lua
index 6025722..842083c 100644
--- a/build-config.lua
+++ b/build-config.lua
@@ -17,7 +17,7 @@ checksuppfiles  = checksuppfiles  or
     "SpecialCasing.txt",
     "UnicodeData.txt",
   }
-tagfiles = tagfiles or {"*.dtx", "README.md"}
+tagfiles = tagfiles or {"*.dtx", "README.md", "CHANGELOG.md"}
 unpacksuppfiles = unpacksuppfiles or {"docstrip.tex"}
 
 
@@ -35,6 +35,7 @@ end
 -- 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/latex3/compare/"
   if string.match(file,"%.dtx$") then
     content = string.gsub(content,
       "\n\\ProvidesExpl" .. "(%w+ *{[^}]+} *){" .. iso .. "}",
@@ -42,7 +43,18 @@ function update_tag(file,content,tagname,tagdate)
     return string.gsub(content,
       "\n%% \\date{Released " .. iso .. "}\n",
       "\n%% \\date{Released " .. tagname .. "}\n")
-  elseif string.match(file,"%.md$") then
+  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")





More information about the latex3-commits mailing list