summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-12-08 21:37:47 +0000
committerKarl Berry <karl@freefriends.org>2023-12-08 21:37:47 +0000
commitfa89e0b1f515095db51cf9386e50ad5b7d5f33a1 (patch)
tree5770672a1f7ea9d0140d4f51216385426a2c02e5 /Master/texmf-dist/tex/lualatex
parentb9a6ff870fdcb8c3764d7ba31db7decbeb432669 (diff)
yamlvars (8dec23)
git-svn-id: svn://tug.org/texlive/trunk@69071 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
-rw-r--r--Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua16
-rw-r--r--Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty12
2 files changed, 16 insertions, 12 deletions
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'}
}