texlive[71840] trunk: latexindent (19jul24)
commits+karl at tug.org
commits+karl at tug.org
Fri Jul 19 22:28:27 CEST 2024
Revision: 71840
https://tug.org/svn/texlive?view=revision&revision=71840
Author: karl
Date: 2024-07-19 22:28:27 +0200 (Fri, 19 Jul 2024)
Log Message:
-----------
latexindent (19jul24)
Modified Paths:
--------------
trunk/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl
trunk/Build/source/texk/texlive/linked_scripts/texlive/extractbb.lua
trunk/Master/bin/windows/latexindent.exe
trunk/Master/texmf-dist/doc/support/latexindent/README
trunk/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json
trunk/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm
trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
trunk/Master/texmf-dist/scripts/latexindent/latexindent.pl
Modified: trunk/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl
===================================================================
(Binary files differ)
Modified: trunk/Build/source/texk/texlive/linked_scripts/texlive/extractbb.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/texlive/extractbb.lua 2024-07-18 23:42:03 UTC (rev 71839)
+++ trunk/Build/source/texk/texlive/linked_scripts/texlive/extractbb.lua 2024-07-19 20:28:27 UTC (rev 71840)
@@ -1,14 +1,14 @@
#!/usr/bin/env texlua
--- $Id: extractbb.lua 71746 2024-07-08 21:16:39Z karl $
+-- $Id: extractbb.lua 71832 2024-07-18 09:36:59Z mseven $
-- SPDX-License-Identifier: CC0-1.0
-- SPDX-FileCopyrightText: 2024 Max Chernoff
--
-- A generic wrapper to make commands safe to run with restricted shell escape.
---
+--
-- Originally created for extractbb, which is listed in shell_escape_commands,
-- but can be run as dvipdfm(x), which in turn can run arbitrary commands
-- using its -D option.
---
+--
-- The idea is to exec "ebb --ebb <other args>", since only argv[1] is
-- used by dvipdfmx to determine its behavior.
--
@@ -21,7 +21,7 @@
--[=[
arg[0] = arg[0]:gsub("extractbb", "ebb")
table.insert(arg, 1, "ebb")
-table.insert(arg, 2, "--ebb")
+table.insert(arg, 2, "--extractbb")
os.exec(arg)
os.exit(1)
--]=]
@@ -33,10 +33,6 @@
-- The base name of this script. (Example: ``extractbb'')
local SCRIPT_NAME = "extractbb"
--- The extension of the script. Extensionless-names are also permitted.
--- (Example: ``lua'')
-local SCRIPT_EXT = "lua"
-
-- The base name of the path to the target program. (Example: ``xdvipdfmx'')
local TARGET_PATH_NAME = "xdvipdfmx"
@@ -88,9 +84,24 @@
----------------------------
-- Error messages
-local function error(message)
- io.stderr:write("! ERROR (extractbb.lua): " .. message, "\n")
+local function error(title, details)
+ -- Header
+ io.stderr:write("! extractbb ERROR: ")
+ io.stderr:write(title)
+ io.stderr:write(".\n\nTechnical Details:\n")
+
+ -- Messages
+ for key, value in pairs(details) do
+ io.stderr:write(tostring(key), ": ")
+ io.stderr:write("(", type(value), ") ")
+ io.stderr:write(tostring(value), "\n")
+ end
+
+ -- Traceback
+ io.stderr:write("\n")
io.stderr:write(debug.traceback(nil, 2), "\n")
+
+ -- Flush and exit
io.stderr:flush()
os.exit(1)
end
@@ -146,11 +157,15 @@
-- Make sure that we're running unrestricted.
if status.shell_escape ~= 1 then
- error("Shell escape has been disabled.")
+ error("Shell escape has been disabled", {
+ shell_escape = status.shell_escape,
+ })
end
if status.safer_option ~= 0 then
- error("The ``safer'' option has been enabled.")
+ error("The ``safer'' option has been enabled", {
+ safer_option = status.safer_option,
+ })
end
-- Set the file permissions.
@@ -162,58 +177,33 @@
os.setenv("openout_any", WRITE_PERMS)
end
--- Get the directory of the script and interpreter
-local script_path = debug.getinfo(1, "S").source:sub(2)
-local script_dir, script_name, script_ext = split_path(script_path)
+-- Get the location of the interpreter
+local interpreter_dir = os.selfdir or kpse.var_value("SELFAUTOLOC")
+local _, interpreter_name, interpreter_ext = split_path(script_args[-1])
-local interpreter_dir = kpse.var_value("SELFAUTOLOC")
-local _, interpreter_name, interpreter_ext = split_path(script_args[-1])
-if os.type == 'windows' then
+if os.type == "windows" then
interpreter_ext = INTERPRETER_EXT
end
--- Look up the script again with kpathsea
-local resolved_script_path = kpse.find_file(
- script_name .. "." .. (script_ext or SCRIPT_EXT), "texmfscripts", true
-)
--- Make sure that our paths are correct
-if not script_dir then
- error("Empty script dir")
-end
+-- Error details
+local error_details = {
+ interpreter_dir = interpreter_dir or "<nil>",
+ interpreter_name = interpreter_name or "<nil>",
+ interpreter_ext = interpreter_ext or "<nil>",
+ os_type = os.type or "<nil>",
+ os_name = os.name or "<nil>",
+}
-if not resolved_script_path then
- error("Empty resolved script path")
-end
-
--- But on Macs we get /Library/TeX/texbin. What to do?
--- (Frank msg to tex-live 8jul24.)
--- if (script_dir ~= interpreter_dir) and (script_path ~= resolved_script_path) then
--- error("The script is in an incorrect location: " .. script_dir)
--- end
-
-if script_name ~= SCRIPT_NAME then
- error("Incorrect script name: " .. script_name)
-end
-
-if interpreter_name ~= INTERPRETER_NAME then
- error("Incorrect interpreter name: " .. interpreter_name)
-end
-
-if (script_ext ~= SCRIPT_EXT) and (script_ext ~= nil) then
- error("Incorrect script extension: " .. script_ext)
-end
-
-if (interpreter_ext ~= INTERPRETER_EXT) and (interpreter_ext ~= nil) then
- error("Incorrect interpreter extension: " .. interpreter_ext)
-end
-
-- Get the path to the target program
local target_ext = interpreter_ext and ("." .. interpreter_ext) or ""
local target_path = interpreter_dir .. "/" .. TARGET_PATH_NAME .. target_ext
+error_details.target_path = target_path or "<nil>"
+error_details.target_ext = target_ext or "<nil>"
+
-- Make sure that the target program exists
if not file_exists(target_path) then
- error("The target program does not exist: " .. target_path)
+ error("The target program does not exist", error_details)
end
@@ -234,7 +224,13 @@
for i = 1, #script_args do
-- We use a numeric iterator here to avoid ``arg[-1]'' and ``arg[0]''.
- insert(target_args, script_args[i])
+ local this_arg = script_args[i]
+ insert(target_args, this_arg)
+
+ -- Show version information
+ if this_arg:match("%-version") then
+ print("(Wrapped by extractbb.lua $Revision: 71832 $.)")
+ end
end
for _, arg in ipairs(TARGET_APPEND_ARGS) do
@@ -244,6 +240,10 @@
-- Run the target program, replacing the current process
local _, err = os.exec(target_args)
-if err then
- error("The target program failed to run.")
+-- Unreachable except in the case of a failed exec
+for key, value in ipairs(target_args) do
+ error_details["target_args[" .. key .. "]"] = value
end
+
+error_details.exec_message = err or "<nil>"
+error("The target program failed to run", error_details)
Modified: trunk/Master/bin/windows/latexindent.exe
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/support/latexindent/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/README 2024-07-18 23:42:03 UTC (rev 71839)
+++ trunk/Master/texmf-dist/doc/support/latexindent/README 2024-07-19 20:28:27 UTC (rev 71840)
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- latexindent.pl, version 3.24.3, 2024-07-14
+ latexindent.pl, version 3.24.4, 2024-07-18
PERL script to indent code within environments, and align delimited
environments in .tex files.
Modified: trunk/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json 2024-07-18 23:42:03 UTC (rev 71839)
+++ trunk/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json 2024-07-19 20:28:27 UTC (rev 71840)
@@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/schema",
"$id": "latexindent-yaml-schema.json",
"title": "latexindent.pl YAML schema",
- "description": "latexindent.pl YAML schema helper, V3.24.3 2024-07-14",
+ "description": "latexindent.pl YAML schema helper, V3.24.4 2024-07-18",
"type": "object",
"properties": {
"fileExtensionPreference": {
Modified: trunk/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm 2024-07-18 23:42:03 UTC (rev 71839)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm 2024-07-19 20:28:27 UTC (rev 71840)
@@ -20,6 +20,6 @@
use Exporter qw/import/;
our @EXPORT_OK = qw/$versionNumber $versionDate/;
-our $versionNumber = '3.24.3';
-our $versionDate = '2024-07-14';
+our $versionNumber = '3.24.4';
+our $versionDate = '2024-07-18';
1
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm 2024-07-18 23:42:03 UTC (rev 71839)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm 2024-07-19 20:28:27 UTC (rev 71840)
@@ -659,6 +659,13 @@
# call the text wrapping routine
my $columns = ${ $mainSettings{modifyLineBreaks}{textWrapOptions} }{columns};
+ # fail gracefully if columns == 0
+ if ($columns==0){
+ $logger->warn("* textWrapOptions: columns is set to 0, can't text wrap with this");
+ ${ ${ $mainSettings{modifyLineBreaks}{textWrapOptions} }{comments} }{wrap} = 0;
+ return;
+ }
+
#
# text wrap comment blocks
#
Modified: trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml 2024-07-18 23:42:03 UTC (rev 71839)
+++ trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml 2024-07-19 20:28:27 UTC (rev 71840)
@@ -1,5 +1,5 @@
#
-# latexindent.pl, version 3.24.3, 2024-07-14
+# latexindent.pl, version 3.24.4, 2024-07-18
#
# defaultSettings.yaml, the default settings for latexindent.pl
#
Modified: trunk/Master/texmf-dist/scripts/latexindent/latexindent.pl
===================================================================
(Binary files differ)
More information about the tex-live-commits
mailing list.