summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-08-17 21:22:49 +0000
committerKarl Berry <karl@freefriends.org>2024-08-17 21:22:49 +0000
commit13c986dfb8b4c78a3fdd82edf46f229f62e38c13 (patch)
tree7245717dd8d49bf76aaf68311e5ef1494bf95ef3
parent319a74906f6f37853ea3f20b8b7449800690194f (diff)
yamlvars (17aug24)
git-svn-id: svn://tug.org/texlive/trunk@72052 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdfbin85254 -> 85368 bytes
-rw-r--r--Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.tex3
-rw-r--r--Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua16
-rw-r--r--Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty4
4 files changed, 16 insertions, 7 deletions
diff --git a/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf b/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf
index 3a820bb1481..ae8bb01507b 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 3b00000feb4..3e08dc883d7 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)
-% 2023-12-08
+% 2024-08-17
% Copyright (C) 2021-2023 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -229,6 +229,7 @@ Rhead: \today
\end{parseYAMLvars}
\end{verbatim}
+Note: all whitespace is stripped from the variable name when parsing.
\section{xfm -- Transform Functions}
These functions accept two arguments: \texttt{(var, val)} where \texttt{var} is the variable (or key) and val is the value.
diff --git a/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua b/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua
index 29393bd5a14..b63dabeccbb 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)
---% 2023-12-08
+--% 2024-08-17
--% Copyright (C) 2021-2023 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -55,6 +55,7 @@ YAMLvars.setts.decstr = 'xfm' -- if in declaration key the value is a string (in
YAMLvars.setts.undeclared = false
YAMLvars.setts.overwrite = false
YAMLvars.setts.lowercase = false
+YAMLvars.setts.stripvars = true -- todo add this as an option accessible in latex
YAMLvars.setts.tabmidrule = 'midrule'
YAMLvars.setts.prcstring = true
YAMLvars.setts.xfm = {}
@@ -86,7 +87,7 @@ end
function YAMLvars.debugtalk(s, ss)
if YAMLvars.debug then
- pl.tex.help_wrt(s, ss)
+ pl.tex.wrth(s, ss)
end
end
@@ -100,7 +101,7 @@ end
function YAMLvars.xfm.markdown(var, val)
--return '\\begin{markdown} '..val..'\n \\end{markdown}'
- pl.tex.help_wrt(val, md)
+ pl.tex.wrth(val, md)
return [[begin markdown ..val..
par end markdown]]
@@ -206,6 +207,7 @@ function YAMLvars.dec.toggle(var, dft)
end
function YAMLvars.dec.length(var, dft)
+ dft = dft or '0pt'
tex.print('\\global\\newlength{\\'..var..'}')
YAMLvars.prc.length(var, dft)
end
@@ -337,7 +339,10 @@ function YAMLvars.declareYAMLvarsStr(y)
var = var:lower()
YAMLvars.varslowcase:append(var)
end
- YAMLvars.varspecs[var] = default_stuff()
+ if YAMLvars.setts.stripvars then -- todo move to a func for easier use
+ var = var:gsub("%s+", "")
+ end
+ YAMLvars.varspecs[var] = default_stuff() -- assign default specs of a variable to the current var
if type(specs) == 'string' then
if YAMLvars.setts.decstr == 'xfm' then specs = {xfm={specs}} end
if YAMLvars.setts.decstr == 'dft' then specs = {dft=specs} end
@@ -437,6 +442,9 @@ function YAMLvars.parseYAMLvarsStr(y)
if YAMLvars.varslowcase:contains(var:lower()) then
var = var:lower()
end
+ if YAMLvars.setts.stripvars then -- todo move to a func for easier use
+ var = var:gsub("%s+", "")
+ end
if YAMLvars.varspecs[var] == nil and YAMLvars.setts.undeclared then
YAMLvars.debugtalk(YAMLvars.setts, 'XYZ')
YAMLvars.varspecs[var] = default_stuff() -- if undeclared and allowing, add to varspec set to default xfm, prc, dft
diff --git a/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty b/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty
index 524b290f34b..8bc387a0f5a 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)
-% 2023-12-08
+% 2024-08-17
% Copyright (C) 2021-2023 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -25,7 +25,7 @@
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{yamlvars}[2023-12-08]
+\ProvidesPackage{yamlvars}[2024-08-17]
\RequirePackage{luacode}
\RequirePackage{etoolbox}