texlive[64739] Master/texmf-dist: docshots (17oct22)

commits+karl at tug.org commits+karl at tug.org
Tue Oct 18 22:50:19 CEST 2022


Revision: 64739
          http://tug.org/svn/texlive?view=revision&revision=64739
Author:   karl
Date:     2022-10-18 22:50:19 +0200 (Tue, 18 Oct 2022)
Log Message:
-----------
docshots (17oct22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/docshots/DEPENDS.txt
    trunk/Master/texmf-dist/doc/latex/docshots/docshots.pdf
    trunk/Master/texmf-dist/source/latex/docshots/docshots.dtx
    trunk/Master/texmf-dist/tex/latex/docshots/docshots.sty

Modified: trunk/Master/texmf-dist/doc/latex/docshots/DEPENDS.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/docshots/DEPENDS.txt	2022-10-18 20:50:04 UTC (rev 64738)
+++ trunk/Master/texmf-dist/doc/latex/docshots/DEPENDS.txt	2022-10-18 20:50:19 UTC (rev 64739)
@@ -4,3 +4,5 @@
 hard pgf
 hard pgf-blur
 hard pgfopts
+hard listings
+hard minted
\ No newline at end of file

Modified: trunk/Master/texmf-dist/doc/latex/docshots/docshots.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/docshots/docshots.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/docshots/docshots.dtx	2022-10-18 20:50:04 UTC (rev 64738)
+++ trunk/Master/texmf-dist/source/latex/docshots/docshots.dtx	2022-10-18 20:50:19 UTC (rev 64739)
@@ -50,7 +50,7 @@
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{docshots}
 %<*package>
-[2022-10-17 0.0.3 TeX Samples Next to Their PDF Snapshots in DTX]
+[2022-10-18 0.0.4 TeX Samples Next to Their PDF Snapshots in DTX]
 %</package>
 %<*driver>
 \documentclass{ltxdoc}
@@ -306,6 +306,52 @@
 %</verb>
 %\fi
 
+% \DescribeMacro{log}
+% With |log| option you can make us print all possible logs to the main \TeX{} log.
+% By default, we don't do this and you won't see the output of |pdflatex| compilation, for example.
+% Just use it like this:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+\usepackage[log]{docshot}
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
+
+% \DescribeMacro{inputminted}
+% By default, we render the verbatim text using |\VerbatimInput| command. You
+% can change that and make us use |\inputminted|
+% from \href{https://ctan.org/pkg/minted}{minted} package instead, for example:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+\usepackage{minted}
+\setminted[java]{frame=lines,framesep=2mm}
+\usepackage[inputminted=java]{docshot}
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
+
+% \DescribeMacro{lstinputlisting}
+% By default, we render the verbatim text using |\VerbatimInput| command. You
+% can change that and make us use |\lstinputlisting| from
+% \href{https://ctan.org/pkg/listings}{listings} package instead, for example:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+\usepackage{listings}
+\lstset{basicstyle=\small}
+\usepackage[lstinputlisting]{docshot}
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
+
 % \section{Prerequisites}
 
 % \DescribeMacro{\docshotPrerequisite}
@@ -402,6 +448,10 @@
 \pgfkeys{
   /docshots/.cd,
   dtx/.store in=\docshots at dtx,
+  log/.store in=\docshots at log,
+  log/.default=,
+  lstinputlisting/.store in=\docshots at lstinputlisting,
+  inputminted/.store in=\docshots at inputminted,
   tmpdir/.store in=\docshots at tmpdir,
   tmpdir/.default=_docshots,
   small/.store in=\docshots at small,
@@ -422,7 +472,7 @@
   left/.default=.3\linewidth,
   right/.store in=\docshots at right,
   right/.default=.55\linewidth,
-  tmpdir,pdflatex,gs,pdfcrop,margin,hspace,left,right,runs
+  tmpdir,pdflatex,gs,pdfcrop,margin,hspace,left,right,runs,log
 }
 \ProcessPgfOptions{/docshots}
 %    \end{macrocode}
@@ -429,17 +479,17 @@
 
 % Then, we print the version of |pdflatex| to \TeX{} log:
 %    \begin{macrocode}
-\iexec[log,quiet]{\docshots at pdflatex\space --version}%
+\iexec[\docshots at log,quiet]{\docshots at pdflatex\space --version}%
 %    \end{macrocode}
 
 % Then, we print the version of \href{https://ctan.org/pkg/pdfcrop}{pdfcrop} to \TeX{} log:
 %    \begin{macrocode}
-\iexec[log,quiet]{\docshots at pdfcrop\space --version}%
+\iexec[\docshots at log,quiet]{\docshots at pdfcrop\space --version}%
 %    \end{macrocode}
 
 % Then, we print the version of |ghostscript| to \TeX{} log:
 %    \begin{macrocode}
-\iexec[log,quiet]{\docshots at gs\space --version}%
+\iexec[\docshots at log,quiet]{\docshots at gs\space --version}%
 %    \end{macrocode}
 
 % Then, we make a directory where all temporary files will be kept:
@@ -464,7 +514,8 @@
 %    \end{macrocode}
 % We calculate MD5 hashsum of the file content:
 %    \begin{macrocode}
-  \def\hash{\pdfmdfivesum file {\docshots at tmpdir/\jobname/verbatim.tex}}%
+  \def\hash{\pdfmdfivesum file
+    {\docshots at tmpdir/\jobname/verbatim.tex}}%
 %    \end{macrocode}
 % If the PDF with the required name already exists, we ignore this step.
 % Otherwise, we copy |verbatim.tex| into new file and run |pdflatex|:
@@ -472,10 +523,10 @@
   \IfFileExists{\docshots at tmpdir/\jobname/\hash.pdf}
     {\message{docshots: won't render, the PDF already exists
       (\docshots at tmpdir/\jobname/\hash.pdf)^^J}}
-    {\iexec[log,quiet]{cp \docshots at tmpdir/\jobname/verbatim.tex
+    {\iexec[\docshots at log,quiet]{cp \docshots at tmpdir/\jobname/verbatim.tex
       \docshots at tmpdir/\jobname/\hash.tex}%
     \foreach \n in {1,...,\docshots at runs}{
-      \iexec[log,quiet]{cd \docshots at tmpdir/\jobname;
+      \iexec[\docshots at log,quiet]{cd \docshots at tmpdir/\jobname;
         \docshots at pdflatex\space
         -interaction=errorstopmode
         -halt-on-error
@@ -483,9 +534,9 @@
         \hash.tex}
       \message{docshots: pdflatex run no.\n^^J}
       \IfFileExists{\docshots at tmpdir/\jobname/after.sh}
-        {\iexec[log,quiet]{chmod a+x
+        {\iexec[\docshots at log,quiet]{chmod a+x
           \docshots at tmpdir/\jobname/after.sh}
-        \iexec[log,quiet]{cd \docshots at tmpdir/\jobname;
+        \iexec[\docshots at log,quiet]{cd \docshots at tmpdir/\jobname;
           ./after.sh \n\space \hash\space \hash.tex}}
         {}}}%
 %    \end{macrocode}
@@ -492,7 +543,7 @@
 % Here we delete |after.sh| which may exist here after the last
 % compilation of |pdflatex|:
 %    \begin{macrocode}
-  \iexec[log,quiet]{rm -f \docshots at tmpdir/\jobname/after.sh}
+  \iexec[\docshots at log,quiet]{rm -f \docshots at tmpdir/\jobname/after.sh}
 %    \end{macrocode}
 % If a cropped version of the PDF with the required name already exists, we ignore this step.
 % Otherwise, we ask |pdfcrop| to crop the PDF:
@@ -500,7 +551,7 @@
   \IfFileExists{\docshots at tmpdir/\jobname/\hash.crop.pdf}
     {\message{docshots: on't pdfcrop, the PDF already exists
       (\docshots at tmpdir/\jobname/\hash.crop.pdf)^^J}}
-    {\iexec[log,quiet]{\docshots at pdfcrop\space
+    {\iexec[\docshots at log,quiet]{\docshots at pdfcrop\space
       --margins \docshots at margin\space
       \docshots at tmpdir/\jobname/\hash.pdf
       \docshots at tmpdir/\jobname/\hash.crop.pdf}}%
@@ -509,7 +560,7 @@
 %    \begin{macrocode}
   \fvset{numbers=left,numbersep=3pt}%
   \fvset{frame=leftline,framerule=.4pt,rulecolor=\color{gray}}%
-  \fvset{samepage=true,baselinestretch=1}%
+  \fvset{samepage=true}%
   \fvset{baselinestretch=1}%
   \ifdefined\docshots at small%
     \fvset{fontsize=\small}%
@@ -529,7 +580,14 @@
   \hspace{\docshots at hspace}%
   \begin{minipage}[t]{\docshots at right}%
     \vspace{0pt}%
-    \VerbatimInput{\docshots at tmpdir/\jobname/\hash.tex}%
+    \ifdefined\docshots at lstinputlisting%
+      \lstinputlisting{\docshots at tmpdir/\jobname/\hash.tex}%
+    \else\ifdefined\docshots at inputminted%
+      \inputminted{\docshots at inputminted}
+        {\docshots at tmpdir/\jobname/\hash.tex}%
+    \else%
+      \VerbatimInput{\docshots at tmpdir/\jobname/\hash.tex}%
+    \fi\fi%
     \vspace{0pt}%
   \end{minipage}%
   \par%
@@ -542,7 +600,7 @@
 % Then, we define |\docshotPrerequisite| command:
 %    \begin{macrocode}
 \newcommand\docshotPrerequisite[1]{
-  \iexec[log,quiet]{cp #1 \docshots at tmpdir/\jobname}%
+  \iexec[\docshots at log,quiet]{cp #1 \docshots at tmpdir/\jobname}%
   \message{docshots: file #1 copied to
     \docshots at tmpdir/\jobname/#1^^J}%
 }
@@ -553,9 +611,10 @@
 % Finally, we define |\docshotAfter| command:
 %    \begin{macrocode}
 \newcommand\docshotAfter[1]{
-  \iexec[log,quiet]{/bin/echo -n '\detokenize{#1}'
+  \iexec[\docshots at log,quiet]{/bin/echo -n '\detokenize{#1}'
     > \docshots at tmpdir/\jobname/after.sh}%
-  \message{docshots: file \docshots at tmpdir/\jobname/after.sh created^^J}%
+  \message{docshots: file
+    \docshots at tmpdir/\jobname/after.sh created^^J}%
 }
 %    \end{macrocode}
 % \end{macro}

Modified: trunk/Master/texmf-dist/tex/latex/docshots/docshots.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/docshots/docshots.sty	2022-10-18 20:50:04 UTC (rev 64738)
+++ trunk/Master/texmf-dist/tex/latex/docshots/docshots.sty	2022-10-18 20:50:19 UTC (rev 64739)
@@ -31,7 +31,7 @@
 
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{docshots}
-[2022-10-17 0.0.3 TeX Samples Next to Their PDF Snapshots in DTX]
+[2022-10-18 0.0.4 TeX Samples Next to Their PDF Snapshots in DTX]
 
 
 
@@ -56,6 +56,9 @@
 
 
 
+
+
+
 \RequirePackage{iexec}
 \RequirePackage{fancyvrb}
 \RequirePackage{xcolor}
@@ -67,6 +70,10 @@
 \pgfkeys{
   /docshots/.cd,
   dtx/.store in=\docshots at dtx,
+  log/.store in=\docshots at log,
+  log/.default=,
+  lstinputlisting/.store in=\docshots at lstinputlisting,
+  inputminted/.store in=\docshots at inputminted,
   tmpdir/.store in=\docshots at tmpdir,
   tmpdir/.default=_docshots,
   small/.store in=\docshots at small,
@@ -87,15 +94,15 @@
   left/.default=.3\linewidth,
   right/.store in=\docshots at right,
   right/.default=.55\linewidth,
-  tmpdir,pdflatex,gs,pdfcrop,margin,hspace,left,right,runs
+  tmpdir,pdflatex,gs,pdfcrop,margin,hspace,left,right,runs,log
 }
 \ProcessPgfOptions{/docshots}
 
-\iexec[log,quiet]{\docshots at pdflatex\space --version}%
+\iexec[\docshots at log,quiet]{\docshots at pdflatex\space --version}%
 
-\iexec[log,quiet]{\docshots at pdfcrop\space --version}%
+\iexec[\docshots at log,quiet]{\docshots at pdfcrop\space --version}%
 
-\iexec[log,quiet]{\docshots at gs\space --version}%
+\iexec[\docshots at log,quiet]{\docshots at gs\space --version}%
 
 \iexec[null]{mkdir -p \docshots at tmpdir/\jobname}%
 
@@ -107,14 +114,15 @@
     \iexec[null]{perl -i -0777pe "s/(\\n|^)\\x{25} /\\1/g"
       \docshots at tmpdir/\jobname/verbatim.tex}%
   \fi%
-  \def\hash{\pdfmdfivesum file {\docshots at tmpdir/\jobname/verbatim.tex}}%
+  \def\hash{\pdfmdfivesum file
+    {\docshots at tmpdir/\jobname/verbatim.tex}}%
   \IfFileExists{\docshots at tmpdir/\jobname/\hash.pdf}
     {\message{docshots: won't render, the PDF already exists
       (\docshots at tmpdir/\jobname/\hash.pdf)^^J}}
-    {\iexec[log,quiet]{cp \docshots at tmpdir/\jobname/verbatim.tex
+    {\iexec[\docshots at log,quiet]{cp \docshots at tmpdir/\jobname/verbatim.tex
       \docshots at tmpdir/\jobname/\hash.tex}%
     \foreach \n in {1,...,\docshots at runs}{
-      \iexec[log,quiet]{cd \docshots at tmpdir/\jobname;
+      \iexec[\docshots at log,quiet]{cd \docshots at tmpdir/\jobname;
         \docshots at pdflatex\space
         -interaction=errorstopmode
         -halt-on-error
@@ -122,22 +130,22 @@
         \hash.tex}
       \message{docshots: pdflatex run no.\n^^J}
       \IfFileExists{\docshots at tmpdir/\jobname/after.sh}
-        {\iexec[log,quiet]{chmod a+x
+        {\iexec[\docshots at log,quiet]{chmod a+x
           \docshots at tmpdir/\jobname/after.sh}
-        \iexec[log,quiet]{cd \docshots at tmpdir/\jobname;
+        \iexec[\docshots at log,quiet]{cd \docshots at tmpdir/\jobname;
           ./after.sh \n\space \hash\space \hash.tex}}
         {}}}%
-  \iexec[log,quiet]{rm -f \docshots at tmpdir/\jobname/after.sh}
+  \iexec[\docshots at log,quiet]{rm -f \docshots at tmpdir/\jobname/after.sh}
   \IfFileExists{\docshots at tmpdir/\jobname/\hash.crop.pdf}
     {\message{docshots: on't pdfcrop, the PDF already exists
       (\docshots at tmpdir/\jobname/\hash.crop.pdf)^^J}}
-    {\iexec[log,quiet]{\docshots at pdfcrop\space
+    {\iexec[\docshots at log,quiet]{\docshots at pdfcrop\space
       --margins \docshots at margin\space
       \docshots at tmpdir/\jobname/\hash.pdf
       \docshots at tmpdir/\jobname/\hash.crop.pdf}}%
   \fvset{numbers=left,numbersep=3pt}%
   \fvset{frame=leftline,framerule=.4pt,rulecolor=\color{gray}}%
-  \fvset{samepage=true,baselinestretch=1}%
+  \fvset{samepage=true}%
   \fvset{baselinestretch=1}%
   \ifdefined\docshots at small%
     \fvset{fontsize=\small}%
@@ -154,7 +162,14 @@
   \hspace{\docshots at hspace}%
   \begin{minipage}[t]{\docshots at right}%
     \vspace{0pt}%
-    \VerbatimInput{\docshots at tmpdir/\jobname/\hash.tex}%
+    \ifdefined\docshots at lstinputlisting%
+      \lstinputlisting{\docshots at tmpdir/\jobname/\hash.tex}%
+    \else\ifdefined\docshots at inputminted%
+      \inputminted{\docshots at inputminted}
+        {\docshots at tmpdir/\jobname/\hash.tex}%
+    \else%
+      \VerbatimInput{\docshots at tmpdir/\jobname/\hash.tex}%
+    \fi\fi%
     \vspace{0pt}%
   \end{minipage}%
   \par%
@@ -162,15 +177,16 @@
 }
 
 \newcommand\docshotPrerequisite[1]{
-  \iexec[log,quiet]{cp #1 \docshots at tmpdir/\jobname}%
+  \iexec[\docshots at log,quiet]{cp #1 \docshots at tmpdir/\jobname}%
   \message{docshots: file #1 copied to
     \docshots at tmpdir/\jobname/#1^^J}%
 }
 
 \newcommand\docshotAfter[1]{
-  \iexec[log,quiet]{/bin/echo -n '\detokenize{#1}'
+  \iexec[\docshots at log,quiet]{/bin/echo -n '\detokenize{#1}'
     > \docshots at tmpdir/\jobname/after.sh}%
-  \message{docshots: file \docshots at tmpdir/\jobname/after.sh created^^J}%
+  \message{docshots: file
+    \docshots at tmpdir/\jobname/after.sh created^^J}%
 }
 
 



More information about the tex-live-commits mailing list.