diff options
author | Karl Berry <karl@freefriends.org> | 2021-11-08 23:22:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-11-08 23:22:10 +0000 |
commit | 1acf622594ee5da07939ea1d0af013af8eff10aa (patch) | |
tree | f42c7724f05101ebd4ba978682a75a6e721d460c | |
parent | 0aeb22a660c5212cd5597d3c6544bcbd3f81524d (diff) |
penlight (9nov21)
git-svn-id: svn://tug.org/texlive/trunk@61004 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/luatex/penlight/README.md | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/luatex/penlight/penlight.pdf | bin | 22977 -> 29537 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/luatex/penlight/penlight.tex | 41 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/penlight/penlight.sty | 19 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/penlight/penlightextras.lua | 16 |
5 files changed, 55 insertions, 24 deletions
diff --git a/Master/texmf-dist/doc/luatex/penlight/README.md b/Master/texmf-dist/doc/luatex/penlight/README.md index 55544e7d9fe..818fb7d4ea3 100644 --- a/Master/texmf-dist/doc/luatex/penlight/README.md +++ b/Master/texmf-dist/doc/luatex/penlight/README.md @@ -1,7 +1,6 @@ # 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. It uses the `luapackageloader` package. - +This LuaLaTeX package provides a thin-wrapper to use the [penlight](https://github.com/lunarmodules/Penlight) Lua libraries with LuaLaTeX. # License diff --git a/Master/texmf-dist/doc/luatex/penlight/penlight.pdf b/Master/texmf-dist/doc/luatex/penlight/penlight.pdf Binary files differindex 688706ad51d..8d07293e47d 100644 --- a/Master/texmf-dist/doc/luatex/penlight/penlight.pdf +++ b/Master/texmf-dist/doc/luatex/penlight/penlight.pdf diff --git a/Master/texmf-dist/doc/luatex/penlight/penlight.tex b/Master/texmf-dist/doc/luatex/penlight/penlight.tex index 9d3330bc9bb..68b8f1bb40e 100644 --- a/Master/texmf-dist/doc/luatex/penlight/penlight.tex +++ b/Master/texmf-dist/doc/luatex/penlight/penlight.tex @@ -1,6 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2021-09-20 -% +% 2021-11-07 % Copyright (C) 2021 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -23,12 +22,42 @@ % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE % OR OTHER DEALINGS IN THE SOFTWARE. -\documentclass{article} + +\documentclass[11pt,parskip=half]{scrartcl} +\setlength{\parindent}{0ex} +\newcommand{\llcmd}[1]{\leavevmode\llap{\texttt{\detokenize{#1}\ }}} +\newcommand{\cmd}[1]{\texttt{\detokenize{#1}}} +\newcommand{\qcmd}[1]{``\cmd{#1}''} \usepackage{url} -\begin{document} +\usepackage{showexpl} +\lstset{explpreset={justification=\raggedright,pos=r,wide=true}} +\setlength\ResultBoxRule{0mm} +\lstset{ + language=[LaTeX]TeX, + basicstyle=\ttfamily\small, + commentstyle=\ttfamily\small\color{gray}, + frame=none, + numbers=left, + numberstyle=\ttfamily\small\color{gray}, + prebreak=\raisebox{0ex}[0ex][0ex]{\color{gray}\ensuremath{\hookleftarrow}}, + extendedchars=true, + breaklines=true, + tabsize=4, +} +\addtokomafont{title}{\raggedright} +\addtokomafont{author}{\raggedright} +\addtokomafont{date}{\raggedright} +\author{Kale Ewasiuk (\url{kalekje@gmail.com})} +\usepackage[yyyymmdd]{datetime}\renewcommand{\dateseparator}{--} +\date{\today} + + +\RequirePackage{penlight} +\title{penlight} +\subtitle{Lua libraries for use in LuaLaTeX} - \section*{Penlight -- Lua libraries for use in LuaLaTeX} - v. 2021-09-20, Kale Ewasiuk, \url{kalekje@gmail.com}\\\\ +\begin{document} +\maketitle The official documentation for the Lua library can be found here:\\ \mbox{\url{https://stevedonovan.github.io/Penlight/api/manual/01-introduction.md.html#}} diff --git a/Master/texmf-dist/tex/luatex/penlight/penlight.sty b/Master/texmf-dist/tex/luatex/penlight/penlight.sty index 9b0baed08be..1f1fccc042b 100644 --- a/Master/texmf-dist/tex/luatex/penlight/penlight.sty +++ b/Master/texmf-dist/tex/luatex/penlight/penlight.sty @@ -1,6 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2021-09-20 -% +% 2021-11-07 % Copyright (C) 2021 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -23,21 +22,21 @@ % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE % OR OTHER DEALINGS IN THE SOFTWARE. -\ProvidesPackage{penlight}[2021-09-20] +\ProvidesPackage{penlight}[2021-11-07] -\RequirePackage{luapackageloader} +\RequirePackage{luacode} -\DeclareOption{pl}{\directlua{ +\DeclareOption{pl}{\luadirect{ pl = require('penlight') __PENLIGHT__ = 'pl' }} -\DeclareOption{penlight}{\directlua{ +\DeclareOption{penlight}{\luadirect{ penlight = require('penlight') __PENLIGHT__ = 'penlight' }} -\DeclareOption{stringx}{\directlua{_G[__PENLIGHT__].stringx.import()}} -\DeclareOption{format}{\directlua{_G[__PENLIGHT__].text.format_operator()}} -\DeclareOption{func}{\directlua{_G[__PENLIGHT__].utils.import(__PENLIGHT__..'.func')}} -\DeclareOption{extras}{\directlua{require('penlightextras')}} +\DeclareOption{stringx}{\luadirect{_G[__PENLIGHT__].stringx.import()}} +\DeclareOption{format}{\luadirect{_G[__PENLIGHT__].text.format_operator()}} +\DeclareOption{func}{\luadirect{_G[__PENLIGHT__].utils.import(__PENLIGHT__..'.func')}} +\DeclareOption{extras}{\luadirect{require('penlightextras')}} \ProcessOptions*\relax diff --git a/Master/texmf-dist/tex/luatex/penlight/penlightextras.lua b/Master/texmf-dist/tex/luatex/penlight/penlightextras.lua index f612bd3370f..13d0ab5817c 100644 --- a/Master/texmf-dist/tex/luatex/penlight/penlightextras.lua +++ b/Master/texmf-dist/tex/luatex/penlight/penlightextras.lua @@ -2,17 +2,22 @@ local pl = _G['penlight'] or _G['pl'] -- penlight for this namespace is pl local bind = bind or pl.func.bind +-- some bonus string operations, % text operator, and functional programmng +pl.stringx.import() +pl.text.format_operator() +pl.utils.import('pl.func') + function help_wrt(s1, s2) -- helpful printing, makes it easy to debug, s1 is object, s2 is note local wrt = wrt or texio.write_nl local wrt = wrt or print s2 = s2 or '' - wrt('\nvvvvv '..s2) + wrt('\nvvvvv '..s2..'\n') if type(s1) == 'table' then wrt(pl.pretty.write(s1)) else wrt(tostring(s1)) end - wrt('^^^^^\n') + wrt('\n^^^^^\n') end @@ -129,7 +134,7 @@ local function like(M1, v) return pl.array2d.new(r,c,v) end -function from_table(t) -- turns a labelled table to a 2d, label-free array +local function from_table(t) -- turns a labelled table to a 2d, label-free array t_new = {} for k, v in pairs(t) do if type(v) == 'table' then @@ -145,7 +150,7 @@ function from_table(t) -- turns a labelled table to a 2d, label-free array return t_new end -function toTeX(M, EL) --puts & between columns, can choose to end line with \\ if EL is true (end-line) +local function toTeX(M, EL) --puts & between columns, can choose to end line with \\ if EL is true (end-line) EL = EL or false if EL then EL = '\\\\' else EL = '' end return pl.array2d.reduce2(_1..EL.._2, _1..'&'.._2, M)..EL @@ -221,10 +226,9 @@ function mod2(a) -- math modulo 2 end function hasval(x) -- if something has value - -- todo check for Lists, other penlight objects if (x == nil) or (x == false) or (x == 0) or (x == '') then return false - elseif type(x) == 'table' then + elseif (type(x) ~= 'number') or (type(x) ~= 'string') then if #x == 0 then return false else |