[latex3-commits] [l3svn] 04/04: l3build: Document basename() and jobname()

noreply at latex-project.org noreply at latex-project.org
Sun May 28 08:06:57 CEST 2017


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

commit fec7f3a9dcc71acfa4bdd576349d8fe8301031aa
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun May 28 07:05:11 2017 +0100

    l3build: Document basename() and jobname()
    
    Here, jobname() works a bit better than stripext() as we have
    basename() anyway (cf. shell function of same name).
---
 l3build/l3build.dtx |   21 +++++++++++++++++++--
 l3build/l3build.lua |   20 ++++++++++----------
 l3kernel/build.lua  |    2 +-
 3 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/l3build/l3build.dtx b/l3build/l3build.dtx
index 960cc77..7bb2df6 100644
--- a/l3build/l3build.dtx
+++ b/l3build/l3build.dtx
@@ -1086,7 +1086,7 @@
 %     module = "mymodule"
 %
 %     function typeset(file)
-%       local name = stripext(basename(file))
+%       local name = jobname(file)
 %       local errorlevel = tex (file)
 %       if errorlevel == 0 then
 %         -- Return a non-zero errorlevel if anything goes wrong
@@ -1157,6 +1157,14 @@
 %   \meta{target} directory.
 % \end{function}
 %
+% \begin{function}{basename()}
+%   \begin{syntax}
+%     |basename(|\meta{file}|)|
+%   \end{syntax}
+%   Returns a string comprising the full name of the file with the
+%   path removed (\emph{i.e.}~from the last |/| onward).
+% \end{function}
+%
 % \begin{function}{cleandir()}
 %   \begin{syntax}
 %     |cleandir(|\meta{dir}|)|
@@ -1195,7 +1203,16 @@
 %   all files in the \meta{path}.
 % \end{function}
 %
-% \begin{function}{mkidr()}
+% \begin{function}{jobname()}
+%   \begin{syntax}
+%     |jobname(|\meta{file}|)|
+%   \end{syntax}
+%   Returns a string comprising the jobname of the file with the
+%   path and extension removed (\emph{i.e.}~from the last |/| up to the
+%   last |.|).
+% \end{function}
+%
+% \begin{function}{mkdir()}
 %   \begin{syntax}
 %     |mkdir(|\meta{dir}|)|
 %   \end{syntax}
diff --git a/l3build/l3build.lua b/l3build/l3build.lua
index 7e5f10a..037ba92 100644
--- a/l3build/l3build.lua
+++ b/l3build/l3build.lua
@@ -1352,7 +1352,7 @@ function runtest(name, engine, hide, ext, makepdf)
         .. checkopts .. " " .. asciiopt .. lvtfile
         .. (hide and (" > " .. os_null) or "")
         .. os_concat ..
-      runtest_tasks(stripext(lvtfile))
+      runtest_tasks(jobname(lvtfile))
     )
   end
   if makepdf and fileexists(testdir .. "/" .. name .. dviext) then
@@ -1409,8 +1409,8 @@ function basename(file)
 end
 
 -- Strip the extension from a file name (if present)
-function stripext(file)
-  local name = match(file, "^(.*)%.")
+function jobname(file)
+  local name = match(basename(file), "^(.*)%.")
   return name or file
 end
 
@@ -1506,7 +1506,7 @@ function tex(file)
 end
 
 function typesetpdf(file)
-  local name = stripext(basename(file))
+  local name = jobname(file)
   print("Typesetting " .. name)
   local errorlevel = typeset(file)
   if errorlevel == 0 then
@@ -1523,7 +1523,7 @@ typeset = typeset or function(file)
   if errorlevel ~= 0 then
     return errorlevel
   else
-    local name = stripext(basename(file))
+    local name = jobname(file)
     errorlevel = biber(name) + bibtex(name)
     if errorlevel == 0 then
       local function cycle(name)
@@ -1590,14 +1590,14 @@ function check(names)
     -- No names passed: find all test files
     if not next(names) then
       for _,i in pairs(filelist(testfiledir, "*" .. lvtext)) do
-        insert(names, stripext(i))
+        insert(names, jobname(i))
       end
       for _,i in ipairs(filelist(unpackdir, "*" .. lvtext)) do
         if fileexists(testfiledir .. "/" .. i) then
           print("Duplicate test file: " .. i)
           return 1
         else
-          insert(names, stripext(i))
+          insert(names, jobname(i))
         end
       end
     end
@@ -1701,7 +1701,7 @@ function cmdcheck()
   print("Checking source files")
   for _,i in ipairs(cmdchkfiles) do
     for _,j in ipairs(filelist(".", i)) do
-      print("  " .. stripext(j))
+      print("  " .. jobname(j))
       run(
         testdir,
         os_setenv .. " TEXINPUTS=." .. os_pathsep .. localdir
@@ -1711,7 +1711,7 @@ function cmdcheck()
           " \"\\PassOptionsToClass{check}{l3doc} \\input " .. j .. "\""
           .. " > " .. os_null
       )
-      for line in lines(testdir .. "/" .. stripext(j) .. ".cmds") do
+      for line in lines(testdir .. "/" .. jobname(j) .. ".cmds") do
         if match(line, "^%!") then
           print("   - " .. match(line, "^%! (.*)"))
         end
@@ -1870,7 +1870,7 @@ function doc(files)
           if files and next(files) then
             typeset = false
             for _,k in ipairs(files) do
-              if k == stripext(j) then
+              if k == jobname(j) then
                 typeset = true
                 break
               end
diff --git a/l3kernel/build.lua b/l3kernel/build.lua
index 26ffa1a..99ed35a 100644
--- a/l3kernel/build.lua
+++ b/l3kernel/build.lua
@@ -124,7 +124,7 @@ function typeset(file)
   if errorlevel ~= 0 then
     return errorlevel
   else
-    local name = stripext(basename(file))
+    local name = jobname(file)
     errorlevel = biber(name) + bibtex(name)
     if errorlevel == 0 then
       local function cycle(name)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list