From 7ffcd74e28371f604b1d3b1cd7bda249d39c277e Mon Sep 17 00:00:00 2001 From: Joseph Wright Date: Fri, 5 Feb 2021 17:17:06 +0000 Subject: [PATCH] Drop "or function" set ups --- l3build-check.lua | 6 +++--- l3build-manifest-setup.lua | 18 +++++++++--------- l3build-manifest.lua | 3 +-- l3build-tagging.lua | 3 +-- l3build-typesetting.lua | 7 +++---- l3build-unpack.lua | 2 +- 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/l3build-check.lua b/l3build-check.lua index 10532802..e0194504 100644 --- a/l3build-check.lua +++ b/l3build-check.lua @@ -85,7 +85,7 @@ function checkinit() return checkinit_hook() end -checkinit_hook = checkinit_hook or function() return 0 end +function checkinit_hook() return 0 end local function rewrite(source,result,processor,...) local file = assert(open(source,"rb")) @@ -545,7 +545,7 @@ local function normalize_pdf(content) stream = true stream_content = "stream" .. os_newline elseif not match(line, "^ *$") and - not match(line,"^%%%%Invocation") and + not match(line,"^%%%%Invocation") and not match(line,"^%%%%%+") then line = gsub(line,"%/ID( ?)%[<[^>]+><[^>]+>]","/ID%1[]") new_content = new_content .. line .. os_newline @@ -825,7 +825,7 @@ function runtest(name, engine, hide, ext, pdfmode, breakout) end -- A hook to allow additional tasks to run for the tests -runtest_tasks = runtest_tasks or function(name,run) +function runtest_tasks(name,run) return "" end diff --git a/l3build-manifest-setup.lua b/l3build-manifest-setup.lua index e00f48ff..67836de5 100644 --- a/l3build-manifest-setup.lua +++ b/l3build-manifest-setup.lua @@ -54,7 +54,7 @@ for those people who are interested. --]] -manifest_setup = manifest_setup or function() +function manifest_setup() local groups = { { subheading = "Repository manifest", @@ -220,13 +220,13 @@ end --------------------- --]] -manifest_sort_within_match = manifest_sort_within_match or function(files) +function manifest_sort_within_match(files) local f = files table.sort(f) return f end -manifest_sort_within_group = manifest_sort_within_group or function(files) +function manifest_sort_within_group(files) local f = files --[[ -- no-op by default; make your own definition to customise. E.g.: @@ -240,7 +240,7 @@ end --------------- --]] -manifest_write_opening = manifest_write_opening or function(filehandle) +function manifest_write_opening(filehandle) filehandle:write("# Manifest for " .. module .. "\n\n") filehandle:write([[ @@ -250,7 +250,7 @@ It is automatically generated with `texlua build.lua manifest`. end -manifest_write_subheading = manifest_write_subheading or function(filehandle,heading,description) +functiom manifest_write_subheading(filehandle,heading,description) filehandle:write("\n\n## " .. heading .. "\n\n") @@ -260,7 +260,7 @@ manifest_write_subheading = manifest_write_subheading or function(filehandle,hea end -manifest_write_group_heading = manifest_write_group_heading or function (filehandle,heading,description) +function manifest_write_group_heading(filehandle,heading,description) filehandle:write("\n### " .. heading .. "\n\n") @@ -270,7 +270,7 @@ manifest_write_group_heading = manifest_write_group_heading or function (filehan end -manifest_write_group_file = manifest_write_group_file or function(filehandle,filename,param) +function manifest_write_group_file(filehandle,filename,param) --[[ filehandle : write file object filename : the count of the filename to be written @@ -296,7 +296,7 @@ manifest_write_group_file = manifest_write_group_file or function(filehandle,fil end -manifest_write_group_file_descr = manifest_write_group_file_descr or function(filehandle,filename,descr,param) +function manifest_write_group_file_descr(filehandle,filename,descr,param) --[[ filehandle : write file object filename : the name of the file to write @@ -326,7 +326,7 @@ end ------------------------------------------- --]] -manifest_extract_filedesc = manifest_extract_filedesc or function(filehandle) +function manifest_extract_filedesc(filehandle) -- no-op by default; two examples below diff --git a/l3build-manifest.lua b/l3build-manifest.lua index 7ddceb27..f9b1c4e8 100644 --- a/l3build-manifest.lua +++ b/l3build-manifest.lua @@ -33,7 +33,7 @@ for those people who are interested. `l3build-manifest-setup.lua`. --]] -manifest = manifest or function() +function manifest() -- build list of ctan files ctanfiles = {} @@ -277,4 +277,3 @@ manifest_write_group = function(f,entry) end end - diff --git a/l3build-tagging.lua b/l3build-tagging.lua index aa84b0d5..d75a3eb1 100644 --- a/l3build-tagging.lua +++ b/l3build-tagging.lua @@ -28,7 +28,7 @@ local os_date = os.date local match = string.match local gsub = string.gsub -update_tag = update_tag or function(filename,content,tagname,tagdate) +function update_tag(filename,content,tagname,tagdate) return content end @@ -81,4 +81,3 @@ function tag(tagnames) end return tag_hook(tagname,tagdate) end - diff --git a/l3build-typesetting.lua b/l3build-typesetting.lua index 7701f882..8d14e9cd 100644 --- a/l3build-typesetting.lua +++ b/l3build-typesetting.lua @@ -146,7 +146,7 @@ local function typesetpdf(file,dir) return cp(pdfname,dir,docfiledir) end -typeset = typeset or function(file,dir,exe) +function typeset(file,dir,exe) dir = dir or "." local errorlevel = tex(file,dir,exe) if errorlevel ~= 0 then @@ -168,7 +168,7 @@ typeset = typeset or function(file,dir,exe) end -- A hook to allow additional typesetting of demos -typeset_demo_tasks = typeset_demo_tasks or function() +function typeset_demo_tasks() return 0 end @@ -198,7 +198,7 @@ local function docinit() return docinit_hook() end -docinit_hook = docinit_hook or function() return 0 end +function docinit_hook() return 0 end -- Typeset all required documents -- Uses a set of dedicated auxiliaries that need to be available to others @@ -240,4 +240,3 @@ function doc(files) end return 0 end - diff --git a/l3build-unpack.lua b/l3build-unpack.lua index d5c8e301..a117f64e 100644 --- a/l3build-unpack.lua +++ b/l3build-unpack.lua @@ -46,7 +46,7 @@ end -- Split off from the main unpack so it can be used on a bundle and not -- leave only one modules files -bundleunpack = bundleunpack or function(sourcedirs, sources) +function bundleunpack(sourcedirs, sources) local errorlevel = mkdir(localdir) if errorlevel ~=0 then return errorlevel