diff options
-rw-r--r-- | Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf | bin | 71526 -> 82908 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.tex | 10 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua | 68 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty | 4 |
4 files changed, 51 insertions, 31 deletions
diff --git a/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf b/Master/texmf-dist/doc/lualatex/yamlvars/yamlvars.pdf Binary files differindex 6fc0c5ce7ea..58f7899f5f5 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 344185dd5f0..f6aa0893fb8 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) -% 2022-03-15 +% 2022-04-16 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -385,5 +385,13 @@ Items: Sunscreen: 5 Hat: 12 \end{verbatim} + + + +\clearpage +\section{xfm, dec, prc functions (from yamlvars.lua)} + +\lstinputlisting[linerange=113-296]{yamlvars.lua} + \end{document} diff --git a/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua b/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.lua index b485236d10e..a46b47e725b 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) ---% 2022-03-15 +--% 2022-04-16 --% Copyright (C) 2021-2022 Kale Ewasiuk --% --% Permission is hereby granted, free of charge, to any person obtaining a copy @@ -92,6 +92,24 @@ function YAMLvars.pkgerr(m) end + + +-- todo need distinction beyyween table and penlight list ??? + --val = pl.array2d.map_slice1(_1..'\\\\', val, 1,-2) + --return val:join('') + --return pl.tablex.reduce(_1.._2, val, '') + +function YAMLvars.xfm.markdown(var, val) + --return '\\begin{markdown} '..val..'\n \\end{markdown}' + pl.tex.help_wrt(val, md) + return [[begin markdown ..val.. + + par end markdown]] +end + + + + -- xfm functions (transforms) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- function YAMLvars.xfm.addxspace(var, val) return val .. '\\xspace' @@ -106,15 +124,14 @@ function YAMLvars.xfm.arrsort2ZA(var, val) end function YAMLvars.xfm.addrule2arr(var, val) - return pl.array2d.map_slice2(_1..'\\\\\\'.. YAMLvars.tabmidrule..' ', val, 1,-1,-2,-1) -- todo make gmidrule + return pl.array2d.map_slice2(_1..'\\\\\\'.. YAMLvars.tabmidrule..' ', val, 1,-1,-2,-1) end function YAMLvars.xfm.arr2tabular(var, val) return pl.array2d.toTeX(val)..'\\\\' end - -function YAMLvars.xfm.list2items(var, val) -- todo should be list2item +function YAMLvars.xfm.list2items(var, val) return pl.List(val):map('\\item '.._1):join(' ') end YAMLvars.xfm.arr2itemize = YAMLvars.xfm.list2items @@ -140,7 +157,6 @@ function YAMLvars.xfm.arrsortlastnameAZ(var, val) return val end --- todo need distinction beyyween table and penlight list ??? function YAMLvars.xfm.list2nl(var, val) if type(val) == 'string' then return val @@ -155,29 +171,25 @@ function YAMLvars.xfm.list2and(var, val) -- for doc vars like author, publisher return pl.List(val):join('\\and ') end - --val = pl.array2d.map_slice1(_1..'\\\\', val, 1,-2) - --return val:join('') - --return pl.tablex.reduce(_1.._2, val, '') - -function YAMLvars.xfm.lb2nl(var, val) --linebreak in text 2 new line +function YAMLvars.xfm.lb2nl(var, val) --linebreak in text 2 newline \\ val, _ = val:gsub('\n','\\\\ ') return val end -function YAMLvars.xfm.lowercase(var, val) - return val:lower() +function YAMLvars.xfm.lb2newline(var, val) --linebreak in text 2 newline \\ + val, _ = val:gsub('\n','\\newline ') + return val end - -function YAMLvars.xfm.markdown(var, val) - --return '\\begin{markdown} '..val..'\n \\end{markdown}' - pl.tex.help_wrt(val, md) - return [[begin markdown ..val.. - - par end markdown]] +function YAMLvars.xfm.lb2par(var, val) --linebreak in text 2 new l + val, _ = val:gsub('\n%s*\n','\\par ') + return val end +function YAMLvars.xfm.lowercase(var, val) + return val:lower() +end -- dec laration functions, -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- @@ -211,7 +223,6 @@ function YAMLvars.prc.gdef(var, val) end function YAMLvars.prc.yvdef(var, val) - --token.set_macro('yv--'..var, val, 'global') -- todo fix with csname hack? pl.tex.defmacro('yv--'..var, val) YAMLvars.debugtalk('yv--'..var..' = '..val, 'prc yvdef') end @@ -236,13 +247,11 @@ end - function YAMLvars.prc.setATvar(var, val) -- set a @var directly: eg \gdef\@title{val} pl.tex.defcmdAT('@'..var, val) end - function YAMLvars.prc.setdocvar(var, val) -- call a document var \var{val} = \title{val} -- YAML syntax options -- k: v -> \k{v} @@ -264,10 +273,9 @@ function YAMLvars.prc.setdocvar(var, val) -- call a document var \var{val} = \ti end - function YAMLvars.prc.setPDFdata(var, val) - --update pdf metat data table - -- requires a table + --update pdf meta data table (via penlight), uses pdfx xmpdata + -- requires a table input for k, v in pairs(val) do if type(v) == 'table' then v = pl.List(v):join('\\sep ') @@ -276,9 +284,6 @@ function YAMLvars.prc.setPDFdata(var, val) end end - - - -- with hyperref package function YAMLvars.prc.PDFtitle(var, val) tex.print('\\hypersetup{pdftitle={'..val..'}}') @@ -288,6 +293,13 @@ function YAMLvars.prc.PDFauthor(var, val) tex.print('\\hypersetup{pdfauthor={'..val..'}}') end +-- -- + + +-- ?? +--token.set_macro('yv--'..var, val, 'global') -- todo fix with csname hack? + + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty b/Master/texmf-dist/tex/lualatex/yamlvars/yamlvars.sty index 852b0de8cc0..92d5fbef2ea 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) -% 2022-03-15 +% 2022-04-16 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -25,7 +25,7 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{YAMLvars}[2022-03-15] +\ProvidesPackage{YAMLvars}[2022-04-16] \IfFileExists{markdown-tinyyaml.lua}{}{\PackageError{YAMLvars}{This package requires installation of the 'markdown' package, please install it and try again}{}} |