summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-01-23 21:25:54 +0000
committerKarl Berry <karl@freefriends.org>2024-01-23 21:25:54 +0000
commit9e5e57a40ed20d36034d87d882b8e0ad3bf7e6f9 (patch)
tree80ccc89b5fc339de269588114568efb87fdfee2a /Master/texmf-dist/scripts
parent6c003d9690c315f3be13f4356118ee3abddeb8bb (diff)
lua-placeholders (23jan24)
git-svn-id: svn://tug.org/texlive/trunk@69566 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rw-r--r--Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-parser.lua21
-rw-r--r--Master/texmf-dist/scripts/lua-placeholders/lua-placeholders.lua4
2 files changed, 18 insertions, 7 deletions
diff --git a/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-parser.lua b/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-parser.lua
index 1fa43227a48..3583c09a28e 100644
--- a/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-parser.lua
+++ b/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-parser.lua
@@ -22,6 +22,12 @@ local LUA_VERSION = string.sub(_VERSION, 5, -1)
yaml_supported = false
+-- Check for tiny yaml as YAML fallback option
+local tiny_found, tiny = pcall(require,'tinyyaml')
+if tiny_found then
+ texio.write_nl('Found fallback support for YAML (tiny yaml)')
+end
+
-- Check if LUA_PATH is set
local current_path = os.getenv('LUA_PATH')
if current_path then
@@ -44,6 +50,9 @@ else
texio.write_nl('Info: Setting LUA_CPATH from LuaRocks', lua_cpath)
package.cpath = lua_cpath
end
+ elseif tiny_found then
+ texio.write_nl('Warning: could\'t find LuaRocks installation')
+ texio.write_nl('Info: falling back to tiny yaml implementation')
else
texio.write_nl('Error: couldn\'t find LuaRocks installation')
texio.write_nl("Info: LUA PATH:\n\t" .. string.gsub(package.path, ';', '\n\t') .. '\n\n')
@@ -59,12 +68,12 @@ require('lualibs')
-- Require YAML configuration files
-- Make sure to have the apt package lua-yaml installed
-local status, yaml = pcall(require, 'lyaml')
-if status then
+local lyaml_found, lyaml = pcall(require, 'lyaml')
+if lyaml_found or tiny_found then
yaml_supported = true
else
texio.write_nl('Warning: No YAML support.')
- texio.write_nl(yaml)
+ texio.write_nl(lyaml)
texio.write_nl('Info: Falling back to JSON.')
end
@@ -79,8 +88,10 @@ return function(filename)
if ext == 'json' then
return utilities.json.tolua(raw)
else
- if yaml_supported then
- return yaml.load(raw)
+ if lyaml_found then
+ return lyaml.load(raw)
+ elseif tiny_found then
+ return tiny.parse(raw)
else
tex.error('Error: no YAML support!')
end
diff --git a/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders.lua b/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders.lua
index 255b4d1f26a..181676679ce 100644
--- a/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders.lua
+++ b/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders.lua
@@ -23,8 +23,8 @@ if not modules then
end
modules.lua_placeholders = {
- version = "0.1.0",
- date = "2024/01/12",
+ version = "1.0.0",
+ date = "2024/01/23",
comment = 'Extended LaTeX Parameter Interface — for specifying and inserting document parameters',
author = 'Erik Nijenhuis',
license = 'free'