summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/runcode
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-07-19 20:09:22 +0000
committerKarl Berry <karl@freefriends.org>2022-07-19 20:09:22 +0000
commit806b006b66e1093049761c9e0ffdba845d2bd227 (patch)
tree8dff230b9fd7467f2fd2c141d383c5ed10dec703 /Master/texmf-dist/tex/latex/runcode
parente9a384bd2054fd0d8a57bb3c0a230ad4fcfda04e (diff)
runcode (19jul22)
git-svn-id: svn://tug.org/texlive/trunk@63939 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/runcode')
-rw-r--r--Master/texmf-dist/tex/latex/runcode/runcode.sty24
1 files changed, 15 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/latex/runcode/runcode.sty b/Master/texmf-dist/tex/latex/runcode/runcode.sty
index 79da32c5790..626dc05aaa5 100644
--- a/Master/texmf-dist/tex/latex/runcode/runcode.sty
+++ b/Master/texmf-dist/tex/latex/runcode/runcode.sty
@@ -171,12 +171,16 @@
\ifthenelse{\isempty{#3}}{
\ifminted
\inputminted{#1}{#2}
+ \vspace{-\medskipamount}
+ \vspace{-\baselineskip}
\else
\VerbatimInput[fontsize=\footnotesize,linenos=true,frame=single,breaklines]{#2}
\fi
}{
\ifminted
\inputminted[firstline=#3, lastline=#4, firstnumber=1]{#1}{#2}
+ \vspace{-\medskipamount}
+ \vspace{-\baselineskip}
\else
\VerbatimInput[fontsize=\footnotesize,linenos=true,frame=single,breaklines, firstline=#3, lastline=#4, firstnumber=1]{#2}
\fi
@@ -232,7 +236,7 @@
\IfFileExists{\tmpname}
{
\ifstrequal{#2}{vbox}
- {\begin{tcolorbox}
+ {\begin{tcolorbox}[colframe=blue!25,colback=blue!10]
\ifminted\unskip
\inputminted[fontsize=\footnotesize,breaklines=true]{text}{\tmpname}\unskip
\else\unskip
@@ -264,18 +268,20 @@
\NewDocumentCommand{\inln}{m m O{inline}}{\-
\stepcounter{codeOutput}\unskip
\unskip\setvalue{\tmpname}{tmp/\jobname_inln\thecodeOutput}\unskip\unskip\unskip
- \IfBeginWith{#2}{```}{\ifruncode\immediate\write18{#1 > \tmpname.tex}\unskip\fi}
- {\newwrite\tempfile
- \immediate\openout\tempfile=\tmpname.txt
- \immediate\write\tempfile{#2}
- \immediate\closeout\tempfile
- \ifruncode
- \immediate\write18{#1 \tmpname.txt > \tmpname.tex}\unskip
+ \ifruncode % cache mode - don't try to run the code, just get the previous results
+ \IfBeginWith{#2}{```}{\ifruncode\immediate\write18{#1 > \tmpname.tex}\unskip\fi}
+ {\newwrite\tempfile
+ \immediate\openout\tempfile=\tmpname.txt
+ \immediate\write\tempfile{#2}
+ \immediate\closeout\tempfile
+ \ifruncode
+ \immediate\write18{#1 \tmpname.txt > \tmpname.tex}\unskip
\fi}
+ \fi % end cache mode
\IfFileExists{\tmpname.tex}
{\checkZeroBytes{\tmpname.tex}\unskip
\ifstrequal{#3}{vbox}
- {\begin{tcolorbox}
+ {\begin{tcolorbox}[colframe=blue!25,colback=blue!10]
\ifminted\unskip
\inputminted[fontsize=\footnotesize,breaklines=true]{text}{\tmpname.tex}\unskip
\else\unskip