texlive[62373] Master/texmf-dist: penlight (3mar22)
commits+karl at tug.org
commits+karl at tug.org
Thu Mar 3 22:07:49 CET 2022
Revision: 62373
http://tug.org/svn/texlive?view=revision&revision=62373
Author: karl
Date: 2022-03-03 22:07:49 +0100 (Thu, 03 Mar 2022)
Log Message:
-----------
penlight (3mar22)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/luatex/penlight/README.md
trunk/Master/texmf-dist/doc/luatex/penlight/penlight.pdf
trunk/Master/texmf-dist/doc/luatex/penlight/penlight.tex
trunk/Master/texmf-dist/tex/luatex/penlight/penlight.sty
trunk/Master/texmf-dist/tex/luatex/penlight/penlightextras.lua
Modified: trunk/Master/texmf-dist/doc/luatex/penlight/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/penlight/README.md 2022-03-03 21:07:31 UTC (rev 62372)
+++ trunk/Master/texmf-dist/doc/luatex/penlight/README.md 2022-03-03 21:07:49 UTC (rev 62373)
@@ -1,11 +1,11 @@
# penlight -- Lua libraries for use in LuaLaTeX
-This LuaLaTeX package provides a thin-wrapper to use the [penlight](https://github.com/lunarmodules/Penlight) Lua libraries with LuaLaTeX.
+This LuaLaTeX package provides a wrapper to use the [penlight](https://github.com/lunarmodules/Penlight) Lua libraries with LuaLaTeX, with some extra functionality added.
# License
-Copyright (C) 2021 Kale Ewasiuk
+Copyright (C) 2021-2022 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
Modified: trunk/Master/texmf-dist/doc/luatex/penlight/penlight.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/luatex/penlight/penlight.tex
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/penlight/penlight.tex 2022-03-03 21:07:31 UTC (rev 62372)
+++ trunk/Master/texmf-dist/doc/luatex/penlight/penlight.tex 2022-03-03 21:07:49 UTC (rev 62373)
@@ -1,6 +1,6 @@
% Kale Ewasiuk (kalekje at gmail.com)
-% 2022-02-27
-% Copyright (C) 2021 Kale Ewasiuk
+% 2022-03-03
+% Copyright (C) 2021-2022 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
Modified: trunk/Master/texmf-dist/tex/luatex/penlight/penlight.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/penlight/penlight.sty 2022-03-03 21:07:31 UTC (rev 62372)
+++ trunk/Master/texmf-dist/tex/luatex/penlight/penlight.sty 2022-03-03 21:07:49 UTC (rev 62373)
@@ -1,6 +1,6 @@
% Kale Ewasiuk (kalekje at gmail.com)
-% 2022-02-27
-% Copyright (C) 2021 Kale Ewasiuk
+% 2022-03-03
+% Copyright (C) 2021-2022 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,7 +22,7 @@
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
% OR OTHER DEALINGS IN THE SOFTWARE.
-\ProvidesPackage{penlight}[2022-02-27]
+\ProvidesPackage{penlight}[2022-03-03]
\RequirePackage{luacode}
@@ -32,7 +32,7 @@
}}
\DeclareOption{penlight}{\luadirect{
penlight = require('penlight')
- __PENLIGHT__ = 'penlight'
+ __PENLIGHT__ = 'penlight'
}}
@@ -39,10 +39,16 @@
\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')}}
-\DeclareOption{extrasnoglobals}{
+\DeclareOption{extras}{\luadirect{require'penlightextras'}}
+\DeclareOption{extrasnoglobals}{\luadirect{
__PL_NO_GLOBALS__ = true
- \luadirect{require('penlightextras')
- }}
+ require'penlightextras'
+}}
\ProcessOptions*\relax
+
+\luadirect{
+if __PENLIGHT__ == nil then
+ tex.print('\\PackageError{penlight}{penlight or pl option must be passed to penlight as the first option}{}')
+end
+}
Modified: trunk/Master/texmf-dist/tex/luatex/penlight/penlightextras.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/penlight/penlightextras.lua 2022-03-03 21:07:31 UTC (rev 62372)
+++ trunk/Master/texmf-dist/tex/luatex/penlight/penlightextras.lua 2022-03-03 21:07:49 UTC (rev 62373)
@@ -1,8 +1,31 @@
+--% Kale Ewasiuk (kalekje at gmail.com)
+--% 2022-03-03
+--% Copyright (C) 2021-2022 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
+--% in the Software without restriction, including without limitation the rights
+--% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+--% copies of the Software, and to permit persons to whom the Software is
+--% furnished to do so, subject to the following conditions:
+--%
+--% The above copyright notice and this permission notice shall be included in
+--% all copies or substantial portions of the Software.
+--%
+--% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+--% ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+--% TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+--% PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+--% SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+--% ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+--% ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+--% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+--% OR OTHER DEALINGS IN THE SOFTWARE.
__SKIP_TEX__ = __SKIP_TEX__ or false --if declared true before here, it will use regular print functions
-- (for troubleshooting with texlua instead of actual use in lua latex)
-
__PL_NO_GLOBALS__ = __PL_NO_GLOBALS__ or false
+__PL_EXTRAS__ = 1
-- requires penlight
local pl = _G['penlight'] or _G['pl'] -- penlight for this namespace is pl
@@ -10,8 +33,8 @@
-- some bonus string operations, % text operator, and functional programming
pl.stringx.import()
-pl.text.format_operator()
-pl.utils.import('pl.func') -- allow placeholder expressions _1 +1 etc.
+pl.stringx.format_operator()
+pl.utils.import'pl.func' -- allow placeholder expressions _1 +1 etc.
pl.COMP = require'pl.comprehension'.new() -- for comprehensions
@@ -561,7 +584,33 @@
+-- https://tex.stackexchange.com/questions/38150/in-lualatex-how-do-i-pass-the-content-of-an-environment-to-lua-verbatim
+pl.tex.recordedbuf = ""
+function pl.tex.readbuf(buf)
+ i,j = string.find(buf, '\\end{%w+}')
+ if i==nil then -- if not ending an environment
+ pl.tex.recordedbuf = pl.tex.recordedbuf .. buf .. "\n"
+ return ""
+ else
+ return nil
+ end
+end
+
+function pl.tex.startrecording()
+ pl.tex.recordedbuf = ""
+ luatexbase.add_to_callback('process_input_buffer', pl.tex.readbuf, 'readbuf')
+end
+
+function pl.tex.stoprecording()
+ luatexbase.remove_from_callback('process_input_buffer', 'readbuf')
+ pl.tex.recordedbuf = pl.tex.recordedbuf:gsub("\\end{%w+}\n","")
+end
+
+
+
+
if not __PL_NO_GLOBALS__ then
+ __PL_EXTRAS__ = 2
-- iterators
kpairs = pl.utils.kpairs
npairs = pl.utils.npairs
@@ -568,8 +617,15 @@
--enum = utils.enum
for k,v in pairs(pl.tablex) do -- extend the table table to contain tablex functions
- _G['table'][k] = v
+ if k == 'sort' then
+ table.sortk = v
+ elseif k == 'move' then
+ table.xmove = v
+ else
+ _G['table'][k] = v
+ end
end
+ table.join = table.concat -- alias
hasval = pl.hasval
COMP = pl.COMP
@@ -589,6 +645,12 @@
_G[k] = v
end
+end
+
+
+
+
+
--_xTrue = pl.tex._xTrue
--_xFalse = pl.tex._xFalse
--_xNoValue = pl.tex._xNoValue
@@ -619,12 +681,7 @@
--add_bkt_cnt = pl.tex.add_bkt_cnt
--close_bkt_cnt = pl.tex.close_bkt_cnt
-end
-
-
-
-
-- graveyard
More information about the tex-live-commits
mailing list.