summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/luatex/penlight
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-10-15 20:18:37 +0000
committerKarl Berry <karl@freefriends.org>2022-10-15 20:18:37 +0000
commitebe59a3d758c0d9f851743e256ead7c4db07d3bc (patch)
tree209b7ff0b764ead2fc1fa686ded7766bbb167897 /Master/texmf-dist/doc/luatex/penlight
parent76d32cb25b03db5d9b4b5ac6bc53e618e3bc0f10 (diff)
penlight (15oct22)
git-svn-id: svn://tug.org/texlive/trunk@64709 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/luatex/penlight')
-rw-r--r--Master/texmf-dist/doc/luatex/penlight/penlight.pdfbin38483 -> 42045 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/penlight/penlight.tex52
2 files changed, 49 insertions, 3 deletions
diff --git a/Master/texmf-dist/doc/luatex/penlight/penlight.pdf b/Master/texmf-dist/doc/luatex/penlight/penlight.pdf
index 55eda4b6fe4..b0b89352b2c 100644
--- a/Master/texmf-dist/doc/luatex/penlight/penlight.pdf
+++ b/Master/texmf-dist/doc/luatex/penlight/penlight.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/penlight/penlight.tex b/Master/texmf-dist/doc/luatex/penlight/penlight.tex
index f1c07a00cb5..869fda37ed3 100644
--- a/Master/texmf-dist/doc/luatex/penlight/penlight.tex
+++ b/Master/texmf-dist/doc/luatex/penlight/penlight.tex
@@ -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
@@ -76,12 +76,13 @@ If you want to use Penlight (and extras) with the \texttt{texlua} intrepreter (n
you can access it by setting \cmd{__SKIP_TEX__ = true} and adding the package to path. For example:
\begin{verbatim}
package.path = package.path .. ';'..'path/to/texmf/tex/latex/penlight/?.lua'
-penlight = require('penlight')
+penlight = require'penlight'
-- below is optional
__SKIP_TEX__ = true --only required if you want to use
--penlightextras without a LaTeX run
-- __PL_NO_GLOBALS__ = true -- optional, skip global definitions
-require('penlightextras')
+__SKIP_LUAKEYS__ = true -- luakeys is laoded in penlightextras be default, you may skip it with this
+require'penlightextras'
\end{verbatim}
\pagebreak
@@ -118,8 +119,13 @@ If \cmd{extras} is used, the following Lua globals will be defined:\\
\llcmd{COMP'xyz'()} Python-like comprehensions:\\\url{https://lunarmodules.github.io/Penlight/libraries/pl.comprehension.html}\\
\llcmd{math.mod(n,d)}, \cmd{math.mod2(n)} math modulous\\
\llcmd{string.}\cmd{totable(s)} string a table of characters\\
+\llcmd{string.}\cmd{delspace(s)} clear spaces from string\\
+\llcmd{pl.}\cmd{char(n)} return letter corresponding to 1=a, 2=b, etc.\\
+\llcmd{pl.}\cmd{Char(n)} return letter corresponding to 1=A, 2=B, etc.\\
\llcmd{kpairs(t), }\cmd{npairs(t)} iterate over keys only, or include nil value from table ipairs\\
+{\Large todo document all string helper functions}
+
\llcmd{pl.utils.}\cmd{filterfiles}\cmd{(dir,filt,rec)} Get files from dir and apply glob-like filters. Set rec to \cmd{true} to include sub directories\\
\pagebreak
@@ -148,7 +154,47 @@ If \cmd{extras} is used, the following Lua globals will be defined:\\
to a package warning saying \cmd{'cs' was declared and used in document, but never set}. If \cmd{overwrite}
is true, it will overwrite an existing command (using \cmd{defcmd}), otherwise, it will throw error like \cmd{newcmd}.\\
+\subsection{Split stuff}
+splitToComma:
+-\splitToComma{ j doe }{\and}-\\
+-\splitToComma{ j doe \and s else }{\and}-\\
+-\splitToComma{ j doe \and s else \and a per }{\and}-\\
+-\splitToComma{ j doe \and s else \and a per \and f guy}{\and}-
+
+\def\authors{j doe \and s else \and a per \and f guy}
+\splitToComma[o]{\authors}{\and}
+
+
+spliToItems:
+\begin{itemize}
+ \splitToItems{kale\and john}{\and}
+ \splitToItems{kale -john -someone else}{-}
+\end{itemize}
+
+\subsection{Macro helpers}
+\cmd{\MakeluastringCommands[def]{spec}} will let \cmd{\plluastring(A|B|C..)} be \cmd{\luastring(N|O|T|F)}
+based on the letters that \cmd{spec} is set to (or \cmd{def} if nothing is provided)
+This is useful if you want to write a command with flexibility on argument expansion.
+The user can specify \cmd{n}, \cmd{o}, \cmd{t}, and \cmd{f} (case insensitve) if they want
+no, once, twice, or full expansion.
+
+
+\def\NOTexp{\ONEexp}
+\def\ONEexp{\TWOexp}
+\def\TWOexp{\TREexp}
+\def\TREexp{Fully expanded}
+
+\NewDocumentCommand{\luastringExpTest}{m m}{
+ \MakeluastringCommands{#1}
+ \luadirect{texio.write_nl('VVVVVVVVVVVVVVVVVVVVVVVVVVVVV')}
+ \luadirect{texio.write_nl(\plluastringA{#2}..' | Not')}
+ \luadirect{texio.write_nl(\plluastringB{#2}..' | Once')}
+ \luadirect{texio.write_nl(\plluastringC{#2}..' | Twice')}
+ \luadirect{texio.write_nl(\plluastringD{#2}..' | Full')}
+ \luadirect{texio.write_nl('VVVVVVVVVVVVVVVVVVVVVVVVVVVVV')}
+}
+\luastringExpTest{ n o t f }{\NOTexp}
\subsubsection*{global extras}
If \cmd{extras} is used and NOT \cmd{extrasnoglobals}, then some globals are set.\\