summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-03-08 21:32:39 +0000
committerKarl Berry <karl@freefriends.org>2023-03-08 21:32:39 +0000
commit8b57f79315845dfb9c3f19ddcfee1f7f8e807711 (patch)
treedde2a0a17eebd101fb3bef863309db0083aa0dc6
parent6a3ccace52b3ea94fb364372315a07fc5bb17c50 (diff)
light-latex-make (8mar23) (branch)
git-svn-id: svn://tug.org/texlive/branches/branch2022.final@66474 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/light-latex-make/llmk.lua79
-rw-r--r--Master/texmf-dist/doc/man/man1/llmk.16
-rw-r--r--Master/texmf-dist/doc/man/man1/llmk.man1.pdfbin23767 -> 22026 bytes
-rw-r--r--Master/texmf-dist/doc/support/light-latex-make/LICENSE2
-rw-r--r--Master/texmf-dist/doc/support/light-latex-make/README.md72
-rw-r--r--Master/texmf-dist/doc/support/light-latex-make/llmk-doc.cls22
-rw-r--r--Master/texmf-dist/doc/support/light-latex-make/llmk-logo-code.tex2
-rw-r--r--Master/texmf-dist/doc/support/light-latex-make/llmk.pdfbin99421 -> 114804 bytes
-rw-r--r--Master/texmf-dist/doc/support/light-latex-make/llmk.tex69
-rwxr-xr-xMaster/texmf-dist/scripts/light-latex-make/llmk.lua79
10 files changed, 239 insertions, 92 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/light-latex-make/llmk.lua b/Build/source/texk/texlive/linked_scripts/light-latex-make/llmk.lua
index 79264eaeead..3bdf5effcfa 100755
--- a/Build/source/texk/texlive/linked_scripts/light-latex-make/llmk.lua
+++ b/Build/source/texk/texlive/linked_scripts/light-latex-make/llmk.lua
@@ -3,7 +3,7 @@
--
-- This is file `llmk.lua'.
--
--- Copyright 2018-2021 Takuto ASAKURA (wtsnjp)
+-- Copyright 2018-2023 Takuto Asakura (wtsnjp)
-- GitHub: https://github.com/wtsnjp
-- Twitter: @wtsnjp
--
@@ -39,9 +39,9 @@ local M = {}
-- program information
M.prog_name = 'llmk'
-M.version = '1.1.0'
-M.copyright = 'Copyright 2018-2021'
-M.author = 'Takuto ASAKURA (wtsnjp)'
+M.version = '1.2.0'
+M.copyright = 'Copyright 2018-2023'
+M.author = 'Takuto Asakura (wtsnjp)'
M.llmk_toml = 'llmk.toml'
-- exit codes
@@ -67,9 +67,11 @@ M.top_level_spec = {
latex = {'string', 'lualatex'},
llmk_version = {'string', nil},
makeindex = {'string', 'makeindex'},
+ makeglossaries = {'string', 'makeglossaries'},
max_repeat = {'integer', 5},
+ output_directory = {'string', nil},
ps2pdf = {'string', 'ps2pdf'},
- sequence = {'[string]', {'latex', 'bibtex', 'makeindex', 'dvipdf'}},
+ sequence = {'[string]', {'latex', 'bibtex', 'makeindex', 'makeglossaries', 'dvipdf'}},
source = {'*[string]', nil},
}
@@ -104,6 +106,7 @@ M.default_programs = {
'-interaction=nonstopmode',
'-file-line-error',
'-synctex=1',
+ '-output-directory="%o"',
},
aux_file = '%B.aux',
aux_empty_size = 9, -- "\\relax \n" is empty
@@ -113,6 +116,13 @@ M.default_programs = {
generated_target = true,
postprocess = 'latex',
},
+ makeglossaries = {
+ target = '%B.glo',
+ generated_target = true,
+ postprocess = 'latex',
+ opts = {'-d "%o"'},
+ args = {'%b.glo'}, -- "%B.glo" will result in an error
+ },
ps2pdf = {
target = '%B.ps',
generated_target = true,
@@ -180,19 +190,29 @@ function M.get_status(raw)
end
-- Replace config param to filename
-function M.replace_specifiers(str, source, target)
+function M.replace_specifiers(str, source, target, output_directory)
local tmp = '/' .. source
- local basename = tmp:match('^.*/(.*)%..*$')
+ local basename_match = tmp:match('^.*/(.*)%..*$')
str = str:gsub('%%S', source)
str = str:gsub('%%T', target)
- if basename then
- str = str:gsub('%%B', basename)
- else
- str = str:gsub('%%B', source)
+ local sub_basename = source
+ if basename_match then
+ sub_basename = basename_match
end
+ local sub_output_directory = '.'
+ local sub_output_directory_basename = sub_basename
+ if output_directory then
+ sub_output_directory = output_directory
+ sub_output_directory_basename = output_directory .. '/' .. sub_basename
+ end
+
+ str = str:gsub('%%b', sub_basename)
+ str = str:gsub('%%o', sub_output_directory)
+ str = str:gsub('%%B', sub_output_directory_basename)
+
return str
end
@@ -380,7 +400,7 @@ local function update_config(config, tab)
local config = merge_table(config, tab)
-- set essential program names from top-level
- local prg_names = {'latex', 'bibtex', 'makeindex', 'dvipdf', 'dvips', 'ps2pdf'}
+ local prg_names = {'latex', 'bibtex', 'makeindex', 'makeglossaries', 'dvipdf', 'dvips', 'ps2pdf'}
for _, name in pairs(prg_names) do
config = fetch_from_top_level(config, name)
end
@@ -998,7 +1018,7 @@ local function setup_programs(fn, config)
cur_target = fn
else
-- here, %T should be replaced by `fn`
- cur_target = llmk.util.replace_specifiers(prog.target, fn, fn)
+ cur_target = llmk.util.replace_specifiers(prog.target, fn, fn, config.output_directory)
end
prog.target = cur_target
@@ -1018,11 +1038,11 @@ local function setup_programs(fn, config)
if type(prog[k]) == 'table' then
for ik, iv in ipairs(prog[k]) do
if type(prog[k][ik]) == 'string' then
- prog[k][ik] = llmk.util.replace_specifiers(iv, fn, cur_target)
+ prog[k][ik] = llmk.util.replace_specifiers(iv, fn, cur_target, config.output_directory)
end
end
elseif type(prog[k]) == 'string' then
- prog[k] = llmk.util.replace_specifiers(prog[k], fn, cur_target)
+ prog[k] = llmk.util.replace_specifiers(prog[k], fn, cur_target, config.output_directory)
end
end
end
@@ -1087,7 +1107,7 @@ local function init_file_database(programs, fn, config)
return fdb
end
-local function construct_cmd(prog, fn, target)
+local function construct_cmd(prog)
-- construct the option
local cmd_opt = ''
@@ -1213,7 +1233,7 @@ local function run_program(name, prog, fn, fdb, postprocess)
-- does target exist?
if not llmk.core.dry_run and not lfs.isfile(prog.target) then
llmk.util.dbg_print('run',
- 'Skiping "%s" because target (%s) does not exist',
+ 'Skipping "%s" because target (%s) does not exist',
prog.command, prog.target)
return false
end
@@ -1225,7 +1245,7 @@ local function run_program(name, prog, fn, fdb, postprocess)
prog.target)
elseif file_mtime(prog.target) < start_time then
llmk.util.dbg_print('run',
- 'Skiping "%s" because target (%s) is not updated',
+ 'Skipping "%s" because target (%s) is not updated',
prog.command, prog.target)
return false
end
@@ -1235,7 +1255,7 @@ local function run_program(name, prog, fn, fdb, postprocess)
end
end
- local cmd = construct_cmd(prog, fn, prog.target)
+ local cmd = construct_cmd(prog)
if llmk.core.dry_run then
print('Dry running: ' .. cmd)
if #cond > 0 then
@@ -1306,6 +1326,11 @@ function M.run_sequence(fn, config)
llmk.util.dbg_print('fdb', 'The initial file database is as follows:')
llmk.util.dbg_print_table('fdb', fdb)
+ -- check if output directory exists
+ if config.output_directory and not lfs.isdir(config.output_directory) then
+ llmk.util.err_print('error', 'Output directory does not exist "%s"', config.output_directory)
+ end
+
for _, name in ipairs(config.sequence) do
llmk.util.dbg_print('run', 'Preparing for program "%s"', name)
process_program(programs, name, fn, fdb, config)
@@ -1336,9 +1361,9 @@ local function remove(fn)
end
end
-local function replace_spec_and_remove_files(fns, source)
+local function replace_spec_and_remove_files(fns, source, output_directory)
for _, fn in ipairs(fns) do
- local replaced_fn = llmk.util.replace_specifiers(fn, source, source)
+ local replaced_fn = llmk.util.replace_specifiers(fn, source, source, output_directory)
if lfs.isfile(replaced_fn) then
remove(replaced_fn)
end
@@ -1348,16 +1373,16 @@ end
-- the actual process for the --clean action
function M.clean(fn, config)
llmk.util.err_print('info', 'Begining cleaning for "%s"', fn)
- replace_spec_and_remove_files(config.clean_files, fn)
- replace_spec_and_remove_files(config.extra_clean_files, fn)
+ replace_spec_and_remove_files(config.clean_files, fn, config.output_directory)
+ replace_spec_and_remove_files(config.extra_clean_files, fn, config.output_directory)
end
-- the actual process for the --clobber action
function M.clobber(fn, config)
llmk.util.err_print('info', 'Begining clobbering for "%s"', fn)
- replace_spec_and_remove_files(config.clean_files, fn)
- replace_spec_and_remove_files(config.extra_clean_files, fn)
- replace_spec_and_remove_files(config.clobber_files, fn)
+ replace_spec_and_remove_files(config.clean_files, fn, config.output_directory)
+ replace_spec_and_remove_files(config.extra_clean_files, fn, config.output_directory)
+ replace_spec_and_remove_files(config.clobber_files, fn, config.output_directory)
end
llmk.cleaner = M
@@ -1460,7 +1485,7 @@ local function read_options()
elseif (curr_arg == '-V') or (curr_arg == '--version') then
return 'version' -- immediately show version
elseif (curr_arg == '-c') or (curr_arg == '--clean') then
- action = 'clean'
+ action = 'clean'
elseif (curr_arg == '-C') or (curr_arg == '--clobber') then
action = 'clobber'
-- debug
diff --git a/Master/texmf-dist/doc/man/man1/llmk.1 b/Master/texmf-dist/doc/man/man1/llmk.1
index ef5dded3907..1eb09ccfabf 100644
--- a/Master/texmf-dist/doc/man/man1/llmk.1
+++ b/Master/texmf-dist/doc/man/man1/llmk.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "LLMK" "1" "August 2021" "llmk 1.1.0" "llmk manual"
+.TH "LLMK" "1" "March 2023" "llmk 1.2.0" "llmk manual"
.
.SH "NAME"
\fBllmk\fR \- Light LaTeX Make
@@ -69,7 +69,7 @@ General error\.
.
.TP
2
-Failure executing the workflow\. The exit status of the external program is reported in an error message\.
+Error in invoked program\. The exit status of the external program is reported in an error message\.
.
.TP
3
@@ -86,7 +86,7 @@ Report bugs to \fIhttps://github\.com/wtsnjp/llmk/issues\fR\.
Source: \fIhttps://github\.com/wtsnjp/llmk\fR
.
.SH "COPYRIGHT"
-Copyright 2018\-2021 Takuto ASAKURA (wtsnjp)\.
+Copyright 2018\-2023 Takuto Asakura (wtsnjp)\.
.
.br
License: The MIT License \fIhttps://opensource\.org/licenses/mit\-license\fR\.
diff --git a/Master/texmf-dist/doc/man/man1/llmk.man1.pdf b/Master/texmf-dist/doc/man/man1/llmk.man1.pdf
index 9d9c49e7e76..1ee2c9142ef 100644
--- a/Master/texmf-dist/doc/man/man1/llmk.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/llmk.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/light-latex-make/LICENSE b/Master/texmf-dist/doc/support/light-latex-make/LICENSE
index bcd5768aa01..cff4de24b78 100644
--- a/Master/texmf-dist/doc/support/light-latex-make/LICENSE
+++ b/Master/texmf-dist/doc/support/light-latex-make/LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright 2018-2021 Takuto ASAKURA (wtsnjp)
+Copyright 2018-2023 Takuto Asakura (wtsnjp)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/Master/texmf-dist/doc/support/light-latex-make/README.md b/Master/texmf-dist/doc/support/light-latex-make/README.md
index d8cee7d45b5..12f4ff1c0cc 100644
--- a/Master/texmf-dist/doc/support/light-latex-make/README.md
+++ b/Master/texmf-dist/doc/support/light-latex-make/README.md
@@ -42,7 +42,7 @@ Hello \textsf{llmk}!
Suppose we save this file as `hello.tex`, then run
```shell
-$ llmk hello.tex
+llmk hello.tex
```
will produce a PDF document (`hello.pdf`) with XeLaTeX, since it is specified in the TOML line of the source.
@@ -63,7 +63,7 @@ source = "hello.tex"
If you run llmk without any argument, llmk will load `llmk.toml` in the working directory, and compile files specified by the `source` key with the settings written in the file.
```shell
-$ llmk
+llmk
```
### Supports for other magic comment formats
@@ -116,7 +116,7 @@ Similar to [latexmk](http://personal.psu.edu/jcc8/software/latexmk/), Actions `-
Specifically,
```shell
-$ llmk --clean FILE...
+llmk --clean FILE...
```
removes files generated by the specified `FILE`s. In case you omit the argument `FILE`, files generated by the `source` files are removed. In both cases, the files to remove by these actions can be customized (see the reference manual for the details).
@@ -153,7 +153,9 @@ In the `args` keys in each program, some format specifiers are available. Those
* `%S`: the file name given to llmk as an argument (source)
* `%T`: the target for each program
-* `%B`: the base name of `%S`
+* `%o`: the output directory, or `.` if none was specified
+* `%b`: the base name of `%S`
+* `%B`: the output directory concatenated with the base name of `%S`
This way is a bit complicated but strong enough allowing you to use any kind of outer programs.
@@ -170,7 +172,9 @@ The following is the list of available TOML keys in llmk. See the reference manu
* `latex` (type: *string*, default: `"lualatex"`)
* `llmk_version` (type: *string*)
* `makeindex` (type: *string*, default: `"makeindex"`)
+* `makeglossaries` (type: *string*, default: `"makeglossaries"`)
* `max_repeat` (type: *integer*, default: `5`)
+* `output_directory` (type: *string*)
* `programs` (type: *table*)
* \<program name\>
* `args` (type: *string* or *array of strings*, default: `["%T"]`)
@@ -182,7 +186,7 @@ The following is the list of available TOML keys in llmk. See the reference manu
* `postprocess` (type: *string*)
* `target` (type: *string*, default: `"%S"`)
* `ps2pdf` (type: *string*, default: `"ps2pdf"`)
-* `sequence` (type: *array of strings*, default: `["latex", "bibtex", "makeindex", "dvipdf"]`)
+* `sequence` (type: *array of strings*, default: `["latex", "bibtex", "makeindex", "makeglossaries", "dvipdf"]`)
* `source` (type: *string* or *array of strings*, only for `llmk.toml`)
### Default `programs` table
@@ -208,7 +212,7 @@ generated_target = true
[programs.latex]
command = "lualatex"
-opts = ["-interaction=nonstopmode", "-file-line-error", "-synctex=1"]
+opts = ["-interaction=nonstopmode", "-file-line-error", "-synctex=1", '-output-directory="%o"']
aux_file = "%B.aux"
aux_empty_size = 9
@@ -218,12 +222,64 @@ target = "%B.idx"
generated_target = true
postprocess = "latex"
+[programs.makeglossaries]
+command = "makeglossaries"
+target = "%B.glo"
+generated_target = true
+postprocess = "latex"
+opts = ['-d "%o"']
+args = ["%b.glo"]
+
[programs.ps2pdf]
command = "ps2pdf"
target = "%B.ps"
generated_target = true
```
+## Building and testing
+
+Some maintenance tasks are defined as [Rake](https://github.com/ruby/rake) tasks. To run these tasks, please install the dependencies first:
+
+```shell
+bundle install
+```
+
+### Generating all documentation
+
+The following will generate both the PDF and the manpage in `doc/` directory.
+
+```shell
+rake doc
+```
+
+### Running tests
+
+The following will run all tests in `spec/` directory.
+
+```shell
+rake test
+```
+
+Alternatively, you can give spec names with the `--list` (`-l`) option for this task. E.g., following will run only `spec/help_spec.rb` and `spec/version_spec.rb`:
+
+```shell
+rake test -- -l help,version
+```
+
+### Showing all available tasks
+
+Following will show all available tasks with a short description.
+
+```shell
+rake -T
+```
+
+In addition to that, for options available tasks, e.g., `rake test`, you can get options information with `-h` option for each task:
+
+```shell
+rake test -- -h
+```
+
## Links to other materials
* [Reference manual](http://mirrors.ctan.org/support/light-latex-make/llmk.pdf): it describes the full specification.
@@ -236,7 +292,7 @@ This project has been supported by the [TeX Development Fund](https://www.tug.or
## License
-Copyright 2018-2021 Takuto ASAKURA ([wtsnjp](https://twitter.com/wtsnjp))
+Copyright 2018-2023 Takuto Asakura ([wtsnjp](https://twitter.com/wtsnjp))
This software is licensed under [the MIT license](./LICENSE).
@@ -246,4 +302,4 @@ This software is licensed under [the MIT license](./LICENSE).
---
-Takuto ASAKURA ([wtsnjp](https://twitter.com/wtsnjp))
+Takuto Asakura ([wtsnjp](https://twitter.com/wtsnjp))
diff --git a/Master/texmf-dist/doc/support/light-latex-make/llmk-doc.cls b/Master/texmf-dist/doc/support/light-latex-make/llmk-doc.cls
index 632becfcd3d..628e05fb2f1 100644
--- a/Master/texmf-dist/doc/support/light-latex-make/llmk-doc.cls
+++ b/Master/texmf-dist/doc/support/light-latex-make/llmk-doc.cls
@@ -39,18 +39,22 @@
\RequirePackage{listings}
\RequirePackage{xparse}
-% logo
-\input{llmk-logo-code}
-\RequirePackage[no-math]{fontspec}
+% font settings
+\RequirePackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
+
+\RequirePackage{unicode-math}
+\RequirePackage{utfsym}
+
+\setmainfont{STIX Two Text}
+\setsansfont{Helvetica Neue}
+\setmathfont{STIX Two Math}[StylisticSet=02, StylisticSet=08]
+\setmonofont[StylisticSet={1,3}]{Inconsolatazi4}
+
+% logo
\newcommand{\logomainfont}{\fontspec{Helvetica Neue}}
\newcommand{\logosubfont}{\fontspec{Helvetica Neue Thin}}
-
-% font settings
-\let\Zbar\relax
-\RequirePackage[defaultsups]{newtxtext}
-\RequirePackage[varqu,varl]{inconsolata}
-\RequirePackage[bigdelims,vvarbb]{newtxmath}
+\input{llmk-logo-code}
% for headings
%\setkomafont{title}{}
diff --git a/Master/texmf-dist/doc/support/light-latex-make/llmk-logo-code.tex b/Master/texmf-dist/doc/support/light-latex-make/llmk-logo-code.tex
index 3201ed0fd44..7a69a077171 100644
--- a/Master/texmf-dist/doc/support/light-latex-make/llmk-logo-code.tex
+++ b/Master/texmf-dist/doc/support/light-latex-make/llmk-logo-code.tex
@@ -1,7 +1,7 @@
%
% This is LaTeX source for the llmk logo.
%
-% Copyright 2018-2020 Takuto ASAKURA (wtsnjp)
+% Copyright 2018-2023 Takuto Asakura (wtsnjp)
% GitHub: https://github.com/wtsnjp
% Twitter: @wtsnjp
%
diff --git a/Master/texmf-dist/doc/support/light-latex-make/llmk.pdf b/Master/texmf-dist/doc/support/light-latex-make/llmk.pdf
index 6693d671be0..c3b1c07c4e6 100644
--- a/Master/texmf-dist/doc/support/light-latex-make/llmk.pdf
+++ b/Master/texmf-dist/doc/support/light-latex-make/llmk.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/light-latex-make/llmk.tex b/Master/texmf-dist/doc/support/light-latex-make/llmk.tex
index 61673f016e9..2884d211a10 100644
--- a/Master/texmf-dist/doc/support/light-latex-make/llmk.tex
+++ b/Master/texmf-dist/doc/support/light-latex-make/llmk.tex
@@ -1,8 +1,8 @@
% llmk: the reference manual
-% Copyright 2020 Takuto ASAKURA (wtsnjp)
+% Copyright 2020-2023 Takuto Asakura (wtsnjp)
% +++
-% latex = "xelatex"
+% latex = "texfot xelatex"
% +++
\documentclass{llmk-doc}
@@ -10,7 +10,7 @@
\title{llmk: Light {\LaTeX} Make}
\author{Takuto Asakura (wtsnjp)}
\subtitle{Reference Manual}
-\date{v1.1.0\quad\today}
+\date{v1.2.0\quad\today}
\keywords{llmk, build-tool, toml, lua, luatex}
\begin{document}
@@ -220,9 +220,9 @@ programs that failed, if any, are reported in the error messages.
\begin{tabular}{rp{12em}rp{12em}}
\toprule
Code & Error type & Code & Error Type \\ \midrule
-\code{0} & Success & \code{3} & Parser Error \\
-\code{1} & General Error & \code{4} & Type Error \\
-\code{2} & Invoked program failed & \\
+\code{0} & Success & \code{3} & Parser error \\
+\code{1} & General error & \code{4} & Type error \\
+\code{2} & Error in invoked program & \\
\bottomrule
\end{tabular}
\end{center}
@@ -249,7 +249,7 @@ keys (Section~\ref{sec:top-level-keys}~\&~\ref{sec:keys-in-programs}) are
supported.
\begin{center}
-\newcommand{\ok}{{\color{special}\checkmark}}
+\newcommand{\ok}{{\color{special}\usym{1F5F8}}}
\begin{tabular}{llc}
\toprule
Type & Example & Supported \\ \midrule
@@ -368,8 +368,12 @@ executing actions by \prog{llmk}:
argument or as an element of the \ckey{source} array.
\item |%T|
is replaced by the target for each program.
-\item |%B|
+\item |%o|
+ is replaced by the output directory, or \code{.} if none was specified.
+\item |%b|
is replaced by the basename of |%S|.
+\item |%B|
+ is replaced by the output directory concatenated with the basename of |%S|.
\end{itemize}
Some keys have default values; the default configuration of \prog{llmk} should
@@ -462,6 +466,13 @@ the \ckey{command} key is specified in the \ckey{programs} table, this alias is
ineffective.
\end{confkey}
+\begin{confkey}{makeglossaries}{type: \type{string}}[default: \code{"makeglossaries"}]
+The command to use for the \progname{makeglossaries} program. Internally, this key
+is an alias for the \ckey{command} key in the \progname{makeglossaries} entry. If
+the \ckey{command} key is specified in the \ckey{programs} table, this alias is
+ineffective.
+\end{confkey}
+
\begin{confkey}{max\_repeat}{type: \type{integer}}[default: \code{5}]
You can specify the maximum number of execution repetitions for each command in
your \ckey{sequence}. When processing your \ckey{sequence}, \prog{llmk} repeats
@@ -470,6 +481,10 @@ the key is specified and the corresponding auxiliary file exists. This key is to
prevent the potential infinite loop of repetition.
\end{confkey}
+\begin{confkey}{output\_directory}{type: \type{string}}
+Use this option to specify a directory where \progname{latex} output files should be written to and read from. This directory must already exist, or else \prog{llmk} will fail with an error. If the option is not specified, then output files will be written to the directory where \prog{llmk} is run from.
+\end{confkey}
+
\begin{confkey}{programs}{type: \type{table}}
[default: see Section~\ref{sec:default-programs}]
The table that contains the detailed configuration for each program. See
@@ -644,7 +659,12 @@ command is chosen for the default.
\begin{lstlisting}[style=toml]
[programs.latex]
command = "lualatex"
-opts = ["-interaction=nonstopmode", "-file-line-error", "-synctex=1"]
+opts = [
+ "-interaction=nonstopmode",
+ "-file-line-error",
+ "-synctex=1",
+ '-output-directory="%o"'
+]
aux_file = "%B.aux"
aux_empty_size = 9
\end{lstlisting}
@@ -661,6 +681,20 @@ generated_target = true
postprocess = "latex"
\end{lstlisting}
+\Program{makeglossaries} The entry for the Makeglossaries program and friends. The
+\progname{latex} program is set as \ckey{postprocess} so that to make sure
+rerunning {\LaTeX} command after this execution.
+%
+\begin{lstlisting}[style=toml]
+[programs.makeglossaries]
+command = "makeglossaries"
+target = "%B.glo"
+generated_target = true
+postprocess = "latex"
+opts = ['-d "%o"']
+args = ["%b.glo"]
+\end{lstlisting}
+
\Program{ps2pdf} The entry for the \prog{ps2pdf} program and friends.
%
\begin{lstlisting}[style=toml]
@@ -676,7 +710,7 @@ generated_target = true
The following is the default value for the \ckey{sequence} array:
%
\begin{htcode}
-["latex", "bibtex", "makeindex", "dvipdf"]
+["latex", "bibtex", "makeindex", "makeglossaries", "dvipdf"]
\end{htcode}
With these default settings in the \ckey{programs} table the \ckey{sequence}
@@ -691,9 +725,10 @@ array, the default behavior of \prog{llmk} can be summarized as follows.
\code{\%B.bib}, exists, the {\BibTeX} program is executed. When the execution
occurs, the \progname{latex} program is executed again right after because
the program is set as \ckey{postprocess}.
-\item Identically, if the corresponding input file for Makeindex exists, the
- program is executed. When the execution occurs, the \progname{latex} program
- is executed again right after because the program is set as \ckey{postprocess}.
+\item Identically, if the corresponding input files for Makeindex and
+ Makeglossaries exist, the program is executed. When the execution occurs,
+ the \progname{latex} program is executed again right after because the
+ program is set as \ckey{postprocess}.
\item In case the corresponding DVI file is generated in the previous steps,
though this will not happen with the default value of \ckey{latex}, \ie
\code{"lualatex"}, the \progname{dvipdf} program, by default \code{dvipdfmx},
@@ -705,9 +740,11 @@ easier to use other tools from the above. For instance, if you wan to use
$\text{\progname{dvips}}+\text{\progname{ps2pdf}}$ combination instead of
\progname{dvipdf}, you can just modify the value of \ckey{sequence} a bit:
%
-\begin{lstlisting}[style=toml]
-sequence = ["latex", "bibtex", "makeindex", "dvips", "ps2pdf"]
-\end{lstlisting}
+\begin{htcode}
+sequence = [
+ "latex", "bibtex", "makeindex", "makeglossaries", "dvips", "ps2pdf"
+]
+\end{htcode}
\section{Other supported formats}
\label{sec:magic-comment}
diff --git a/Master/texmf-dist/scripts/light-latex-make/llmk.lua b/Master/texmf-dist/scripts/light-latex-make/llmk.lua
index 79264eaeead..3bdf5effcfa 100755
--- a/Master/texmf-dist/scripts/light-latex-make/llmk.lua
+++ b/Master/texmf-dist/scripts/light-latex-make/llmk.lua
@@ -3,7 +3,7 @@
--
-- This is file `llmk.lua'.
--
--- Copyright 2018-2021 Takuto ASAKURA (wtsnjp)
+-- Copyright 2018-2023 Takuto Asakura (wtsnjp)
-- GitHub: https://github.com/wtsnjp
-- Twitter: @wtsnjp
--
@@ -39,9 +39,9 @@ local M = {}
-- program information
M.prog_name = 'llmk'
-M.version = '1.1.0'
-M.copyright = 'Copyright 2018-2021'
-M.author = 'Takuto ASAKURA (wtsnjp)'
+M.version = '1.2.0'
+M.copyright = 'Copyright 2018-2023'
+M.author = 'Takuto Asakura (wtsnjp)'
M.llmk_toml = 'llmk.toml'
-- exit codes
@@ -67,9 +67,11 @@ M.top_level_spec = {
latex = {'string', 'lualatex'},
llmk_version = {'string', nil},
makeindex = {'string', 'makeindex'},
+ makeglossaries = {'string', 'makeglossaries'},
max_repeat = {'integer', 5},
+ output_directory = {'string', nil},
ps2pdf = {'string', 'ps2pdf'},
- sequence = {'[string]', {'latex', 'bibtex', 'makeindex', 'dvipdf'}},
+ sequence = {'[string]', {'latex', 'bibtex', 'makeindex', 'makeglossaries', 'dvipdf'}},
source = {'*[string]', nil},
}
@@ -104,6 +106,7 @@ M.default_programs = {
'-interaction=nonstopmode',
'-file-line-error',
'-synctex=1',
+ '-output-directory="%o"',
},
aux_file = '%B.aux',
aux_empty_size = 9, -- "\\relax \n" is empty
@@ -113,6 +116,13 @@ M.default_programs = {
generated_target = true,
postprocess = 'latex',
},
+ makeglossaries = {
+ target = '%B.glo',
+ generated_target = true,
+ postprocess = 'latex',
+ opts = {'-d "%o"'},
+ args = {'%b.glo'}, -- "%B.glo" will result in an error
+ },
ps2pdf = {
target = '%B.ps',
generated_target = true,
@@ -180,19 +190,29 @@ function M.get_status(raw)
end
-- Replace config param to filename
-function M.replace_specifiers(str, source, target)
+function M.replace_specifiers(str, source, target, output_directory)
local tmp = '/' .. source
- local basename = tmp:match('^.*/(.*)%..*$')
+ local basename_match = tmp:match('^.*/(.*)%..*$')
str = str:gsub('%%S', source)
str = str:gsub('%%T', target)
- if basename then
- str = str:gsub('%%B', basename)
- else
- str = str:gsub('%%B', source)
+ local sub_basename = source
+ if basename_match then
+ sub_basename = basename_match
end
+ local sub_output_directory = '.'
+ local sub_output_directory_basename = sub_basename
+ if output_directory then
+ sub_output_directory = output_directory
+ sub_output_directory_basename = output_directory .. '/' .. sub_basename
+ end
+
+ str = str:gsub('%%b', sub_basename)
+ str = str:gsub('%%o', sub_output_directory)
+ str = str:gsub('%%B', sub_output_directory_basename)
+
return str
end
@@ -380,7 +400,7 @@ local function update_config(config, tab)
local config = merge_table(config, tab)
-- set essential program names from top-level
- local prg_names = {'latex', 'bibtex', 'makeindex', 'dvipdf', 'dvips', 'ps2pdf'}
+ local prg_names = {'latex', 'bibtex', 'makeindex', 'makeglossaries', 'dvipdf', 'dvips', 'ps2pdf'}
for _, name in pairs(prg_names) do
config = fetch_from_top_level(config, name)
end
@@ -998,7 +1018,7 @@ local function setup_programs(fn, config)
cur_target = fn
else
-- here, %T should be replaced by `fn`
- cur_target = llmk.util.replace_specifiers(prog.target, fn, fn)
+ cur_target = llmk.util.replace_specifiers(prog.target, fn, fn, config.output_directory)
end
prog.target = cur_target
@@ -1018,11 +1038,11 @@ local function setup_programs(fn, config)
if type(prog[k]) == 'table' then
for ik, iv in ipairs(prog[k]) do
if type(prog[k][ik]) == 'string' then
- prog[k][ik] = llmk.util.replace_specifiers(iv, fn, cur_target)
+ prog[k][ik] = llmk.util.replace_specifiers(iv, fn, cur_target, config.output_directory)
end
end
elseif type(prog[k]) == 'string' then
- prog[k] = llmk.util.replace_specifiers(prog[k], fn, cur_target)
+ prog[k] = llmk.util.replace_specifiers(prog[k], fn, cur_target, config.output_directory)
end
end
end
@@ -1087,7 +1107,7 @@ local function init_file_database(programs, fn, config)
return fdb
end
-local function construct_cmd(prog, fn, target)
+local function construct_cmd(prog)
-- construct the option
local cmd_opt = ''
@@ -1213,7 +1233,7 @@ local function run_program(name, prog, fn, fdb, postprocess)
-- does target exist?
if not llmk.core.dry_run and not lfs.isfile(prog.target) then
llmk.util.dbg_print('run',
- 'Skiping "%s" because target (%s) does not exist',
+ 'Skipping "%s" because target (%s) does not exist',
prog.command, prog.target)
return false
end
@@ -1225,7 +1245,7 @@ local function run_program(name, prog, fn, fdb, postprocess)
prog.target)
elseif file_mtime(prog.target) < start_time then
llmk.util.dbg_print('run',
- 'Skiping "%s" because target (%s) is not updated',
+ 'Skipping "%s" because target (%s) is not updated',
prog.command, prog.target)
return false
end
@@ -1235,7 +1255,7 @@ local function run_program(name, prog, fn, fdb, postprocess)
end
end
- local cmd = construct_cmd(prog, fn, prog.target)
+ local cmd = construct_cmd(prog)
if llmk.core.dry_run then
print('Dry running: ' .. cmd)
if #cond > 0 then
@@ -1306,6 +1326,11 @@ function M.run_sequence(fn, config)
llmk.util.dbg_print('fdb', 'The initial file database is as follows:')
llmk.util.dbg_print_table('fdb', fdb)
+ -- check if output directory exists
+ if config.output_directory and not lfs.isdir(config.output_directory) then
+ llmk.util.err_print('error', 'Output directory does not exist "%s"', config.output_directory)
+ end
+
for _, name in ipairs(config.sequence) do
llmk.util.dbg_print('run', 'Preparing for program "%s"', name)
process_program(programs, name, fn, fdb, config)
@@ -1336,9 +1361,9 @@ local function remove(fn)
end
end
-local function replace_spec_and_remove_files(fns, source)
+local function replace_spec_and_remove_files(fns, source, output_directory)
for _, fn in ipairs(fns) do
- local replaced_fn = llmk.util.replace_specifiers(fn, source, source)
+ local replaced_fn = llmk.util.replace_specifiers(fn, source, source, output_directory)
if lfs.isfile(replaced_fn) then
remove(replaced_fn)
end
@@ -1348,16 +1373,16 @@ end
-- the actual process for the --clean action
function M.clean(fn, config)
llmk.util.err_print('info', 'Begining cleaning for "%s"', fn)
- replace_spec_and_remove_files(config.clean_files, fn)
- replace_spec_and_remove_files(config.extra_clean_files, fn)
+ replace_spec_and_remove_files(config.clean_files, fn, config.output_directory)
+ replace_spec_and_remove_files(config.extra_clean_files, fn, config.output_directory)
end
-- the actual process for the --clobber action
function M.clobber(fn, config)
llmk.util.err_print('info', 'Begining clobbering for "%s"', fn)
- replace_spec_and_remove_files(config.clean_files, fn)
- replace_spec_and_remove_files(config.extra_clean_files, fn)
- replace_spec_and_remove_files(config.clobber_files, fn)
+ replace_spec_and_remove_files(config.clean_files, fn, config.output_directory)
+ replace_spec_and_remove_files(config.extra_clean_files, fn, config.output_directory)
+ replace_spec_and_remove_files(config.clobber_files, fn, config.output_directory)
end
llmk.cleaner = M
@@ -1460,7 +1485,7 @@ local function read_options()
elseif (curr_arg == '-V') or (curr_arg == '--version') then
return 'version' -- immediately show version
elseif (curr_arg == '-c') or (curr_arg == '--clean') then
- action = 'clean'
+ action = 'clean'
elseif (curr_arg == '-C') or (curr_arg == '--clobber') then
action = 'clobber'
-- debug