summaryrefslogtreecommitdiff
path: root/macros/luatex/latex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-12-09 03:03:37 +0000
committerNorbert Preining <norbert@preining.info>2023-12-09 03:03:37 +0000
commit1bac51c9be71358b55925783e16f3d8bc03d630b (patch)
tree3e7fe5a309cf68674318a5396ebb83fa5f7a051e /macros/luatex/latex
parent24d8cd26aa53d1cac2260d29c6cf1c387a61a32a (diff)
CTAN sync 202312090303
Diffstat (limited to 'macros/luatex/latex')
-rw-r--r--macros/luatex/latex/yamlvars/yamlvars.lua16
-rw-r--r--macros/luatex/latex/yamlvars/yamlvars.pdfbin83795 -> 85254 bytes
-rw-r--r--macros/luatex/latex/yamlvars/yamlvars.sty12
-rw-r--r--macros/luatex/latex/yamlvars/yamlvars.tex7
4 files changed, 19 insertions, 16 deletions
diff --git a/macros/luatex/latex/yamlvars/yamlvars.lua b/macros/luatex/latex/yamlvars/yamlvars.lua
index d6d2f7ca4f..29393bd5a1 100644
--- a/macros/luatex/latex/yamlvars/yamlvars.lua
+++ b/macros/luatex/latex/yamlvars/yamlvars.lua
@@ -1,5 +1,5 @@
--% Kale Ewasiuk (kalekje@gmail.com)
---% 2023-11-25
+--% 2023-12-08
--% Copyright (C) 2021-2023 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -51,7 +51,7 @@ YAMLvars.debug = false
YAMLvars.setts = {}
YAMLvars.setts.parseopts = {timestamps=false}
-YAMLvars.setts.decstr = 'xfm' -- if in declaration key, value is a string, how should it be treated
+YAMLvars.setts.decstr = 'xfm' -- if in declaration key the value is a string (instead of dec/xfm/prc table), how should it be treated
YAMLvars.setts.undeclared = false
YAMLvars.setts.overwrite = false
YAMLvars.setts.lowercase = false
@@ -96,6 +96,8 @@ end
+
+
function YAMLvars.xfm.markdown(var, val)
--return '\\begin{markdown} '..val..'\n \\end{markdown}'
pl.tex.help_wrt(val, md)
@@ -195,7 +197,7 @@ function YAMLvars.dec.gdef(var, dft)
end
function YAMLvars.dec.yvdef(var, dft)
- YAMLvars.deccmd('yv--'..var, dft)
+ YAMLvars.deccmd('yv'..var, dft)
end
function YAMLvars.dec.toggle(var, dft)
@@ -219,8 +221,8 @@ function YAMLvars.prc.gdef(var, val)
end
function YAMLvars.prc.yvdef(var, val)
- pl.tex.defmacro('yv--'..var, val)
- YAMLvars.debugtalk('yv--'..var..' = '..val, 'prc yvdef')
+ pl.tex.defcmd('yv'..var, val)
+ YAMLvars.debugtalk('yv'..var..' = '..val, 'prc yvdef')
end
function YAMLvars.prc.toggle(t, v) -- requires penlight extras
@@ -423,13 +425,13 @@ local function transform_and_prc(var, val)
if YAMLvars.setts.prcstring then
val = tostring(val)
end
- f(var, val) -- prc the value of the variable
+ f(pl.stringx.strip(var), val) -- prc the value of the variable
end
function YAMLvars.parseYAMLvarsStr(y)
- YAMLvars.debugtalk(YAMLvars.varsvals, 'Parsing YAML vars with table')
+ YAMLvars.debugtalk('', 'Parsing YAML vars...')
YAMLvars.varsvals = YAMLvars.yaml.parse(y, YAMLvars.setts.parseopts)
for var, val in pairs(YAMLvars.varsvals) do
if YAMLvars.varslowcase:contains(var:lower()) then
diff --git a/macros/luatex/latex/yamlvars/yamlvars.pdf b/macros/luatex/latex/yamlvars/yamlvars.pdf
index 013335b3ad..3a820bb148 100644
--- a/macros/luatex/latex/yamlvars/yamlvars.pdf
+++ b/macros/luatex/latex/yamlvars/yamlvars.pdf
Binary files differ
diff --git a/macros/luatex/latex/yamlvars/yamlvars.sty b/macros/luatex/latex/yamlvars/yamlvars.sty
index bd0643ec57..524b290f34 100644
--- a/macros/luatex/latex/yamlvars/yamlvars.sty
+++ b/macros/luatex/latex/yamlvars/yamlvars.sty
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2023-11-25
+% 2023-12-08
% 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-11-25]
+\ProvidesPackage{yamlvars}[2023-12-08]
\RequirePackage{luacode}
\RequirePackage{etoolbox}
@@ -37,10 +37,12 @@
\luadirect{YAMLvars = require('YAMLvars')}
+
+
+
+
\DeclareOption{useyv}{
- \newcommand\yv{}
- \gdef\yv#1{\csname yv--#1\endcsname} % todo not working... why??
-% \NewDocumentCommand{\yv}{m}{\luadirect{tex.sprint(tostring(token.get_macro('yv--'..\luastring{#1})))}}
+ \NewDocumentCommand{\yv}{m}{\csuse{yv#1}}
\luadirect{YAMLvars.setts.prc = 'yvdef'}
\luadirect{YAMLvars.settsdefault.prc = 'yvdef'}
}
diff --git a/macros/luatex/latex/yamlvars/yamlvars.tex b/macros/luatex/latex/yamlvars/yamlvars.tex
index 93e690d896..3b00000feb 100644
--- a/macros/luatex/latex/yamlvars/yamlvars.tex
+++ b/macros/luatex/latex/yamlvars/yamlvars.tex
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2023-11-25
+% 2023-12-08
% Copyright (C) 2021-2023 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -103,9 +103,8 @@ will br thrown if the name exists. Alternatively, you can use the commands \cmd{
(only if it wasn't defined previously).
If you use this setting, unless otherwise specified, YAML variables will be accessible under
the \texttt{\textbackslash yv\{<var>\}} command.
-This also allows numbers and symbols in the variable names.
Note that internally, the variables are stored in the command sequence
-\texttt{yv--<var>}. This option is currently under repair and will not work properly in this version.
+\cmd{\yv<var>}.
\section{Dependencies}
\llcmd{Note:}This package requires the \cmd{tinyyaml} package, available on CTAN.
@@ -404,7 +403,7 @@ Items:
\clearpage
\section{xfm, dec, prc functions (from yamlvars.lua)}
-\lstinputlisting[linerange=113-296]{yamlvars.lua}
+\lstinputlisting[linerange=111-315]{yamlvars.lua}
%
%\AllowUndeclaredYV