diff options
author | Norbert Preining <norbert@preining.info> | 2023-07-24 03:04:00 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-07-24 03:04:00 +0000 |
commit | 19444d4440a66200b03e05b567996375d0404a46 (patch) | |
tree | 450f6790376fe84313c8b2840fe51307bcac2f9e /macros/luatex/generic/penlight/penlight.sty | |
parent | 8e64fc98a1773bc22a0f010f106d56a028e48597 (diff) |
CTAN sync 202307240303
Diffstat (limited to 'macros/luatex/generic/penlight/penlight.sty')
-rw-r--r-- | macros/luatex/generic/penlight/penlight.sty | 127 |
1 files changed, 9 insertions, 118 deletions
diff --git a/macros/luatex/generic/penlight/penlight.sty b/macros/luatex/generic/penlight/penlight.sty index 4f5900e3b8..7a7c94b6a7 100644 --- a/macros/luatex/generic/penlight/penlight.sty +++ b/macros/luatex/generic/penlight/penlight.sty @@ -1,6 +1,6 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2023-07-18 -% Copyright (C) 2021-2022 Kale Ewasiuk +% 2023-07-22 +% Copyright (C) 2021-2023 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associated documentation files (the "Software"), to deal @@ -22,124 +22,15 @@ % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE % OR OTHER DEALINGS IN THE SOFTWARE. -\ProvidesPackage{penlight}[2023-07-18] +\ProvidesPackage{penlight}[2023-07-22] -\RequirePackage{luacode} +\directlua{penlight = require'penlight'} -\IfFileExists{luakeys.lua}{}{\PackageError{penlight}{This package requires that luakeys be installed}{}} +\DeclareOption{pl}{\directlua{pl = penlight}} - -\DeclareOption{pl}{\luadirect{ - pl = require'penlight' - __PENLIGHT__ = 'pl' -}} -\DeclareOption{penlight}{\luadirect{ - penlight = require'penlight' - __PENLIGHT__ = 'penlight' -}} - - -\DeclareOption{stringx}{\luadirect{_G[__PENLIGHT__].stringx.import()}} -\DeclareOption{format}{\luadirect{_G[__PENLIGHT__].stringx.format_operator()}} -\DeclareOption{func}{\luadirect{_G[__PENLIGHT__].utils.import(__PENLIGHT__..'.func')}} -\DeclareOption{extras}{\luadirect{require'penlightextras'} - \gdef\penlight@loadextras{} -} -\DeclareOption{extrasglobals}{\luadirect{ - __PL_GLOBALS__ = true - require'penlightextras' - } - \gdef\penlight@loadextras{} -} +\DeclareOption{stringx}{\directlua{penlight.stringx.import()}} +\DeclareOption{format}{\directlua{penlight.stringx.format_operator()}} +\DeclareOption{func}{\directlua{penlight.utils.import(penlight.func)}} +\DeclareOption{import}{\ExecuteOptions{stringx,format,func}} \ProcessOptions*\relax - -\luadirect{ -if __PENLIGHT__ == nil then - tex.sprint('\\PackageError{penlight}{"penlight" or "pl" option must be passed to penlight as the first option}{}') -end -} - -\ifdefined\penlight@loadextras - -\global\newcommand{\writePDFmetadata}{\luadirect{_G[__PENLIGHT__].tex.writePDFmetadata()}} - -\NewDocumentCommand{\writePDFmetadatakv}{ s m }{ -\IfBooleanTF{#1}{% if *, overwrite everything - \luadirect{ - __PDFmetadata__ = luakeys.parse(\luastring{#2}) - _G[__PENLIGHT__].tex.writePDFmetadata() - }}{ - \luadirect{ - __PDFmetadata__ = __PDFmetadata__ or {} - _G[__PENLIGHT__].tablex.update(__PDFmetadata__, luakeys.parse(\luastring{#2})) - _G[__PENLIGHT__].tex.writePDFmetadata() - }} -} - - -\gdef\luastringT#1{\luastring{\unexpanded\expandafter\expandafter\expandafter{#1}}} % expand luastring twice -\global\let\luastringF\luastring % fully expanded luastring - -% allow control over expansion of arguments to a latex function -\NewDocumentCommand{\MakeluastringCommands}{O{} m }{% #1 the desired commands #2 defaults - \luadirect{_G[__PENLIGHT__].tex.aliasluastring(\luastring{#2},\luastring{#1})}% -} - -\NewDocumentCommand{\splitToComma}{ O{nn} m m }{% - \MakeluastringCommands[nn]{#1}% - \luadirect{_G[__PENLIGHT__].tex.split2comma(\plluastringA{#2},\plluastringB{#3})}% -} - -\NewDocumentCommand{\splitToItems}{ O{NN} m m }{% - \MakeluastringCommands[nn]{#1}% - \luadirect{_G[__PENLIGHT__].tex.split2items(\plluastringA{#2},\plluastringB{#3})}% -} - - -% -% -%\NewDocumentCommand{\tblnew}{m}{\luadirect{ -% _G[\luastring{#1}] = {} -%}} -% -%\NewDocumentCommand{\tblfrkv}{m m O{} }{\luadirect{ -% _G[\luastring{#1}] = luakeys.parse(\luastring{#2}, luakeys.parse(\luastring{#3})) -%}} -% -%\NewDocumentCommand{\tblset}{m m m}{\luadirect{ -% _G[\luastring{#1}][\luastring{#2}] = \luastring{#3} -%}} -% -%\NewDocumentCommand{\tblget}{m m}{\luadirect{ -% tex.sprint(tostring(_G[\luastring{#1}][\luastring{#2}])) -%}} -% -%\NewDocumentCommand{\tblidx}{m m}{\luadirect{ -% tex.sprint(tostring(_G[\luastring{#1}][#2])) -%}} -% -% -%\NewDocumentCommand{\tblupd}{ m m}{\luadirect{ -% _G[__PENLIGHT__].tablex.update(_G[\luastring{#1}], _G[\luastring{#2}]) -%}} -% -%\NewDocumentCommand{\tblupdkv}{ m m }{\luadirect{ -% _G[__PENLIGHT__].tablex.update(_G[\luastring{#1}], luakeys.parse(\luastring{#2})) -%}} -% -%% todo need a get table function. If blank is passed, the last table referenced is used. -%\NewDocumentCommand{\tblfrkvII}{ m m m }{\luadirect{ -% _G[\luastring{#1}] = _G[__PENLIGHT__].tablex.update(luakeys.parse(\luastring{#2}), luakeys.parse(\luastring{#3})) -%}} - - -%\NewDocumentCommand{\tbldo}{m m O{} }{\luadirect{ -% % tex.sprint(tostring(_G[\luastring{#1}][#2])) -% % todo allow one to use pl tablex function here, -% % {tbl}{update}[arg1][arg2] -% _G[__PENLIGHT__].tablex[\luastring[#1]](_G[\luastring{}], _G[\luastring{}]) -%}} - - -\else\fi
\ No newline at end of file |