texlive[69071] Master/texmf-dist: yamlvars (8dec23)

commits+karl at tug.org commits+karl at tug.org
Fri Dec 8 22:37:47 CET 2023


Revision: 69071
          https://tug.org/svn/texlive?view=revision&revision=69071
Author:   karl
Date:     2023-12-08 22:37:47 +0100 (Fri, 08 Dec 2023)
Log Message:
-----------
yamlvars (8dec23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf
    trunk/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.tex
    trunk/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua
    trunk/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty

Modified: trunk/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.tex	2023-12-08 21:37:37 UTC (rev 69070)
+++ trunk/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.tex	2023-12-08 21:37:47 UTC (rev 69071)
@@ -1,5 +1,5 @@
 % Kale Ewasiuk (kalekje at 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 @@
 (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 @@
 \clearpage
 \section{xfm, dec, prc functions (from yamlvars.lua)}
 
-\lstinputlisting[linerange=113-296]{yamlvars.lua}
+\lstinputlisting[linerange=111-315]{yamlvars.lua}
 
 %
 %\AllowUndeclaredYV

Modified: trunk/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua	2023-12-08 21:37:37 UTC (rev 69070)
+++ trunk/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua	2023-12-08 21:37:47 UTC (rev 69071)
@@ -1,5 +1,5 @@
 --% Kale Ewasiuk (kalekje at 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.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 @@
 
 
 
+
+
 function YAMLvars.xfm.markdown(var, val)
      --return '\\begin{markdown} '..val..'\n \\end{markdown}'
      pl.tex.help_wrt(val, md)
@@ -195,7 +197,7 @@
 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 @@
 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 @@
     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

Modified: trunk/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty	2023-12-08 21:37:37 UTC (rev 69070)
+++ trunk/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty	2023-12-08 21:37:47 UTC (rev 69071)
@@ -1,5 +1,5 @@
 % Kale Ewasiuk (kalekje at 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'}
 }



More information about the tex-live-commits mailing list.