summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/iexec
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-10-10 03:03:17 +0000
committerNorbert Preining <norbert@preining.info>2022-10-10 03:03:17 +0000
commit9c7942efff8183c8695ec824008847dd068dbfe7 (patch)
treee33fd003ccafdc5be2fae32625d9dd06c6e339b6 /macros/latex/contrib/iexec
parentfec5c6c870d9c855fe6be355b088ca729184bdff (diff)
CTAN sync 202210100303
Diffstat (limited to 'macros/latex/contrib/iexec')
-rw-r--r--macros/latex/contrib/iexec/DEPENDS.txt1
-rw-r--r--macros/latex/contrib/iexec/iexec.dtx96
-rw-r--r--macros/latex/contrib/iexec/iexec.ins8
-rw-r--r--macros/latex/contrib/iexec/iexec.pdfbin284051 -> 294434 bytes
4 files changed, 89 insertions, 16 deletions
diff --git a/macros/latex/contrib/iexec/DEPENDS.txt b/macros/latex/contrib/iexec/DEPENDS.txt
index 5fa4f92b5c..3e3774f0e2 100644
--- a/macros/latex/contrib/iexec/DEPENDS.txt
+++ b/macros/latex/contrib/iexec/DEPENDS.txt
@@ -1,3 +1,4 @@
hard shellesc
hard pgfkeys
hard xkeyval
+hard expl3
diff --git a/macros/latex/contrib/iexec/iexec.dtx b/macros/latex/contrib/iexec/iexec.dtx
index fb38432b0e..2478ac224a 100644
--- a/macros/latex/contrib/iexec/iexec.dtx
+++ b/macros/latex/contrib/iexec/iexec.dtx
@@ -50,17 +50,14 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{iexec}
%<*package>
-[01.10.2022 0.6.1 Inputable Shell Executions]
+[09.10.20220 0.7.0 Inputable Shell Executions]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[tt=false, type1=true]{libertine}
+\usepackage{microtype}
\usepackage{iexec}
\usepackage{href-ul}
-\raggedbottom
-\setlength{\parindent}{0pt}
-\setlength{\columnsep}{32pt}
-\setlength{\parskip}{6pt}
\PageIndex
\EnableCrossrefs
\CodelineIndex
@@ -105,7 +102,7 @@ Today is
%
% \columnbreak
%
-% Today is \iexec{date +\%e-\%b-\%Y}
+% Today is \iexec[log]{date +\%e-\%b-\%Y}
% \end{multicols}
% \begin{macro}{\iexec}
@@ -184,6 +181,43 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
%\fi
% \end{macro}
+% \begin{macro}{append}
+% The stdout produced will be appended to the file specified:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+\documentclass{article}
+\usepackage[trace]{iexec}
+\begin{document}
+\iexec[append,stdout=foo.txt,quiet]{echo 'Hello, '}
+\iexec[append,stdout=foo.txt,quiet]{echo 'Jeffrey!'}
+\input{foo.txt}
+\end{document}
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
+% \end{macro}
+
+% \begin{macro}{log}
+% The stdout produced will be printed in \TeX{} log:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+\documentclass{article}
+\usepackage{iexec}
+\begin{document}
+\iexec[log]{echo 'Hello, \\LaTeX!'}
+\input{foo.txt}
+\end{document}
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
+% \end{macro}
+
% \StopEventually{}
% \section{Implementation}
@@ -193,9 +227,15 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% \changes{v0.4.1}{2021/08/08}{Options trace, stdout, and quiet added}
% \changes{v0.5.0}{2022/01/08}{Major bug fixes}
-% \iffalse
+% First, we include a few packages:
+% \begin{macrocode}
\RequirePackage{shellesc}
\RequirePackage{pgfkeys}
+\RequirePackage{expl3}
+% \end{macrocode}
+
+% Then, we parse package options:
+% \begin{macrocode}
\RequirePackage{xkeyval}
\makeatletter\newif\ifiexec@trace
\DeclareOptionX{trace}{\iexec@tracetrue}
@@ -206,12 +246,34 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
stdout/.estore in = \iexec@stdout,
stdout/.default = iexec.tmp,
trace/.estore in = \iexec@traceit,
+ append/.estore in = \iexec@append,
+ log/.estore in = \iexec@log,
quiet/.estore in = \iexec@quiet,
stdout
}\makeatother
-% \fi
+% \end{macrocode}
+
+% \begin{macro}{\iexec@typeout}
+% Then, we define an internal command |\iexec@typeout| for printing the content of a file,
+% as suggested \href{https://tex.stackexchange.com/questions/660808}{here}:
+% \begin{macrocode}
+\makeatletter\ExplSyntaxOn
+\NewDocumentCommand{\iexec@typeout}{m}{
+ \iexec_typeout_file:n { #1 }}
+\ior_new:N \g_iexec_typeout_ior
+\cs_new_protected:Nn \iexec_typeout_file:n
+{
+ \ior_open:Nn \g_iexec_typeout_ior { #1 }
+ \ior_str_map_inline:Nn \g_iexec_typeout_ior
+ {\iow_term:n { ##1 }}
+ \ior_close:N \g_iexec_typeout_ior
+}
+\ExplSyntaxOff\makeatother
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{\iexec}
+% Then, we define |\iexec| command.
% It is implemented with the help of |\ShellEscape| from |shellesc| package:
% \begin{macrocode}
\makeatletter\newcommand\iexec[2][]{%
@@ -222,7 +284,7 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% it nothing will work; so, it's better to throw an error earlier than later:
% \begin{macrocode}
\ifdefined\pdfshellescape\ifnum\pdfshellescape=1\else%
- \PackageError{iexec}{You must run latex with
+ \PackageError{iexec}{You must run TeX processor with
--shell-escape option}{}%
\fi\fi%
\begingroup%
@@ -238,19 +300,29 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% \end{macrocode}
% Then, we execute it:
% \begin{macrocode}
- \ShellEscape{#2 > \iexec@stdout}%
+ \ShellEscape{#2 \ifdefined\iexec@append>\fi> \iexec@stdout}%
% \end{macrocode}
% Then, a message is printed to TeX log:
% \begin{macrocode}
\message{^^Jiexec: [#2 > \iexec@stdout]^^J}%
\endgroup%
% \end{macrocode}
+% Then, if required, the content of the stdout file will be printed to the log:
+% \begin{macrocode}
+ \ifdefined\iexec@log
+ \message{^^Jiexec: this is the content of \iexec@stdout:^^J}%
+ \iexec@typeout{\iexec@stdout}
+ \message{^^J<EOF>^^J}%
+ \fi%
+% \end{macrocode}
% Then, include the produced output into the current document:
% \begin{macrocode}
\ifdefined\iexec@quiet
- \message{^^Jiexec: Due to 'quiet' we didn't read
- the content of '\iexec@stdout'^^J}%
+ \message{^^Jiexec: Due to 'quiet' option we didn't read
+ the content of '\iexec@stdout' (\pdffilesize{} bytes)^^J}%
\else%
+ \message{^^Jiexec: We include the content of
+ '\iexec@stdout' (\pdffilesize{} bytes)...^^J}%
\input{\iexec@stdout}%
\message{^^Jiexec: The content of '\iexec@stdout'
was included into the document^^J}%
diff --git a/macros/latex/contrib/iexec/iexec.ins b/macros/latex/contrib/iexec/iexec.ins
index 36172278a6..8d2fd38a42 100644
--- a/macros/latex/contrib/iexec/iexec.ins
+++ b/macros/latex/contrib/iexec/iexec.ins
@@ -48,8 +48,8 @@ SOFTWARE.
\endpreamble
\generate{\file{iexec.sty}{\from{iexec.dtx}{package}}}
\obeyspaces
-\Msg{*** To finish the installation you have to move the ".sty"}
-\Msg{*** file into a directory searched by TeX. To produce the}
-\Msg{*** documentation run the file ".dtx" through LaTeX. If any}
-\Msg{*** questions, submit a new GitHub issue.}
+\Msg{To finish the installation you have to move the ".sty"}
+\Msg{file into a directory searched by TeX. To produce the}
+\Msg{documentation run the file ".dtx" through LaTeX. If any}
+\Msg{questions, submit a new GitHub issue.}
\endbatchfile
diff --git a/macros/latex/contrib/iexec/iexec.pdf b/macros/latex/contrib/iexec/iexec.pdf
index 74233b4810..6030b3fa7a 100644
--- a/macros/latex/contrib/iexec/iexec.pdf
+++ b/macros/latex/contrib/iexec/iexec.pdf
Binary files differ