From 9e5e57a40ed20d36034d87d882b8e0ad3bf7e6f9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 23 Jan 2024 21:25:54 +0000 Subject: lua-placeholders (23jan24) git-svn-id: svn://tug.org/texlive/trunk@69566 c570f23f-e606-0410-a88d-b1316a301751 --- .../lua-placeholders/lua-placeholders-deps.bib | 6 ++++++ .../lua-placeholders-example/example.pdf | Bin 67505 -> 67759 bytes .../lua-placeholders/lua-placeholders-manual.pdf | Bin 256425 -> 257529 bytes .../lua-placeholders/lua-placeholders-manual.tex | 12 ++++++------ .../lua-placeholders/lua-placeholders-parser.lua | 21 ++++++++++++++++----- .../scripts/lua-placeholders/lua-placeholders.lua | 4 ++-- .../lualatex/lua-placeholders/lua-placeholders.sty | 2 +- 7 files changed, 31 insertions(+), 14 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-deps.bib b/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-deps.bib index 2e80c1b2697..c5ecf4484ce 100644 --- a/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-deps.bib +++ b/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-deps.bib @@ -1,4 +1,10 @@ +@misc{tiny, + title = {lua-tinyyaml}, + note = {Accessed: 23 January, 2024}, + howpublished = {\url{https://ctan.org/pkg/lua-tinyyaml} and \url{https://github.com/api7/lua-tinyyaml}}, +} + @misc{lyaml, title = {lyaml}, author = {Andrew Danforth}, diff --git a/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-example/example.pdf b/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-example/example.pdf index fcdf27afabf..1b9ff4a52f4 100644 Binary files a/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-example/example.pdf and b/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-example/example.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-manual.pdf b/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-manual.pdf index 499978dbf0a..b9bb4a02381 100644 Binary files a/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-manual.pdf and b/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-manual.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-manual.tex b/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-manual.tex index 776ad3af5dc..c6181466376 100644 --- a/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-manual.tex +++ b/Master/texmf-dist/doc/lualatex/lua-placeholders/lua-placeholders-manual.tex @@ -13,9 +13,10 @@ % % 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 +% 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 \documentclass{ltxdoc} \usepackage[english]{babel} @@ -84,7 +85,6 @@ \begin{enumerate}[align=left] \item The package only works with Lua\LaTeX{}. \item In order for the files to be loaded, commandline option `\texttt{--shell-escape}' is required. - \item For YAML support, there needs to be a Lua setup with certain dependencies, which can be quite hard to setup on some systems. \end{enumerate} \subsection{Prerequisites} @@ -94,7 +94,7 @@ This also includes the \texttt{libYAML}\cite{libYAML} platform dependent library and optionally LuaRocks for installing \texttt{lyaml}. Another requirement is Lua, which version meets the Lua version used by Lua\TeX{}. If no \texttt{LUA\_PATH} is set, and you use LuaRocks, this package tries to call the LuaRocks executable to find the \texttt{LUA\_PATH}. - If \texttt{lyaml} can't be loaded, this package will fall back on accepting JSON files only. + If \texttt{lyaml} can't be loaded, this package will first try to fall back with \texttt{lua-tinyyaml}\cite{tiny} for lesser YAML support and secondly fall back on accepting JSON files only. \clearpage \section{Usage} @@ -210,7 +210,7 @@ The source file \texttt{example.tex} is a perfect demonstration of all macros in action. It shows perfectly what happens when there's a \meta{payload} file loaded and when not. - The result of this example \attachfile[icon=Paperclip,description={ELPI Example v\gitversion}]{lua-placeholders-example/example.pdf} is attached in the digital version of this document. + The result of this example \attachfile[icon=Paperclip,description={Lua Parameters Example v\gitversion}]{lua-placeholders-example/example.pdf} is attached in the digital version of this document. \lstinputlisting[language={[LaTeX]TeX},frame=single,caption={\ttfamily example.tex},captionpos=t,numbers=left,keywordsprefix={\\},firstnumber=20,firstline=20,columns=fullflexible]{lua-placeholders-example/example.tex} \end{document} 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' diff --git a/Master/texmf-dist/tex/lualatex/lua-placeholders/lua-placeholders.sty b/Master/texmf-dist/tex/lualatex/lua-placeholders/lua-placeholders.sty index 9a2c2479622..e11b950f5aa 100644 --- a/Master/texmf-dist/tex/lualatex/lua-placeholders/lua-placeholders.sty +++ b/Master/texmf-dist/tex/lualatex/lua-placeholders/lua-placeholders.sty @@ -19,7 +19,7 @@ % lua-placeholders-parser.lua and lua-placeholders-types.lua \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lua-placeholders}[2024/01/12 Extended LaTeX Paramter Interface Package] +\ProvidesPackage{lua-placeholders}[2024/01/23 1.0.0 Extended LaTeX Paramter Interface Package] \RequirePackage{ifthen} \RequirePackage{luapackageloader} -- cgit v1.2.3