summaryrefslogtreecommitdiff
path: root/macros/luatex/latex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-04-04 03:02:05 +0000
committerNorbert Preining <norbert@preining.info>2024-04-04 03:02:05 +0000
commit00e667637a3a526b577b05c4d9fead45d65c4c57 (patch)
treec5488d29362ed4d6c10b2271fdf0b54676f18a1e /macros/luatex/latex
parente0bd7da7a67c4cd2c53d232fb0f5cfccc4c37743 (diff)
CTAN sync 202404040301
Diffstat (limited to 'macros/luatex/latex')
-rw-r--r--macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.pdfbin115812 -> 116004 bytes
-rw-r--r--macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.tex1
-rw-r--r--macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua-cmd.lua8
-rw-r--r--macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua-recorder.lua79
-rw-r--r--macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua.lua60
-rw-r--r--macros/luatex/latex/gitinfo-lua/tex/gitinfo-lua.sty6
-rw-r--r--macros/luatex/latex/lua-placeholders/README.md1
-rw-r--r--macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.pdfbin66376 -> 66214 bytes
-rw-r--r--macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdfbin269309 -> 269558 bytes
-rw-r--r--macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.tex12
-rw-r--r--macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-parser.lua2
-rw-r--r--macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua7
-rw-r--r--macros/luatex/latex/lua-placeholders/tex/lua-placeholders.sty2
13 files changed, 107 insertions, 71 deletions
diff --git a/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.pdf b/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.pdf
index 02edd681a7..693b905da3 100644
--- a/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.pdf
+++ b/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.pdf
Binary files differ
diff --git a/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.tex b/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.tex
index ef7781dd01..fe7bdd4e97 100644
--- a/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.tex
+++ b/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.tex
@@ -103,6 +103,7 @@ latexmk -pvc -lualatex -shell-escape main
Note that in both cases option \texttt{-shell-escape} is required.
This is required for issuing \texttt{git} via the commandline.
+ When utilizing the continuous compilation option \texttt{-pvc} with \texttt{latexmk}, it's important to note that only committed changes will be detected, while tag changes, unfortunately, won't be recognized.
\section{LaTeX Interface}
diff --git a/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua-cmd.lua b/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua-cmd.lua
index 5aa0dc56e5..68ac3c09a9 100644
--- a/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua-cmd.lua
+++ b/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua-cmd.lua
@@ -1,5 +1,5 @@
-- gitinfo-lua-cmd.lua
--- Copyright 2023 E. Nijenhuis
+-- Copyright 2024 E. Nijenhuis
--
-- This work may be distributed and/or modified under the
-- conditions of the LaTeX Project Public License, either version 1.3c
@@ -14,14 +14,15 @@
-- The Current Maintainer of this work is E. Nijenhuis.
--
-- This work consists of the files gitinfo-lua.sty gitinfo-lua.pdf
--- gitinfo-cmd.lua and gitinfo-lua.lua
+-- gitinfo-lua-cmd.lua, gitinfo-lua-recorder.lua and gitinfo-lua.lua
local api = {
cwd = nil,
executable = 'git',
default_sort = '',
attribute_separator = '\\pop',
- record_separator = '\\end'
+ record_separator = '\\end',
+ recorder = require('gitinfo-lua-recorder')
}
local cache = {}
function cache:seek(_key)
@@ -40,6 +41,7 @@ end
function api:exec(command, do_caching, target_dir)
local cmd = self.executable .. ' ' .. command
local cwd = target_dir or self.cwd
+ api.recorder.record_head(cwd)
if cwd then
cmd = 'cd ' .. cwd .. ' && ' .. cmd
end
diff --git a/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua-recorder.lua b/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua-recorder.lua
new file mode 100644
index 0000000000..8d4aa78af2
--- /dev/null
+++ b/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua-recorder.lua
@@ -0,0 +1,79 @@
+-- gitinfo-lua-recorder.lua
+-- Copyright 2024 E. Nijenhuis
+--
+-- This work may be distributed and/or modified under the
+-- conditions of the LaTeX Project Public License, either version 1.3c
+-- of this license or (at your option) any later version.
+-- The latest version of this license is in
+-- http://www.latex-project.org/lppl.txt
+-- and version 1.3c or later is part of all distributions of LaTeX
+-- version 2005/12/01 or later.
+--
+-- This work has the LPPL maintenance status ‘maintained’.
+--
+-- The Current Maintainer of this work is E. Nijenhuis.
+--
+-- This work consists of the files gitinfo-lua.sty gitinfo-lua.pdf
+-- gitinfo-lua-cmd.lua, gitinfo-lua-recorder.lua and gitinfo-lua.lua
+
+local kpse = kpse or require('kpse')
+local texio = texio or require('texio')
+
+local api = {
+ record_list = {}
+}
+
+---record_head
+---Records .git/HEAD and .git/refs/heads/<branch> respectively,
+---in order to trigger a rebuild in LaTeX.
+---@param git_directory string
+function api.record_head(git_directory)
+ local head_path = '.git/HEAD'
+ if git_directory then
+ head_path = git_directory .. head_path
+ end
+ if not api.record_list[head_path] then
+ api.record_list[head_path] = true
+ if kpse.in_name_ok(head_path) then
+ local head_file = io.open(head_path, 'rb')
+ if not head_file then
+ texio.write_nl('Warning: couldn\'t read HEAD from git project directory')
+ return
+ end
+ kpse.record_input_file(head_path)
+ texio.write_nl('Info: recording input file ' .. head_path)
+ local head_info = head_file:read('*a')
+ head_file:close()
+ local i, j = string.find(head_info, '^ref: .+\n$')
+ local ref_path = string.sub(head_info, i + 5, j-1)
+ if not ref_path then
+ texio.write_nl('Warning: couldn\'t find ref of HEAD')
+ return
+ end
+ ref_path = '.git/' .. ref_path
+ if git_directory then
+ ref_path = git_directory .. ref_path
+ end
+ if kpse.in_name_ok(ref_path) then
+ kpse.record_input_file(ref_path)
+ texio.write_nl('Info: recording input file ' .. ref_path)
+ else
+ texio.write_nl('Warning: couldn\'t read ref file: ' .. ref_path)
+ end
+ else
+ texio.write_nl('Couldn\'t open input file ' .. head_path)
+ end
+ end
+end
+
+
+
+local gitinfo_recorder = {}
+local gitinfo_recorder_mt = {
+ __index = api,
+ __newindex = nil
+}
+
+setmetatable(gitinfo_recorder, gitinfo_recorder_mt)
+
+return gitinfo_recorder
diff --git a/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua.lua b/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua.lua
index 0f3a1315d3..cba19b19d7 100644
--- a/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua.lua
+++ b/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua.lua
@@ -1,5 +1,5 @@
-- gitinfo-lua.lua
--- Copyright 2023 E. Nijenhuis
+-- Copyright 2024 E. Nijenhuis
--
-- This work may be distributed and/or modified under the
-- conditions of the LaTeX Project Public License, either version 1.3c
@@ -14,7 +14,7 @@
-- The Current Maintainer of this work is E. Nijenhuis.
--
-- This work consists of the files gitinfo-lua.sty gitinfo-lua.pdf
--- gitinfo-cmd.lua and gitinfo-lua.lua
+-- gitinfo-lua-cmd.lua, gitinfo-lua-recorder.lua and gitinfo-lua.lua
if not modules then
modules = {}
@@ -23,8 +23,8 @@ end
local module = {
name = 'gitinfo-lua',
info = {
- version = '1.0.2', --TAGVERSION
- date = '2024/02/23', --TAGDATE
+ version = '1.0.3', --TAGVERSION
+ date = '2024/04/02', --TAGDATE
comment = "Git info Lua — Git integration with LaTeX",
author = "Erik Nijenhuis",
license = "free"
@@ -81,58 +81,6 @@ function api:escape_str(value)
return buf
end
--- experimental
-function api:get_tok()
- if self.cur_tok == nil then
- self.cur_tok = token.get_next()
- end
- return self.cur_tok
-end
-
--- experimental
-function api:parse_opts()
- local tok = self:get_tok()
- if tok.cmdname == 'other_char' then
- --token.put_next(tok)
- local opts = token.scan_word()
- self.cur_tok = nil
- -- todo: parse []
- return opts
- end
-end
-
--- experimental
-function api:parse_arguments(argc)
- local result_list = {}
- for _ = 1, argc do
- local tok = self:get_tok()
- if tok.cmdname == 'left_brace' then
- token.put_next(tok)
- table.insert(result_list, token.scan_argument())
- self.cur_tok = nil
- else
- tex.error("Expected left brace")
- return
- end
- end
- return table.unpack(result_list)
-end
-
--- experimental
-function api:parse_macro()
- --tex.print('\\noexpand')
- local tok = self:get_tok()
- if (tok.cmdname == 'call') or tok.cmdname == 'long_call' then
- self.cur_tok = nil
- return tok
- else
- tex.error("Expected Macro")
- for i = 1, 5 do
- local _tok = token.get_next()
- end
- end
-end
-
function api:dir(path)
self.cmd.cwd = path
end
diff --git a/macros/luatex/latex/gitinfo-lua/tex/gitinfo-lua.sty b/macros/luatex/latex/gitinfo-lua/tex/gitinfo-lua.sty
index 3f850a1146..c9ab3a4cd6 100644
--- a/macros/luatex/latex/gitinfo-lua/tex/gitinfo-lua.sty
+++ b/macros/luatex/latex/gitinfo-lua/tex/gitinfo-lua.sty
@@ -1,5 +1,5 @@
%% gitinfo-lua.sty
-%% Copyright 2023 E. Nijenhuis
+%% Copyright 2024 E. Nijenhuis
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
@@ -14,9 +14,9 @@
% The Current Maintainer of this work is E. Nijenhuis.
%
% This work consists of the files gitinfo-lua.sty gitinfo-lua.pdf
-% gitinfo-cmd.lua and gitinfo-lua.lua
+% gitinfo-lua-cmd.lua, gitinfo-lua-recorder.lua and gitinfo-lua.lua
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{gitinfo-lua}[2024/02/23 1.0.2 Xerdi's Git Package]
+\ProvidesPackage{gitinfo-lua}[2024/04/02 1.0.3 Xerdi's Git Package]
\RequirePackage{luacode}
diff --git a/macros/luatex/latex/lua-placeholders/README.md b/macros/luatex/latex/lua-placeholders/README.md
index 6859910816..b1b43e23b9 100644
--- a/macros/luatex/latex/lua-placeholders/README.md
+++ b/macros/luatex/latex/lua-placeholders/README.md
@@ -1,5 +1,6 @@
# Lua(TeX) Placeholders
![CTAN Version](https://img.shields.io/ctan/v/lua-placeholders)
+[![build](https://github.com/Xerdi/lua-placeholders/actions/workflows/build.yml/badge.svg)](https://github.com/Xerdi/lua-placeholders/actions/workflows/build.yml)
A LaTeX package for specifying and inserting document placeholders with JSON or YAML formats.
diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.pdf b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.pdf
index 979941c702..a91d000cdd 100644
--- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.pdf
+++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.pdf
Binary files differ
diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf
index 2054633991..6a5c5860ad 100644
--- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf
+++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf
Binary files differ
diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.tex b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.tex
index 210270b939..ff078470c1 100644
--- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.tex
+++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.tex
@@ -91,13 +91,12 @@
For proper number formatting package \texttt{numprint}\cite{numprint} is required.
\subsubsection{YAML Support}
- If you're using JSON as \meta{recipe} and \meta{payload} format, the following requirements are no longer needed, since Lua\TeX{} already supports JSON formats out of the box.
+ Starting from version 1.0.2, the preferred YAML implementation has changed from \texttt{lyaml}\cite{lyaml} to \texttt{lua-tinyyaml}\cite{lua-tinyyaml}.
+ The reason for this change is that \texttt{lua-tinyyaml} doesn't require any platform-specific dependencies, such as \texttt{libYAML}\cite{libYAML}.
+
+ The older YAML implementation will still function for older installations that do not have \texttt{lua-tinyyaml}.
+ As before, when no YAML implementation is found, \texttt{lua-placeholders} will fall back to JSON support.
- For YAML support, however, this package requires the \texttt{lyaml}\cite{lyaml} Lua module for parsing the YAML files.
- This also includes the \texttt{libYAML}\cite{libYAML} platform dependent library and optionally LuaRocks for installing \texttt{lyaml}.
- Another requirement is Lua, which version meets the Lua version used by Lua\TeX{}.
- If no \texttt{LUA\_PATH} is set, and you use LuaRocks, this package tries to call the LuaRocks executable to find the \texttt{LUA\_PATH}.
- If \texttt{lyaml} can't be loaded, this package will first try to fall back with \texttt{lua-tinyyaml}\cite{lua-tinyyaml} for lesser YAML support and secondly fall back on accepting JSON files only.
\clearpage
\section{Usage}
@@ -115,6 +114,7 @@
\DescribeMacro{\loadpayload} The same behaviour counts for \cmd{\loadpayload}\oarg{namespace}\marg{filename}.
The order of loading \meta{recipe} and \meta{payload} files doesn't matter.
If the \meta{payload} file got loaded first, it will be yielded until the corresponding \meta{recipe} file is loaded.
+ When a file is loaded, a \LaTeX\ hook will trigger once for \texttt{namespace/\meta{namespace}} and once for \texttt{namespace\meta{namespace}/loaded}, respectively.
All other macros of this package also take the optional \meta{namespace}, which by default is equal to \cmd{\jobname}.
\DescribeMacro{\setnamespace} This default \meta{namespace} can be changed with \cmd{\setnamespace}\marg{new default namespace}.\\
diff --git a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-parser.lua b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-parser.lua
index 4a0304c463..0de9d25c9c 100644
--- a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-parser.lua
+++ b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-parser.lua
@@ -19,6 +19,7 @@
-- lua-placeholders-parser.lua and lua-placeholders-types.lua
local LUA_VERSION = string.sub(_VERSION, 5, -1)
+local kpse = kpse or require('kpse')
yaml_supported = false
@@ -87,6 +88,7 @@ return function(filename)
end
local raw = file:read "*a"
file:close()
+ kpse.record_input_file(filename)
if ext == 'json' then
return utilities.json.tolua(raw)
else
diff --git a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua
index 24f0a6c5ca..98c2b13416 100644
--- a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua
+++ b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua
@@ -23,8 +23,8 @@ if not modules then
end
modules.lua_placeholders = {
- version = "1.0.2",
- date = "2024/02/21",
+ version = "1.0.3",
+ date = "2024/04/02",
comment = 'Lua Placeholders — for specifying and inserting document parameters',
author = 'Erik Nijenhuis',
license = 'free'
@@ -78,7 +78,10 @@ function api.recipe(path, namespace_name)
else
namespace:load_recipe(raw_recipe)
end
+ tex.print('\\NewHook{namespace/' .. name .. '}')
+ tex.print('\\NewHook{namespace/' .. name .. '/loaded}')
tex.print('\\UseOneTimeHook{namespace/' .. name .. '}')
+ texio.write_nl(name)
if namespace.payload_file and not namespace.payload_loaded then
local raw_payload = load_resource(namespace.payload_file)
if raw_payload.namespace then
diff --git a/macros/luatex/latex/lua-placeholders/tex/lua-placeholders.sty b/macros/luatex/latex/lua-placeholders/tex/lua-placeholders.sty
index 1d2a26f720..ddba421f49 100644
--- a/macros/luatex/latex/lua-placeholders/tex/lua-placeholders.sty
+++ b/macros/luatex/latex/lua-placeholders/tex/lua-placeholders.sty
@@ -19,7 +19,7 @@
% lua-placeholders-parser.lua and lua-placeholders-types.lua
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lua-placeholders}[2024/02/21 1.0.2 Lua Placeholders Package]
+\ProvidesPackage{lua-placeholders}[2024/04/02 1.0.3 Lua Placeholders Package]
\RequirePackage{ifthen}
\RequirePackage{luapackageloader}