diff options
author | Norbert Preining <norbert@preining.info> | 2024-02-22 03:04:08 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-02-22 03:04:08 +0000 |
commit | 286abb7dcd6c03d7edcd3d3435bb97448074c3cf (patch) | |
tree | 3685af864920886e709e60d4c0383f62d2af85fb /macros/luatex/latex/lua-placeholders | |
parent | 2f56d3421e4663856409792eb5b08a2c57b38a8c (diff) |
CTAN sync 202402220303
Diffstat (limited to 'macros/luatex/latex/lua-placeholders')
-rw-r--r-- | macros/luatex/latex/lua-placeholders/README.md | 1 | ||||
-rw-r--r-- | macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.pdf | bin | 67367 -> 66376 bytes | |||
-rw-r--r-- | macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.tex | 2 | ||||
-rw-r--r-- | macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf | bin | 270175 -> 269309 bytes | |||
-rw-r--r-- | macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.tex | 2 | ||||
-rw-r--r-- | macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-parser.lua | 4 | ||||
-rw-r--r-- | macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-types.lua | 15 | ||||
-rw-r--r-- | macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua | 12 | ||||
-rw-r--r-- | macros/luatex/latex/lua-placeholders/tex/lua-placeholders.sty | 2 |
9 files changed, 27 insertions, 11 deletions
diff --git a/macros/luatex/latex/lua-placeholders/README.md b/macros/luatex/latex/lua-placeholders/README.md index 9d2c9ef966..6859910816 100644 --- a/macros/luatex/latex/lua-placeholders/README.md +++ b/macros/luatex/latex/lua-placeholders/README.md @@ -1,4 +1,5 @@ # Lua(TeX) Placeholders +![CTAN Version](https://img.shields.io/ctan/v/lua-placeholders) 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 Binary files differindex 35fd39899f..979941c702 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 diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.tex b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.tex index 12d60b796d..21ed872646 100644 --- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.tex +++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.tex @@ -19,7 +19,7 @@ \documentclass{article} \usepackage{gitinfo-lua} -\usepackage{../../tex/lua-placeholders} +\usepackage{lua-placeholders} \usepackage{listings} \usepackage{amsmath} \usepackage{calc} diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf Binary files differindex 1a84db82dd..2054633991 100644 --- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf +++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf 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 4a7d885ea6..210270b939 100644 --- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.tex +++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.tex @@ -215,7 +215,7 @@ \clearpage - \section{Changelog} + \section{Change Log} \newcommand\commitline[3]{\item #1\ifx&% \else\\[1em] #3\fi\\\hspace*{1em} — \printdate{#2}} 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 3583c09a28..4a0304c463 100644 --- a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-parser.lua +++ b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-parser.lua @@ -32,7 +32,7 @@ end local current_path = os.getenv('LUA_PATH') if current_path then texio.write_nl('Info: LUA path setup up correctly. Great job!') -else +elseif not tiny_found then -- Set the LUA_PATH and LUA_CPATH using 'luarocks -lua-version <LuaLaTeX version> path' texio.write_nl('Warning: No LUA_PATH set. Looking for LuaRocks installation...') local handle = io.popen('luarocks --lua-version ' .. LUA_VERSION .. ' path') @@ -60,6 +60,8 @@ else else tex.error('Error: could not open a shell. Is shell-escape turned on?') end +else + texio.write_nl('Warning: no LUA_PATH set.') end texio.write_nl('\n') diff --git a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-types.lua b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-types.lua index bb6abafdb1..d640de626c 100644 --- a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-types.lua +++ b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-types.lua @@ -104,13 +104,22 @@ str_param = base_param:new{ function str_param:new(key, _o) local o = { key = key, - placeholder = _o.placeholder + placeholder = _o.placeholder, + default = _o.default } setmetatable(o, self) self.__index = self return o end +function str_param:val() + local value = self:raw_val() + if value then + local formatted, _ = string.gsub(value, '\n', ' ') + return formatted + end +end + number_param = base_param:new{ type = 'number' } @@ -127,14 +136,14 @@ function number_param:new(key, _o) end function number_param:raw_val() - if self.value or self.default then + if self.value ~= nil or self.default ~= nil then return self.value or self.default end end function number_param:val() local val = self:raw_val() - if val then + if val ~= nil then if token.is_defined('numprint') then return '\\numprint{' .. val .. '}' else diff --git a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua index 832e0106eb..24f0a6c5ca 100644 --- a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua +++ b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua @@ -23,9 +23,9 @@ if not modules then end modules.lua_placeholders = { - version = "1.0.1", - date = "2024/02/12", - comment = 'Extended LaTeX Parameter Interface — for specifying and inserting document parameters', + version = "1.0.2", + date = "2024/02/21", + comment = 'Lua Placeholders — for specifying and inserting document parameters', author = 'Erik Nijenhuis', license = 'free' } @@ -200,7 +200,11 @@ function api.with_rows(key, namespace, csname) texio.write_nl("Warning: no values set for " .. param.key) local format = row_content for col_key, col in pairs(param.columns) do - format = format:gsub('\\' .. col_key, '{\\paramplaceholder{' .. (col.placeholder or col_key) .. '}}') + if col.default ~= nil then + format = format:gsub('\\' .. col_key, col:val()) + else + format = format:gsub('\\' .. col_key, '{\\paramplaceholder{' .. (col.placeholder or col_key) .. '}}') + end end tex.print(format) else diff --git a/macros/luatex/latex/lua-placeholders/tex/lua-placeholders.sty b/macros/luatex/latex/lua-placeholders/tex/lua-placeholders.sty index d467033c11..1d2a26f720 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/12 1.0.1 Extended LaTeX Paramter Interface Package] +\ProvidesPackage{lua-placeholders}[2024/02/21 1.0.2 Lua Placeholders Package] \RequirePackage{ifthen} \RequirePackage{luapackageloader} |