diff options
Diffstat (limited to 'macros/luatex/generic/penlight/penlight.sty')
-rw-r--r-- | macros/luatex/generic/penlight/penlight.sty | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/macros/luatex/generic/penlight/penlight.sty b/macros/luatex/generic/penlight/penlight.sty index 04cb66a482..d796f1e1c8 100644 --- a/macros/luatex/generic/penlight/penlight.sty +++ b/macros/luatex/generic/penlight/penlight.sty @@ -1,5 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2022-04-16 +% 2022-10-15 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -22,10 +22,13 @@ % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE % OR OTHER DEALINGS IN THE SOFTWARE. -\ProvidesPackage{penlight}[2022-04-16] +\ProvidesPackage{penlight}[2022-10-15] \RequirePackage{luacode} +\IfFileExists{luakeys.lua}{}{\PackageError{penlight}{This package requires that luakeys be installed}{help text}} + + \DeclareOption{pl}{\luadirect{ pl = require('penlight') __PENLIGHT__ = 'pl' @@ -69,3 +72,22 @@ end writePDFmetadata() }} } + + +\def\luastringT#1{\luastring{\unexpanded\expandafter\expandafter\expandafter{#1}}} +\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})}% +}
\ No newline at end of file |