diff options
-rw-r--r-- | Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf | bin | 83795 -> 85254 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.tex | 7 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua | 16 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty | 12 |
4 files changed, 19 insertions, 16 deletions
diff --git a/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf b/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf Binary files differindex 013335b3ad1..3a820bb1481 100644 --- a/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf +++ b/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf diff --git a/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.tex b/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.tex index 93e690d896d..3b00000feb4 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-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 diff --git a/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua b/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua index d6d2f7ca4f3..29393bd5a14 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-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/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty b/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty index bd0643ec573..524b290f34b 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-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'} } |