texlive[65408] Master/texmf-dist: pyluatex (30dec22)
commits+karl at tug.org
commits+karl at tug.org
Fri Dec 30 22:54:46 CET 2022
Revision: 65408
http://tug.org/svn/texlive?view=revision&revision=65408
Author: karl
Date: 2022-12-30 22:54:46 +0100 (Fri, 30 Dec 2022)
Log Message:
-----------
pyluatex (30dec22)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/lualatex/pyluatex/README.md
trunk/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf
trunk/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex
trunk/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua
trunk/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty
Modified: trunk/Master/texmf-dist/doc/lualatex/pyluatex/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/pyluatex/README.md 2022-12-30 21:54:26 UTC (rev 65407)
+++ trunk/Master/texmf-dist/doc/lualatex/pyluatex/README.md 2022-12-30 21:54:46 UTC (rev 65408)
@@ -32,15 +32,17 @@
\randint{2}{5}
\end{document}
```
+
+2\. Compile using LuaLaTeX (shell escape is required)
+```
+lualatex -shell-escape example.tex
+```
+
**Note:** PyLuaTeX starts Python 3 using the command `python3` by default.
If `python3` does not start Python 3 on your system, find the correct command
and replace `\usepackage{pyluatex}` with `\usepackage[executable=<your python command>]{pyluatex}`.
For example, `\usepackage[executable=python.exe]{pyluatex}`.
-2\. Compile using LuaLaTeX (shell escape is required)
-```
-lualatex -shell-escape example.tex
-```
**Note:** Running LaTeX with the shell escape option enabled allows arbitrary code to be
executed. For this reason, it is recommended to compile trusted documents only.
@@ -49,9 +51,6 @@
* Python 3
* Linux, macOS or Windows
-The automated tests currently use TeX Live 2022 and Python 3.8+ on
-Ubuntu 20.04, macOS Big Sur 11 and Windows Server 2022.
-
## License
[LPPL 1.3c](http://www.latex-project.org/lppl.txt) for LaTeX code and
[MIT license](https://opensource.org/licenses/MIT) for Python and Lua code.
Modified: trunk/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex 2022-12-30 21:54:26 UTC (rev 65407)
+++ trunk/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex 2022-12-30 21:54:46 UTC (rev 65408)
@@ -15,7 +15,7 @@
\usepackage{url}
\title{The \emph{pyluatex} package}
\author{Tobias Enderle\\\url{https://github.com/tndrle/PyLuaTeX}}
-\date{v0.5.0 (2022/06/05)}
+\date{v0.5.1 (2022/12/30)}
\begin{document}
\maketitle
\raggedright
@@ -54,18 +54,20 @@
\randint{2}{5}
\end{document}
\end{tcblisting}
-\textbf{Note:} PyLuaTeX starts Python 3 using the command \inlcode|python3| by default.
-If \inlcode|python3| does not start Python 3 on your system, find the correct command
-and replace \inlcode|\usepackage{pyluatex}| with \inlcode|\usepackage[executable=<your python command>]{pyluatex}|.
-For example, \inlcode|\usepackage[executable=python.exe]{pyluatex}|.
\item Compile using Lua\LaTeX{} (shell escape is required)
\begin{tcblisting}{breakable,listing only,
size=fbox,colframe=black!8,boxrule=3pt,colback=black!8}
lualatex -shell-escape example.tex
\end{tcblisting}
+\end{enumerate}
+\textbf{Note:} PyLuaTeX starts Python 3 using the command \inlcode|python3| by default.
+If \inlcode|python3| does not start Python 3 on your system, find the correct command
+and replace \inlcode|\usepackage{pyluatex}| with \inlcode|\usepackage[executable=<your python command>]{pyluatex}|.
+For example, \inlcode|\usepackage[executable=python.exe]{pyluatex}|.
+
\textbf{Note:} Running \LaTeX{} with the shell escape option enabled allows arbitrary code to be
executed. For this reason, it is recommended to compile trusted documents only.
-\end{enumerate}
+
\subsection{Further Examples}
The folder \inlcode|example| contains additional example documents:
\begin{itemize}
@@ -200,9 +202,6 @@
\item Python 3
\item Linux, macOS or Windows
\end{itemize}
-The automated tests currently use TeX Live 2022 and Python 3.8+ on
-Ubuntu 20.04, macOS Big Sur 11 and Windows Server 2022.
-
\section{Typesetting Code}
Sometimes, in addition to having Python code executed and the output written to your document, you also want to show the code itself in your document.
PyLuaTeX does not offer any macros or environments that directly typeset code.
Modified: trunk/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua 2022-12-30 21:54:26 UTC (rev 65407)
+++ trunk/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua 2022-12-30 21:54:46 UTC (rev 65408)
@@ -41,6 +41,7 @@
local env_lines = nil
local parent_env = nil
local env_repl_mode = false
+local env_success = true
local last_code = nil
local last_output = nil
@@ -183,7 +184,7 @@
end
function pyluatex.print_env()
- if last_output ~= nil then
+ if last_output ~= nil and (env_success or pyluatex.ignore_errors) then
tex.print(last_output)
end
end
@@ -198,8 +199,8 @@
table.insert(env_lines, code_in_line)
end
local code = table.concat(env_lines, "\n")
- local success = pyluatex.execute(code, false, false, env_repl_mode, true)
- if success or pyluatex.ignore_errors then
+ env_success = pyluatex.execute(code, false, false, env_repl_mode, true)
+ if env_success or pyluatex.ignore_errors then
return line:sub(s)
else
return env_end .. err_cmd("Python error (see above)") .. line:sub(e + 1)
Modified: trunk/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty 2022-12-30 21:54:26 UTC (rev 65407)
+++ trunk/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty 2022-12-30 21:54:46 UTC (rev 65408)
@@ -9,7 +9,7 @@
%% version 2005/12/01 or later.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{pyluatex}[2022/06/05 v0.5.0 Execute Python code on the fly]
+\ProvidesPackage{pyluatex}[2022/12/30 v0.5.1 Execute Python code on the fly]
\RequirePackage{expl3}
\ExplSyntaxOn
More information about the tex-live-commits
mailing list.