From ec625156dd4a1a11b0d0fcdce48a1397b1c73e22 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 13 Feb 2024 23:52:29 +0000 Subject: gitinfo-lua (14feb24) git-svn-id: svn://tug.org/texlive/trunk@69844 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/scripts/gitinfo-lua/gitinfo-lua.lua | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'Master/texmf-dist/scripts') diff --git a/Master/texmf-dist/scripts/gitinfo-lua/gitinfo-lua.lua b/Master/texmf-dist/scripts/gitinfo-lua/gitinfo-lua.lua index 4cb0f0f467b..a1c2a6988b1 100644 --- a/Master/texmf-dist/scripts/gitinfo-lua/gitinfo-lua.lua +++ b/Master/texmf-dist/scripts/gitinfo-lua/gitinfo-lua.lua @@ -23,9 +23,10 @@ end local module = { name = 'gitinfo-lua', info = { - version = 1.0, + version = '1.0.1', --TAGVERSION + date = '2024/02/12', --TAGDATE comment = "Git info Lua — Git integration with LaTeX", - author = "Erik Nijenhuis", + author = "Erik Nijenhuis", license = "free" } } @@ -43,8 +44,8 @@ local api = { ['_'] = '\\_', ['{'] = '\\{', ['}'] = '\\}', - ['~'] = '\\textasciitilde', - ['%^'] = '\\textasciicircum' + ['~'] = '\\textasciitilde ', + ['%^'] = '\\textasciicircum ' } } local mt = { @@ -55,11 +56,11 @@ local gitinfo = {} setmetatable(gitinfo, mt) function api.trim(s) - return (s:gsub("^%s*(.-)%s*$", "%1")) + return s and (s:gsub("^%s*(.-)%s*$", "%1")) or 'nil' end function api:set_date() - local date, err = self.cmd:log('cs', '-1', {'max-count=1'}) + local date, err = self.cmd:log('cs', '-1', { 'max-count=1' }) if date and #date == 1 then local _, _, year, month, day = date[1][1]:find('(%d+)[-/](%d+)[-/](%d+)') tex.year = tonumber(year) @@ -71,7 +72,7 @@ function api:set_date() end function api:escape_str(value) - local buf = string.gsub(value, '\\', '\\textbackslash') + local buf = string.gsub(value, '\\', '\\textbackslash ') for search, replace in pairs(self.escape_chars) do buf = string.gsub(buf, search, replace) end @@ -223,7 +224,7 @@ end function api:cs_commit(csname, rev, format) if token.is_defined(csname) then local tok = token.create(csname) - local log, err = self.cmd:log(format, rev, {'max-count=1'}) + local log, err = self.cmd:log(format, rev, { 'max-count=1' }) if log then if #log == 1 then tex.print(tok) @@ -266,7 +267,7 @@ end function api:tag_info(format_spec, tag, target_dir) local err, info - info, err = self.cmd:for_each_ref(format_spec, 'refs/tags', {'count=1', 'contains=' .. tag}, target_dir) + info, err = self.cmd:for_each_ref(format_spec, 'refs/tags', { 'count=1', 'contains=' .. tag }, target_dir) if info and #info == 1 then return info[1] else @@ -305,7 +306,7 @@ end function api:cs_for_tag(csname, format_spec, target_dir) if token.is_defined(csname) then local tok = token.create(csname) - local tags, err = self.cmd:for_each_ref(format_spec, 'refs/tags', {'sort=-authordate'}, target_dir) + local tags, err = self.cmd:for_each_ref(format_spec, 'refs/tags', { 'sort=-authordate' }, target_dir) if tags then for _, info in ipairs(tags) do tex.print(tok) -- cgit v1.2.3