summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-02-13 23:52:44 +0000
committerKarl Berry <karl@freefriends.org>2024-02-13 23:52:44 +0000
commit205c0cf1e1b3eaad8c3e71a7e462002ebd4698aa (patch)
treec1e642665cf5b7bc1c4053010fd73c9341649368 /Master/texmf-dist/scripts
parentec625156dd4a1a11b0d0fcdce48a1397b1c73e22 (diff)
lua-placeholders (14feb24)
git-svn-id: svn://tug.org/texlive/trunk@69845 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rw-r--r--Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-namespace.lua2
-rw-r--r--Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-types.lua32
-rw-r--r--Master/texmf-dist/scripts/lua-placeholders/lua-placeholders.lua4
3 files changed, 25 insertions, 13 deletions
diff --git a/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-namespace.lua b/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-namespace.lua
index fb84447a251..bca680769f8 100644
--- a/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-namespace.lua
+++ b/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-namespace.lua
@@ -66,7 +66,7 @@ function namespace:load_payload(values)
else
texio.write_nl('Warning: passed an unknown key ' .. key)
end
- texio.write_nl('Key' .. key)
+ texio.write_nl('Info: loaded key ' .. key)
end
else
texio.write_nl('Warning: Payload file was empty')
diff --git a/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-types.lua b/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-types.lua
index faa637c8f78..bb6abafdb18 100644
--- a/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-types.lua
+++ b/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders-types.lua
@@ -40,10 +40,14 @@ function base_param:is_set()
return self and ((self.values or self.fields or self.value) ~= nil)
end
-function base_param:val()
+function base_param:raw_val()
return self.value or self.values or self.default
end
+function base_param:val()
+ return self:raw_val()
+end
+
function base_param:to_upper()
local val = self:val()
if type(val) == 'string' then
@@ -56,7 +60,7 @@ end
function base_param:print_val()
local value = self:val()
if value ~= nil then
- tex.write(value)
+ tex.sprint(value)
else
tex.sprint(lua_placeholders_toks.placeholder_format, '{', self.placeholder or self.key, '}')
end
@@ -77,7 +81,7 @@ function bool_param:new(key, _o)
return o
end
-function bool_param:val()
+function bool_param:raw_val()
local value
if self.value ~= nil then
value = tostring(self.value)
@@ -122,21 +126,29 @@ function number_param:new(key, _o)
return o
end
-function number_param:val()
+function number_param:raw_val()
if self.value or self.default then
- return tex.number(self.value or self.default)
+ return self.value or self.default
end
end
-function number_param:print_num()
- local val = self:val()
+function number_param:val()
+ local val = self:raw_val()
if val then
- tex.print('\\numprint{' .. val .. '}')
- else
- tex.sprint(lua_placeholders_toks.placeholder_format, '{', self.placeholder or self.key, '}')
+ if token.is_defined('numprint') then
+ return '\\numprint{' .. val .. '}'
+ else
+ texio.write_nl([[Warning: package 'numprint' not loaded. Outputting numbers as is.]])
+ return val
+ end
end
end
+function number_param:print_num()
+ texio.write_nl('Warning: number_param:print_num is deprecated. Use number_param:print_val instead')
+ self:print_val()
+end
+
list_param = base_param:new{
type = 'list'
}
diff --git a/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders.lua b/Master/texmf-dist/scripts/lua-placeholders/lua-placeholders.lua
index 181676679ce..832e0106eb2 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 = "1.0.0",
- date = "2024/01/23",
+ version = "1.0.1",
+ date = "2024/02/12",
comment = 'Extended LaTeX Parameter Interface — for specifying and inserting document parameters',
author = 'Erik Nijenhuis',
license = 'free'