summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-12-30 21:54:46 +0000
committerKarl Berry <karl@freefriends.org>2022-12-30 21:54:46 +0000
commit3c2b5f7312ad17c7c18d201ebabec6e926aa9dce (patch)
treec10f0b733421457f4b20132f8e72abdd1501aac3
parent132933452e4a26cf30e80f64e7bcab840090f764 (diff)
pyluatex (30dec22)
git-svn-id: svn://tug.org/texlive/trunk@65408 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/lualatex/pyluatex/README.md13
-rw-r--r--Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdfbin82658 -> 82203 bytes
-rw-r--r--Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex17
-rw-r--r--Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua7
-rw-r--r--Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty2
5 files changed, 19 insertions, 20 deletions
diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/README.md b/Master/texmf-dist/doc/lualatex/pyluatex/README.md
index c93a3b8c8bf..06ae0a714d4 100644
--- a/Master/texmf-dist/doc/lualatex/pyluatex/README.md
+++ b/Master/texmf-dist/doc/lualatex/pyluatex/README.md
@@ -32,15 +32,17 @@ $\sqrt{371} = \py{math.sqrt(371)}$
\randint{2}{5}
\end{document}
```
-**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:** 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}`.
+
**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 @@ executed. For this reason, it is recommended to compile trusted documents only.
* 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.
diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf
index c7710f6f78c..5f5e096b876 100644
--- a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf
+++ b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex
index 366a7ae8dae..56782fcf193 100644
--- a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex
+++ b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex
@@ -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 @@ $\sqrt{371} = \py{math.sqrt(371)}$
\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 @@ in your environment definition, e.g.
\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.
diff --git a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua
index 0580d25a539..2b53bd77136 100644
--- a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua
+++ b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua
@@ -41,6 +41,7 @@ local env_end = nil
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 @@ function pyluatex.execute(code, auto_print, write, repl_mode, store)
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 @@ local function record_line(line)
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)
diff --git a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty
index 6e287e51000..02ac9d5f6cf 100644
--- a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty
+++ b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty
@@ -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