summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-02-25 22:14:36 +0000
committerKarl Berry <karl@freefriends.org>2022-02-25 22:14:36 +0000
commit7ad11d496d8b859868ec23586cb099b6b48eb9b4 (patch)
treef485d67181de27b62d5fcbc5cd30ca9d16b2c473 /Master
parent75eb24771faf3783171e71e4f9e84ccdf553cc2a (diff)
yamlvars (25feb22)
git-svn-id: svn://tug.org/texlive/trunk@62176 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf (renamed from Master/texmf-dist/doc/lualatex/yamlvars/YAMLvars.pdf)bin69229 -> 69483 bytes
-rw-r--r--Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.tex (renamed from Master/texmf-dist/doc/lualatex/yamlvars/YAMLvars.tex)10
-rw-r--r--Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua (renamed from Master/texmf-dist/tex/lualatex/yamlvars/YAMLvars.lua)12
-rw-r--r--Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty (renamed from Master/texmf-dist/tex/lualatex/yamlvars/YAMLvars.sty)5
4 files changed, 17 insertions, 10 deletions
diff --git a/Master/texmf-dist/doc/lualatex/yamlvars/YAMLvars.pdf b/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf
index 974873680d8..bdb6b811da3 100644
--- a/Master/texmf-dist/doc/lualatex/yamlvars/YAMLvars.pdf
+++ b/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/lualatex/yamlvars/YAMLvars.tex b/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.tex
index 057aac5d39d..a61df030241 100644
--- a/Master/texmf-dist/doc/lualatex/yamlvars/YAMLvars.tex
+++ b/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.tex
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2022-01-18
+% 2022-02-25
% Copyright (C) 2021-2022 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -101,8 +101,8 @@ An example is showin in Section \ref{example}.
\hspace*{3ex}\llcmd{allowundeclared}%
It might be helpful to define something in your YAML parsing doc without declaring it.
-If you want this flexibility, use this setting. Note that eisting definitions will not be overwritten and an error
-will br thrown if the name exists.
+If you want this flexibility, use this setting. Note that existing definitions will not be overwritten and an error
+will br thrown if the name exists. Alternatively, you can use the commands \cmd{\AllowUndeclaredYV} or \cmd{\ForbidUndeclaredYV} to toggle this behavior.
\llcmd{overwritedefs}Danger! This will allow you to \cmd{gdef} commands with YAML. Caution should be taken to not set definitions like \cmd{begin}, \cmd{section}, etc.
@@ -186,14 +186,14 @@ Here is an example of a parsing document.
\begin{verbatim}
-\begin{declareYAMLvars}
+\begin{parseYAMLvars}
Location: Planet Earth
People: # a YAML list
- Some One # turns into Lua table
- No Body
# company assumed Amazon if not set here
Rhead: \today
-\end{declareYAMLvars}
+\end{parseYAMLvars}
\end{verbatim}
diff --git a/Master/texmf-dist/tex/lualatex/yamlvars/YAMLvars.lua b/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua
index 93234e5d596..1f95a50f250 100644
--- a/Master/texmf-dist/tex/lualatex/yamlvars/YAMLvars.lua
+++ b/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua
@@ -1,5 +1,5 @@
--% Kale Ewasiuk (kalekje@gmail.com)
---% 2022-01-18
+--% 2022-02-25
--% Copyright (C) 2021-2022 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -56,9 +56,9 @@ YAMLvars.dec = {} -- table of declare function
YAMLvars.varsvals = {}
YAMLvars.varspecs = {}
+YAMLvars.xfmDefault = {}
YAMLvars.prcDefault = 'gdef'
YAMLvars.dftDefault = nil
-YAMLvars.xfmDefault = {}
YAMLvars.allowUndeclared = false
YAMLvars.overwritedefs = false
@@ -83,7 +83,7 @@ end
-- xfm functions (transforms) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function YAMLvars.xfm.addxspace(var, val)
- return val .. '\\xspace{}'
+ return val .. '\\xspace'
end
function YAMLvars.xfm.tab2arr(var, val)
@@ -348,6 +348,11 @@ end
local _YV_invalid_expression = '\1 invalid expression'
local _YV_no_return = '\2 no return val'
+
+local function expr_err(var, val)
+ tex.print('\\PackageError{YAMLvars}{xfm with "= or /" error on var "'..var..'"}{}') -- todo make program stop
+end
+
local function eval_expr(func, var, val)
local s, c = func:gsub('^[=/]', {['/'] = '\2', ['='] = 'YAMLvars.valTemp = '}, 1) -- / is run code, = sets val = code
if c == 0 then
@@ -367,6 +372,7 @@ local function eval_expr(func, var, val)
tex.print('\\PackageError{YAMLvars}{xfm with "= or /" error on var "'..var..'"}{}') --
end
if c > 0 then
+ expr_err(var)
return _YV_no_return
end
return YAMLvars.valTemp
diff --git a/Master/texmf-dist/tex/lualatex/yamlvars/YAMLvars.sty b/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty
index 73c40ba6931..8e295988fbf 100644
--- a/Master/texmf-dist/tex/lualatex/yamlvars/YAMLvars.sty
+++ b/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2022-01-18
+% 2022-02-25
% Copyright (C) 2021-2022 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -25,7 +25,7 @@
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{YAMLvars}[2022-01-18]
+\ProvidesPackage{YAMLvars}[2022-02-25]
\IfFileExists{markdown-tinyyaml.lua}{}{\PackageError{YAMLvars}{This package requires installation of the 'markdown' package, please install it and try again}{}}
@@ -72,3 +72,4 @@
\newcommand{\resetYAMLvarsspec}{\luadirect{YAMLvars.varspec = {}}}
\newcommand{\AllowUndeclaredYV}{\luadirect{YAMLvars.allowUndeclared = true}}
+\newcommand{\ForbidUndeclaredYV}{\luadirect{YAMLvars.allowUndeclared = false}}