summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-01-12 21:45:17 +0000
committerKarl Berry <karl@freefriends.org>2024-01-12 21:45:17 +0000
commit92923b59b9d97aed633e13ae96acde1946ee7af5 (patch)
tree2555be7ab687a7b516f6d2dd1036160ee70553fe /Master/texmf-dist/tex/lualatex
parent8aeda3e1019bc7b0493c228b2c9487b0f3636964 (diff)
lua-placeholders (12jan24)
git-svn-id: svn://tug.org/texlive/trunk@69404 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
-rw-r--r--Master/texmf-dist/tex/lualatex/lua-placeholders/lua-placeholders.sty55
1 files changed, 55 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/lualatex/lua-placeholders/lua-placeholders.sty b/Master/texmf-dist/tex/lualatex/lua-placeholders/lua-placeholders.sty
new file mode 100644
index 00000000000..9a2c2479622
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/lua-placeholders/lua-placeholders.sty
@@ -0,0 +1,55 @@
+%% lua-placeholders.sty
+%% Copyright 2024 E. Nijenhuis
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status ‘maintained’.
+%
+% The Current Maintainer of this work is E. Nijenhuis.
+%
+% This work consists of the files lua-placeholders.sty
+% lua-placeholders-manual.pdf lua-placeholders.lua
+% lua-placeholders-common.lua lua-placeholders-namespace.lua
+% lua-placeholders-parser.lua and lua-placeholders-types.lua
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{lua-placeholders}[2024/01/12 Extended LaTeX Paramter Interface Package]
+
+\RequirePackage{ifthen}
+\RequirePackage{luapackageloader}
+\RequirePackage{textcomp}
+\RequirePackage{xspace}
+
+\newcommand\curnamespace{\jobname}
+\newcommand\paramplaceholder[1]{\texttt{\textbf{[}#1\textbf{]}}}
+\newcommand\paramnotfound[1]{\paramplaceholder{{\textnormal{\textlangle unknown\textrangle}} #1}}
+\newcommand\paramlistconjunction{,~}
+
+\directlua{lua_placeholders = require('lua-placeholders')}
+
+\newcommand\setnamespace[1]{\renewcommand\curnamespace{#1}}
+\newcommand\strictparams{\directlua{lua_placeholders.set_strict()}}
+\newcommand%! suppress = NonMatchingIf
+\ifparam[4][\curnamespace]{%
+ \directlua{local p = lua_placeholders.param_object('#2','#1') if p then p:set_bool('#2') end}%
+ \ifthenelse{\boolean{#2}}{#3}{#4}}
+\newcommand\param[2][\curnamespace]{\directlua{lua_placeholders.param('#2', '#1')}}
+\newcommand\PARAM[2][\curnamespace]{\directlua{local p = lua_placeholders.param_object('#2', '#1') if p then tex.print(p:to_upper()) end}}
+\def\rawparam#1#2{\directlua{local p = lua_placeholders.param_object('#2', '#1') if p then tex.print(p:val() or p.default or p.placeholder) end}}
+\newcommand\numparam[2][\curnamespace]{\directlua{local n = lua_placeholders.param_object('#2', '#1') if n then n:print_num() end}}
+\newcommand\hasparam[4][\curnamespace]{%
+ \def\has@param@true{#3}%
+ \def\has@param@false{#4}%
+ \directlua{lua_placeholders.handle_param_is_set('#2', '#1')}}
+\newcommand\paramfield[3][\curnamespace]{\directlua{lua_placeholders.field('#2','#3', '#1')}}
+\newenvironment{paramobject}[2][\curnamespace]{\directlua{lua_placeholders.with_object('#2', '#1')}}{}
+\newcommand\forlistitem[3][\curnamespace]{\directlua{lua_placeholders.for_item('#2', '#1', '#3')}}
+\newcommand\fortablerow[3][\curnamespace]{\directlua{lua_placeholders.with_rows('#2', '#1', '#3')}}
+\newcommand\loadrecipe[2][]{\directlua{lua_placeholders.recipe('#2', '#1')}}
+\newcommand\loadpayload[2][]{\directlua{lua_placeholders.payload('#2', '#1')}}