[latex3-commits] [git/LaTeX3-latex3-l3build] master: Add docinit_hook() (bf9a7be)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Oct 2 10:53:59 CEST 2019


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

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

commit bf9a7be2dded8ef26be6b2b4e6e2c9309a25f0af
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed Oct 2 09:53:59 2019 +0100

    Add docinit_hook()
    
    Also splits docinit() out of doc().


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

bf9a7be2dded8ef26be6b2b4e6e2c9309a25f0af
 CHANGELOG.md            |  4 ++++
 l3build-typesetting.lua | 14 +++++++++++---
 l3build.dtx             |  5 +++++
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 39b7665..4864943 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Added
+
+- `docinit_hook()`
+
 ### Changed
 
 - Normalise out file paths in all cases
diff --git a/l3build-typesetting.lua b/l3build-typesetting.lua
index 7f588a7..fe6a6a5 100644
--- a/l3build-typesetting.lua
+++ b/l3build-typesetting.lua
@@ -174,9 +174,7 @@ typeset_demo_tasks = typeset_demo_tasks or function()
   return 0
 end
 
--- Typeset all required documents
--- Uses a set of dedicated auxiliaries that need to be available to others
-function doc(files)
+local function docinit()
   -- Set up
   cleandir(typesetdir)
   for _,filetype in pairs(
@@ -199,6 +197,16 @@ function doc(files)
   if errorlevel ~= 0 then
     return errorlevel
   end
+  return docinit_hook()
+end
+
+docinit_hook = docinit_hook or function() return 0 end
+
+-- Typeset all required documents
+-- Uses a set of dedicated auxiliaries that need to be available to others
+function doc(files)
+  local errorlevel = docinit()
+  if errorlevel ~= 0 then return errorlevel end
   local done = {}
   for _,typesetfiles in ipairs({typesetdemofiles,typesetfiles}) do
     for _,glob in pairs(typesetfiles) do
diff --git a/l3build.dtx b/l3build.dtx
index 5c1f0db..2160dd6 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -1382,6 +1382,11 @@
 %   \label{fig:PDF}
 % \end{figure}
 %
+% \subsection{Pre-typesetting hook}
+%
+% To allow complex set up for typesetting, a hook |docinit_hook()| is available
+% to be executed once all standard set up is complete but before any typesetting
+% is run.
 %
 % \subsection{Automated upload to CTAN}
 % \label{sec:upload}





More information about the latex3-commits mailing list