texlive[72463] Master/texmf-dist: minted (4oct24)

commits+karl at tug.org commits+karl at tug.org
Fri Oct 4 23:30:42 CEST 2024


Revision: 72463
          https://tug.org/svn/texlive?view=revision&revision=72463
Author:   karl
Date:     2024-10-04 23:30:42 +0200 (Fri, 04 Oct 2024)
Log Message:
-----------
minted (4oct24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_LATEXMINTED_PYTHON_PACKAGE.md
    trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_MINTED_LATEX_PACKAGE.md
    trunk/Master/texmf-dist/doc/latex/minted/minted.pdf
    trunk/Master/texmf-dist/source/latex/minted/minted.dtx
    trunk/Master/texmf-dist/tex/latex/minted/minted.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/scripts/minted/latexminted-0.2.0-py3-none-any.whl

Removed Paths:
-------------
    trunk/Master/texmf-dist/scripts/minted/latexminted-0.1.0-py3-none-any.whl

Modified: trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_LATEXMINTED_PYTHON_PACKAGE.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_LATEXMINTED_PYTHON_PACKAGE.md	2024-10-04 21:30:24 UTC (rev 72462)
+++ trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_LATEXMINTED_PYTHON_PACKAGE.md	2024-10-04 21:30:42 UTC (rev 72463)
@@ -1,6 +1,38 @@
 # Changelog: `latexminted` — Python library for LaTeX minted package
 
 
+## v0.2.0 (2024-10-03)
+
+*  All config data passed back to LaTeX is now processed with `\detokenize`
+   (#405).
+
+*  In a cache, `*.index.minted` files are now overwritten only when the data
+   they contain is modified.  This fixes compatibility with build tools
+   (T-F-S/tcolorbox/issues/294).
+
+*  Fixed a bug that could prevent a cache from being fully cleaned when it is
+   shared by multiple documents.
+
+*  All file reading and writing for files received from/sent to LaTeX is now
+   UTF-8 (#411).
+
+*  The cache path is now processed correctly when it is an empty string,
+   instead of resulting in an error, so the `minted` package will now function
+   when `cache=false`.
+
+*  Refactored the `cleanfile` subcommand into `cleanconfig`.  This is more
+   descriptive for actual usage and allows all subcommands to take the same
+   arguments.
+
+*  Added subcommand `cleantemp`, which only cleans temp files, not cache
+   files.
+
+*  All subcommands now take exactly the same arguments.
+
+*  Added short summary and links to `latexminted --version` (#404).
+
+
+
 ## v0.1.0 (2024-09-22)
 
 *  Initial release.

Modified: trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_MINTED_LATEX_PACKAGE.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_MINTED_LATEX_PACKAGE.md	2024-10-04 21:30:24 UTC (rev 72462)
+++ trunk/Master/texmf-dist/doc/latex/minted/CHANGELOG_MINTED_LATEX_PACKAGE.md	2024-10-04 21:30:42 UTC (rev 72463)
@@ -1,6 +1,47 @@
 # Changelog — minted LaTeX package
 
 
+## v3.1.1 (2024/10/03)
+
+*  Fixed bugs in processing temporary files regardless of `highlightmode` from
+   v3.1.0.  With `highlightmode=fastfirst` (default), this would cause an
+   error during the first compile, but then all subsequent compiles would
+   complete correctly.
+
+
+
+## v3.1.0 (2024/10/03)
+
+*  All timestamp comparisons that are part of communicating with the
+   `latexminted` Python executable now use timestamps that have been processed
+   with `\detokenize` (#405).
+
+*  Option processing now wraps values in curly braces to prevent escaping
+   issues when options are passed on to other packages for further processing
+   (#407).
+
+*  Fixed compatibility with `dvilualatex` (#406).
+
+*  Temporary files with common file extensions are now automatically detected
+   and processed correctly regardless of `highlightmode` (#401).  Previously,
+   `highlightmode=immediate` was needed for working with temp files that are
+   overwritten or deleted during compilation; the default
+   `highlightmode=fastfirst` gave an error message during the first compile
+   but worked correctly during subsequent compiles.
+
+*  Fixed bug when `cache=false`.  When caching is disabled, `highlightmode` is
+   now set to `immediate`.
+
+*  The minimum supported `latexminted` version is now 0.2.0.  The new
+   `latexminted` subcommand `cleantemp` is now used instead of `clean` when
+   the cache does not require cleaning.  This prevents errors when
+   `cache=false`.
+
+*  Fixed docs for `breakbeforeinrun` and `breakafterinrun` (#408).  These had
+   not been properly updated after `fvextra` renamed the options.
+
+
+
 ## v3.0.0 (2024/09/22)
 
 *  Backward compatibility:  The new `minted2` package provides the features of
@@ -350,6 +391,7 @@
    `babel`'s `magyar` (#382).
 
 
+
 ## v2.9 (2023/12/18)
 
 *  This is expected to be the last release of `minted` v2.x.  If so, it will

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

Deleted: trunk/Master/texmf-dist/scripts/minted/latexminted-0.1.0-py3-none-any.whl
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/scripts/minted/latexminted-0.2.0-py3-none-any.whl
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/scripts/minted/latexminted-0.2.0-py3-none-any.whl
===================================================================
--- trunk/Master/texmf-dist/scripts/minted/latexminted-0.2.0-py3-none-any.whl	2024-10-04 21:30:24 UTC (rev 72462)
+++ trunk/Master/texmf-dist/scripts/minted/latexminted-0.2.0-py3-none-any.whl	2024-10-04 21:30:42 UTC (rev 72463)

Property changes on: trunk/Master/texmf-dist/scripts/minted/latexminted-0.2.0-py3-none-any.whl
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: trunk/Master/texmf-dist/source/latex/minted/minted.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/minted/minted.dtx	2024-10-04 21:30:24 UTC (rev 72462)
+++ trunk/Master/texmf-dist/source/latex/minted/minted.dtx	2024-10-04 21:30:42 UTC (rev 72463)
@@ -27,7 +27,7 @@
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{minted}
 %<*package>
-    [2024/09/22 v3.0.0 Yet another Pygments shim for LaTeX]
+    [2024/10/03 v3.1.1 Yet another Pygments shim for LaTeX]
 %</package>
 %<*driver>
 \documentclass{ltxdoc}
@@ -756,12 +756,14 @@
 %
 %
 % \DescribeMacro{highlightmode=\meta{string} (default:~fastfirst)}
-% Determines when code is highlighted.
+% Determines when code is highlighted.  This only has an effect when |cache=true|.
 %
 % The default is |fastfirst|.  If a cache for the document exists, then code is highlighted immediately.  If a cache for the document does not exist, then typeset a placeholder instead of code and highlight all code at the end of the document.  This will require a second compile before code is typeset, but because all code is highlighted at once, there is less overhead and the total time required can be significantly less for documents that include many code snippets.
 %
-% The alternatives are |fast| (always highlight at end of document, requiring a second compile) and |immediate| (always highlight immediately, so no second compile is needed).  |immediate| should be used when typesetting code in external temp files that are overwritten during compilation.
+% The alternatives are |fast| (always highlight at end of document, requiring a second compile) and |immediate| (always highlight immediately, so no second compile is needed).
 %
+% Temporary files with the following file extensions are automatically detected and processed correctly, regardless of |highlightmode|:  |.listing|, |.out|, |.outfile|, |.output|, |.temp|, |.tempfile|, |.tmp|, |.verb|, and |.vrb|.  For temp files with other file extensions, |highlightmode=immediate| is needed if the files are overwritten or deleted during compilation.  |fastfirst| can work in such cases, but it will give an error message about modified or missing files during the first compile, and then will work correctly during subsequent compiles when it switches to |immediate| mode.
+%
 % When code is highlighted at the end of the document with |fast| or |fastfirst|, any error and warning messages will refer to a location at the end of the document rather than the original code location, since highlighting occurred at the end of the document.  In this case, messages are supplemented with original \LaTeX\ source file names and line numbers to aid in debugging.
 %
 %
@@ -949,7 +951,7 @@
 %   \item[breakafter (string) (\meta{none})]
 %     Break lines after specified characters, not just at spaces, when \texttt{breaklines=true}.
 %
-% For example, \texttt{breakafter=-/} would allow breaks after any hyphens or slashes.  Special characters given to \texttt{breakafter} should be backslash-escaped (usually \texttt{\hashchar}, \texttt{\{}, \texttt{\}}, \texttt{\%}, \texttt{[}, \texttt{]}; the backslash \texttt{\textbackslash} may be obtained via \texttt{\textbackslash\textbackslash}).
+% For example, \texttt{breakafter=-/} would allow breaks after any hyphens or slashes.  Special characters given to \texttt{breakafter} should be backslash-escaped (usually \texttt{\hashchar}, \texttt{\{}, \texttt{\}}, \texttt{\%}, \texttt{[}, \texttt{]}, and the comma \texttt{,}; the backslash \texttt{\textbackslash} may be obtained via \texttt{\textbackslash\textbackslash}).
 %
 % For an alternative, see \texttt{breakbefore}.  When \texttt{breakbefore} and \texttt{breakafter} are used for the same character, \texttt{breakbeforeinrun} and \texttt{breakafterinrun} must both have the same setting.
 %
@@ -959,8 +961,8 @@
 %   \end{minted}
 % \end{longexample}
 %
-%   \item[breakafterinrun] (boolean) (true)
-%     When \texttt{breakafter} is used, group all adjacent identical characters together, and only allow a break after the last character.  When \texttt{breakbefore} and \texttt{breakafter} are used for the same character, \texttt{breakbeforeinrun} and \texttt{breakafterinrun} must both have the same setting.
+%   \item[breakafterinrun] (boolean) (false)
+%     When \texttt{breakafter} is used, insert breaks within runs of identical characters.  If \texttt{false}, treat sequences of identical characters as a unit that cannot contain breaks.  When \texttt{breakbefore} and \texttt{breakafter} are used for the same character, \texttt{breakbeforeinrun} and \texttt{breakafterinrun} must both have the same setting.
 %
 %
 %   \item[breakaftersymbolpost (string) (\meta{none})]
@@ -1002,7 +1004,7 @@
 %   \item[breakbefore (string) (\meta{none})]
 %     Break lines before specified characters, not just at spaces, when \texttt{breaklines=true}.
 %
-% For example, \texttt{breakbefore=A} would allow breaks before capital A's.  Special characters given to \texttt{breakbefore} should be backslash-escaped (usually \texttt{\hashchar}, \texttt{\{}, \texttt{\}}, \texttt{\%}, \texttt{[}, \texttt{]}; the backslash \texttt{\textbackslash} may be obtained via \texttt{\textbackslash\textbackslash}).
+% For example, \texttt{breakbefore=A} would allow breaks before capital A's.  Special characters given to \texttt{breakbefore} should be backslash-escaped (usually \texttt{\hashchar}, \texttt{\{}, \texttt{\}}, \texttt{\%}, \texttt{[}, \texttt{]}, and the comma \texttt{,}; the backslash \texttt{\textbackslash} may be obtained via \texttt{\textbackslash\textbackslash}).
 %
 %  For an alternative, see \texttt{breakafter}.  When \texttt{breakbefore} and \texttt{breakafter} are used for the same character, \texttt{breakbeforeinrun} and \texttt{breakafterinrun} must both have the same setting.
 %
@@ -1012,8 +1014,8 @@
 %   \end{minted}
 % \end{longexample}
 %
-%   \item[breakbeforeinrun] (boolean) (true)
-%     When \texttt{breakbefore} is used, group all adjacent identical characters together, and only allow a break before the first character.  When \texttt{breakbefore} and \texttt{breakafter} are used for the same character, \texttt{breakbeforeinrun} and \texttt{breakafterinrun} must both have the same setting.
+%   \item[breakbeforeinrun] (boolean) (false)
+%     When \texttt{breakbefore} is used, insert breaks within runs of identical characters.  If \texttt{false}, treat sequences of identical characters as a unit that cannot contain breaks.  When \texttt{breakbefore} and \texttt{breakafter} are used for the same character, \texttt{breakbeforeinrun} and \texttt{breakafterinrun} must both have the same setting.
 %
 %
 %   \item[breakbeforesymbolpost (string) (\meta{none})]
@@ -1712,7 +1714,7 @@
 %
 % \begin{macro}{\minted at executable@minversion}
 %    \begin{macrocode}
-\edef\minted at executable@minversion{\detokenize{0.1.0}}
+\edef\minted at executable@minversion{\detokenize{0.2.0}}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1761,6 +1763,9 @@
 %
 % Timestamp for current compile.  This could eventually be simplified to use |\c_sys_timestamp_str| for all engines; that macro is in \texpkg{l3kernel} from 2023-08-29.
 %
+% The |\outputmode=1| is for |dvilualatex| compatibility.
+%
+% The |\detokenize| is to prevent any possibility of |\catcode| issues.
 % \begin{macro}{\minted at timestamp}
 %    \begin{macrocode}
 \begingroup
@@ -1783,7 +1788,10 @@
 \fi
 \expandafter\ifx\csname directlua\endcsname\relax
 \else
-  \xdef\minted at timestamp{\minted at creationdatetotimestamp{\pdffeedback creationdate}}
+  \begingroup
+  \outputmode=1
+  \xdef\minted at timestamp{\minted at creationdatetotimestamp{\pdffeedback creationdate}}%
+  \endgroup
 \fi
 \endgroup
 \ifcsname minted at timestamp\endcsname
@@ -1804,6 +1812,7 @@
     \ifnum\value{minted at timestamp@min}<10 0\fi\theminted at timestamp@min}
   \endgroup
 \fi
+\xdef\minted at timestamp{\detokenize\expandafter{\minted at timestamp}}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -2162,7 +2171,7 @@
 %
 %    \begin{macrocode}
 \ProcessPgfOptions{/minted/pkg}
-\ifbool{minted at cache}{}{\def\minted at cachedir{}}%
+\ifbool{minted at cache}{}{\minted at pgfopts{highlightmode=immediate,cachedir=,}}
 \ifbool{minted at newfloat}{\RequirePackage{newfloat}}{\RequirePackage{float}}
 \ifcsname tikzifexternalizing\endcsname
   \ifx\tikzifexternalizing\relax
@@ -2392,20 +2401,6 @@
 % \end{macro}
 %
 %
-% \begin{macro}{\minted at exec@cleanfile}
-% Clean (delete) a temp file in all locations where it might be expected to exist.  Only files under the working directory, |TEXMFOUTPUT|, or |TEXMF_OUTPUT_DIRECTORY| can be cleaned, and only if their names match the regex
-%\begin{verbatim}
-%[0-9a-zA-Z_-]+\.(?:config|data|errlog|highlight|message|style)\.minted
-%\end{verbatim}
-% The identifier immediately before the |.minted| file extension describes the role of the file.  Files ending with |.errlog.minted| are not automatically cleaned up at the end of a compile, but are deleted at the beginning as part of config detection.
-%    \begin{macrocode}
-\def\minted at exec@cleanfile#1{%
-  \minted at ShellEscapeNoMessages{%
-    \MintedExecutable\detokenize{ cleanfile }\minted at execarg@debug#1}}
-%    \end{macrocode}
-% \end{macro}
-%
-%
 % \begin{macro}{\minted at inputexecmessages}
 % If temp file containing warning and/or error messages exists, |\input| and then delete.
 %   \begin{macrocode}
@@ -2464,7 +2459,7 @@
 %
 %
 % \begin{macro}{\minted at exec@clean}
-% Clean output directory and cache.
+% Clean temp files and cache.
 %    \begin{macrocode}
 \def\minted at exec@clean{%
   \minted at ShellEscapeNoMessages{%
@@ -2475,7 +2470,31 @@
 % \end{macro}
 %
 %
+% \begin{macro}{\minted at exec@cleanconfig}
+% Clean config temp file.
+%    \begin{macrocode}
+\def\minted at exec@cleanconfig{%
+  \minted at ShellEscapeNoMessages{%
+    \MintedExecutable
+    \detokenize{ cleanconfig }\minted at execarg@timestamp\minted at execarg@debug
+    \MintedJobnameMdfive}}
+%    \end{macrocode}
+% \end{macro}
 %
+%
+% \begin{macro}{\minted at exec@cleantemp}
+% Clean all temp files.
+%    \begin{macrocode}
+\def\minted at exec@cleantemp{%
+  \minted at ShellEscapeNoMessages{%
+    \MintedExecutable
+    \detokenize{ cleantemp }\minted at execarg@timestamp\minted at execarg@debug
+    \MintedJobnameMdfive}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
 % \subsection{Config detection}
 %
 %
@@ -2537,7 +2556,7 @@
   \fi}
 \def\minted at detectconfig@wrongtimestamp{%
   \ifx\minted at timestamp\minted at executable@timestamp
-    \minted at exec@cleanfile{\MintedConfigFilename}%
+    \minted at exec@cleanconfig
     \global\boolfalse{minted at canexec}%
     \minted at error{minted v3 Python executable could not find output directory;
       upgrade to TeX distribution that supports \detokenize{TEXMF_OUTPUT_DIRECTORY}
@@ -2546,7 +2565,7 @@
     \expandafter\minted at detectconfig@noexecutable
   \fi}
 \def\minted at detectconfig@iii{%
-  \minted at exec@cleanfile{\MintedConfigFilename}%
+  \minted at exec@cleanconfig
   \ifx\minted at exec@warning\relax
   \else
     \expandafter\minted at exec@warning
@@ -2735,15 +2754,15 @@
   \def\minted at do@i##1##2{%
     \pgfkeys{%
       /minted/##1/.cd,
-      #1/.code=
+      #1/.code={%
         \def\minted at tmp{####1}%
         \ifx\minted at tmp\minted at const@pgfkeysnovalue
           \begingroup\fvset{#1}\endgroup
           \minted at apptoprovidecs{minted at fvoptlist@##1##2}{#1,}%
         \else
-          \begingroup\fvset{#1=####1}\endgroup
-          \minted at apptoprovidecs{minted at fvoptlist@##1##2}{#1=####1,}%
-        \fi,
+          \begingroup\fvset{#1={####1}}\endgroup
+          \minted at apptoprovidecs{minted at fvoptlist@##1##2}{#1={####1},}%
+        \fi},
     }%
   }%
   \minted at forcsvlist{\minted at do}{\minted at optscopes}%
@@ -2751,7 +2770,7 @@
   \else
     \pgfkeys{%
       /minted/global/.cd,
-      #1=#2,
+      #1={#2},
     }%
   \fi}
 \def\minted at usefvopts{%
@@ -2784,7 +2803,7 @@
       \expandafter{\minted at tmp}{mathescape}%
   \fi}
 \def\minted at useadditionalfvoptsnopy@fvsetvk#1#2{%
-  \fvset{#2=#1}}
+  \fvset{#2={#1}}}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -2833,12 +2852,12 @@
     \if\relax\detokenize{#1}\relax
       \pgfkeys{%
         /minted/##1/.cd,
-        #2/.code=\expandafter\def\csname minted at pyopt@##1##2@#2\endcsname{####1},
+        #2/.code={\expandafter\def\csname minted at pyopt@##1##2@#2\endcsname{####1}},
       }%
     \else
       \pgfkeys{%
         /minted/##1/.cd,
-        #2/.code=
+        #2/.code={%
           \def\minted at tmp{####1}%
           \ifx\minted at tmp\minted at const@pgfkeysnovalue
             \expandafter\let\csname minted at pyopt@##1##2@#2\endcsname\minted at tmp
@@ -2846,7 +2865,7 @@
             #1{minted at pyopt@##1##2@#2}{####1}%
           \else
             \expandafter\def\csname minted at pyopt@##1##2@#2\endcsname{#1{####1}}%
-          \fi\fi,
+          \fi\fi},
       }%
     \fi
     \ifx\minted at const@pgfkeysnovalue#4\relax
@@ -2857,7 +2876,7 @@
     \else
       \pgfkeys{%
         /minted/##1/.cd,
-        #2/.default=#4,
+        #2/.default={#4},
       }%
     \fi
   }%
@@ -2864,7 +2883,7 @@
   \minted at forcsvlist{\minted at do}{\minted at optscopes}%
   \pgfkeys{%
     /minted/global/.cd,
-    #2=#3,
+    #2={#3},
   }}
 \def\mintedpyoptvalueof#1{%
   \ifbool{minted at isinline}%
@@ -2938,13 +2957,13 @@
     \if\relax\detokenize{#1}\relax
       \pgfkeys{%
         /minted/##1/.cd,
-        #2/.code=\expandafter\def\csname minted at texopt@##1##2@#2\endcsname{####1},
+        #2/.code={\expandafter\def\csname minted at texopt@##1##2@#2\endcsname{####1}},
         #2/.value required,
       }%
     \else
       \pgfkeys{%
         /minted/##1/.cd,
-        #2/.code=
+        #2/.code={%
           \def\minted at tmp{####1}%
           \ifx\minted at tmp\minted at const@pgfkeysnovalue
             \expandafter\let\csname minted at texopt@##1##2@#2\endcsname\minted at tmp
@@ -2952,7 +2971,7 @@
             #1{minted at texopt@##1##2@#2}{####1}%
           \else
             \expandafter\def\csname minted at texopt@##1##2@#2\endcsname{#1{####1}}%
-          \fi\fi,
+          \fi\fi},
         #2/.value required,
       }%
     \fi
@@ -2960,7 +2979,7 @@
   \minted at forcsvlist{\minted at do}{\minted at optscopes}%
   \pgfkeys{%
     /minted/global/.cd,
-    #2=#3,
+    #2={#3},
   }}
 \def\mintedtexoptvalueof#1{%
   \ifbool{minted at isinline}%
@@ -3249,8 +3268,13 @@
   \fi
   \ifbool{minted at fasthighlightmode}%
    {}%
-   {\minted at exec@clean
-    \global\boolfalse{minted at canexec}}}
+   {\ifnum\value{minted at numcachefiles}>0\relax
+      \expandafter\minted at exec@clean
+    \else
+      \expandafter\minted at exec@cleantemp
+    \fi
+    \global\boolfalse{minted at canexec}}%
+  \setcounter{minted at numcachefiles}{0}}
 \def\minted at savecachelist{%
   \pydatasetfilename{\MintedDataFilename}%
   \minted at fasthighlightmode@checkstart
@@ -3270,7 +3294,6 @@
       \let\csname minted at cachefile\arabic{minted at tmpcnt}\endcsname\minted at undefined
     \stepcounter{minted at tmpcnt}%
   \repeat
-  \setcounter{minted at numcachefiles}{0}%
   \pydatawritemlvalueline{]}%
   \pydatawritemlvalueend
   \pydatawritedictclose
@@ -3666,7 +3689,8 @@
         \input{\minted at highlightfilepath}}%
       \minted at addcachefilename{\minted at highlightfilename}}%
      {\ifbool{minted at canexec}%
-       {\minted at highlight@create}%
+       {\minted at iffasthighlightmode@buffertempfile
+        \minted at highlight@create}%
        {\minted at error{Cannot highlight code (minted executable is unavailable or
           disabled); attempting to typeset without highlighting}%
         \minted at highlight@fallback}}}%
@@ -3736,7 +3760,122 @@
 % \end{macro}
 %
 %
+% \begin{macro}{\minted at iffasthighlightmode@buffertempfile}
 %
+% With caching, when |fasthighlightmode=true| and |\minted at inputfilepath| has a file extension that has been designated for temp files, read the file into a temp buffer, and then if that succeeds copy the code into the highlighting buffer.  This can avoid errors with temp files that are modified or deleted before highlighting occurs when |fasthighlightmode=true|, since that delays highlighting until the end of the document.
+%
+% This is not done for all highlighted external files because it adds overhead and complexity.  When files are read, it is not possible to determine the newline sequence (|\n| versus |\r\n|), and trailing whitespace is discarded by \TeX\ during the reading process, so it is not possible to reconstruct the original file bytes within \TeX, only an (essentially equivalent) approximation.  As a result, files that are read are hashed a second time after reading to reduce the chance that they were modified after initial hashing but before reading.
+%
+%    \begin{macrocode}
+\begingroup
+\def\minted at set@tempfileextension#1{%
+  \if\relax\detokenize{#1}\relax
+  \else
+    \expandafter\global\expandafter
+      \let\csname minted at buffertempfileextension@#1\endcsname\relax
+  \fi}
+\minted at forcsvlist{\minted at set@tempfileextension}{
+  listing,
+  out,
+  outfile,
+  output,
+  temp,
+  tempfile,
+  tmp,
+  verb,
+  vrb,
+}
+\endgroup
+\begingroup
+\catcode`\/=12
+\catcode`\.=12
+\gdef\minted at iffasthighlightmode@buffertempfile{%
+  \ifbool{minted at fasthighlightmode}%
+   {\ifcsname minted at inputfilepath\endcsname
+      \expandafter\@firstofone
+    \else
+      \expandafter\@gobble
+    \fi
+     {\expandafter
+        \minted at iffasthighlightmode@buffertempfile at i\minted at inputfilepath/\FV at Sentinel}}%
+   {}}
+\gdef\minted at iffasthighlightmode@buffertempfile at i#1/#2\FV at Sentinel{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+   {\minted at iffasthighlightmode@buffertempfile at ii#1.\FV at Sentinel}%
+   {\minted at iffasthighlightmode@buffertempfile at i#2\FV at Sentinel}}
+\gdef\minted at iffasthighlightmode@buffertempfile at ii#1.#2\FV at Sentinel{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+   {\minted at iffasthighlightmode@buffertempfile at iii#2\FV at Sentinel}}
+\gdef\minted at iffasthighlightmode@buffertempfile at iii#1.\FV at Sentinel{%
+  \ifcsname minted at buffertempfileextension@#1\endcsname
+    \expandafter\@firstofone
+  \else
+    \expandafter\@gobble
+  \fi
+   {\minted at iffasthighlightmode@buffertempfile at iv}}
+\endgroup
+\def\minted at iffasthighlightmode@buffertempfile at iv{%
+  \begingroup
+  \setcounter{minted at tmpcodebufferlength}{0}%
+  \newread\minted at intempfile
+  \openin\minted at intempfile=\minted at inputfilepath
+  \endlinechar=-1%
+  \let\do\@makeother\FVExtraDoSpecials
+  \loop\unless\ifeof\minted at intempfile
+    \read\minted at intempfile to\minted at intempfileline
+    \stepcounter{minted at tmpcodebufferlength}%
+    \expandafter\global\expandafter\let\csname
+      minted at tmpcodebufferline\arabic{minted at tmpcodebufferlength}%
+      \endcsname\minted at intempfileline
+  \repeat
+  \closein\minted at intempfile
+  \expandafter\ifx\csname
+      minted at tmpcodebufferline\arabic{minted at tmpcodebufferlength}%
+      \endcsname\@empty
+    \expandafter\global\expandafter\let\csname
+      minted at tmpcodebufferline\arabic{minted at tmpcodebufferlength}%
+      \endcsname\minted at undefined
+    \addtocounter{minted at tmpcodebufferlength}{-1}%
+  \fi
+  \endgroup
+  \edef\minted at inputfilemdfivesum@check{\pdf at filemdfivesum{\minted at inputfilepath}}%
+  \ifx\minted at inputfilemdfivesum@check\minted at inputfilemdfivesum
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+   {\VerbatimClearBuffer[buffername=minted at tmpcodebuffer]}%
+  \ifnum\value{minted at tmpcodebufferlength}>0\relax
+    \expandafter\@firstofone
+  \else
+    \expandafter\@gobble
+  \fi
+   {\minted at iffasthighlightmode@buffertempfile at v}}
+\def\minted at iffasthighlightmode@buffertempfile at v{%
+  \pydatabufferkey{code}%
+  \pydatabuffermlvaluestart
+  \setcounter{minted at tmpcnt}{1}%
+  \loop\unless\ifnum\value{minted at tmpcnt}>\value{minted at tmpcodebufferlength}\relax
+    \expandafter\let\expandafter
+      \minted at tmp\csname minted at tmpcodebufferline\arabic{minted at tmpcnt}\endcsname
+    \expandafter\pydatabuffermlvalueline\expandafter{\minted at tmp}%
+    \stepcounter{minted at tmpcnt}%
+  \repeat
+  \pydatabuffermlvalueend
+  \VerbatimClearBuffer[buffername=minted at tmpcodebuffer]}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
 % \subsection{Public API}
 %
 %
@@ -3771,7 +3910,7 @@
 % \begin{macro}{\usemintedstyle}
 % Set style.  This is a holdover from \mintedpkg\ v1, before |\setminted| could be used to set the style.
 %    \begin{macrocode}
-\newcommand{\usemintedstyle}[2][]{\setminted[#1]{style=#2}}
+\newcommand{\usemintedstyle}[2][]{\setminted[#1]{style={#2}}}
 %    \end{macrocode}
 % \end{macro}
 %

Modified: trunk/Master/texmf-dist/tex/latex/minted/minted.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/minted/minted.sty	2024-10-04 21:30:24 UTC (rev 72462)
+++ trunk/Master/texmf-dist/tex/latex/minted/minted.sty	2024-10-04 21:30:42 UTC (rev 72463)
@@ -26,7 +26,7 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{minted}
-    [2024/09/22 v3.0.0 Yet another Pygments shim for LaTeX]
+    [2024/10/03 v3.1.1 Yet another Pygments shim for LaTeX]
 \RequirePackage{catchfile}
 \RequirePackage{etoolbox}
 \RequirePackage{fvextra}[2024/09/05]
@@ -45,7 +45,7 @@
   \batchmode\read -1 to \minted at fatalerror@exitnow}
 \def\minted at warning#1{\PackageWarning{minted}{#1}}
 \edef\MintedExecutable{\detokenize{latexminted}}
-\edef\minted at executable@minversion{\detokenize{0.1.0}}
+\edef\minted at executable@minversion{\detokenize{0.2.0}}
 \def\minted at executable@setminversioncomponents{%
   \expandafter\minted at executable@setminversioncomponents at i
     \minted at executable@minversion\relax}
@@ -80,7 +80,10 @@
 \fi
 \expandafter\ifx\csname directlua\endcsname\relax
 \else
-  \xdef\minted at timestamp{\minted at creationdatetotimestamp{\pdffeedback creationdate}}
+  \begingroup
+  \outputmode=1
+  \xdef\minted at timestamp{\minted at creationdatetotimestamp{\pdffeedback creationdate}}%
+  \endgroup
 \fi
 \endgroup
 \ifcsname minted at timestamp\endcsname
@@ -101,6 +104,7 @@
     \ifnum\value{minted at timestamp@min}<10 0\fi\theminted at timestamp@min}
   \endgroup
 \fi
+\xdef\minted at timestamp{\detokenize\expandafter{\minted at timestamp}}
 \begingroup
 \catcode`\"=12
 \catcode`\'=12
@@ -276,7 +280,7 @@
     Package option "final" no longer has any effect with minted v3+},
 }
 \ProcessPgfOptions{/minted/pkg}
-\ifbool{minted at cache}{}{\def\minted at cachedir{}}%
+\ifbool{minted at cache}{}{\minted at pgfopts{highlightmode=immediate,cachedir=,}}
 \ifbool{minted at newfloat}{\RequirePackage{newfloat}}{\RequirePackage{float}}
 \ifcsname tikzifexternalizing\endcsname
   \ifx\tikzifexternalizing\relax
@@ -389,9 +393,6 @@
   \ifbool{minted at debug}{\detokenize{ --debug }}{}}
 \def\minted at execarg@timestamp{%
   \detokenize{ --timestamp }\minted at timestamp\detokenize{ }}
-\def\minted at exec@cleanfile#1{%
-  \minted at ShellEscapeNoMessages{%
-    \MintedExecutable\detokenize{ cleanfile }\minted at execarg@debug#1}}
 \def\minted at inputexecmessages{%
   \minted at ensureatletter{\InputIfFileExists{\MintedMessageFilename}{}{}}}
 \def\minted at exec@batch{%
@@ -419,6 +420,16 @@
     \MintedExecutable
     \detokenize{ clean }\minted at execarg@timestamp\minted at execarg@debug
     \MintedJobnameMdfive}}
+\def\minted at exec@cleanconfig{%
+  \minted at ShellEscapeNoMessages{%
+    \MintedExecutable
+    \detokenize{ cleanconfig }\minted at execarg@timestamp\minted at execarg@debug
+    \MintedJobnameMdfive}}
+\def\minted at exec@cleantemp{%
+  \minted at ShellEscapeNoMessages{%
+    \MintedExecutable
+    \detokenize{ cleantemp }\minted at execarg@timestamp\minted at execarg@debug
+    \MintedJobnameMdfive}}
 \newbool{minted at diddetectconfig}
 \def\minted at detectconfig{%
   \ifbool{minted at diddetectconfig}%
@@ -466,7 +477,7 @@
   \fi}
 \def\minted at detectconfig@wrongtimestamp{%
   \ifx\minted at timestamp\minted at executable@timestamp
-    \minted at exec@cleanfile{\MintedConfigFilename}%
+    \minted at exec@cleanconfig
     \global\boolfalse{minted at canexec}%
     \minted at error{minted v3 Python executable could not find output directory;
       upgrade to TeX distribution that supports \detokenize{TEXMF_OUTPUT_DIRECTORY}
@@ -475,7 +486,7 @@
     \expandafter\minted at detectconfig@noexecutable
   \fi}
 \def\minted at detectconfig@iii{%
-  \minted at exec@cleanfile{\MintedConfigFilename}%
+  \minted at exec@cleanconfig
   \ifx\minted at exec@warning\relax
   \else
     \expandafter\minted at exec@warning
@@ -601,15 +612,15 @@
   \def\minted at do@i##1##2{%
     \pgfkeys{%
       /minted/##1/.cd,
-      #1/.code=
+      #1/.code={%
         \def\minted at tmp{####1}%
         \ifx\minted at tmp\minted at const@pgfkeysnovalue
           \begingroup\fvset{#1}\endgroup
           \minted at apptoprovidecs{minted at fvoptlist@##1##2}{#1,}%
         \else
-          \begingroup\fvset{#1=####1}\endgroup
-          \minted at apptoprovidecs{minted at fvoptlist@##1##2}{#1=####1,}%
-        \fi,
+          \begingroup\fvset{#1={####1}}\endgroup
+          \minted at apptoprovidecs{minted at fvoptlist@##1##2}{#1={####1},}%
+        \fi},
     }%
   }%
   \minted at forcsvlist{\minted at do}{\minted at optscopes}%
@@ -617,7 +628,7 @@
   \else
     \pgfkeys{%
       /minted/global/.cd,
-      #1=#2,
+      #1={#2},
     }%
   \fi}
 \def\minted at usefvopts{%
@@ -650,7 +661,7 @@
       \expandafter{\minted at tmp}{mathescape}%
   \fi}
 \def\minted at useadditionalfvoptsnopy@fvsetvk#1#2{%
-  \fvset{#2=#1}}
+  \fvset{#2={#1}}}
 \def\minted at pgfkeyscreate@py#1#2{%
   \minted at forcsvlist{\minted at pgfkeycreate@py{#1}}{#2}}
 \begingroup
@@ -688,12 +699,12 @@
     \if\relax\detokenize{#1}\relax
       \pgfkeys{%
         /minted/##1/.cd,
-        #2/.code=\expandafter\def\csname minted at pyopt@##1##2@#2\endcsname{####1},
+        #2/.code={\expandafter\def\csname minted at pyopt@##1##2@#2\endcsname{####1}},
       }%
     \else
       \pgfkeys{%
         /minted/##1/.cd,
-        #2/.code=
+        #2/.code={%
           \def\minted at tmp{####1}%
           \ifx\minted at tmp\minted at const@pgfkeysnovalue
             \expandafter\let\csname minted at pyopt@##1##2@#2\endcsname\minted at tmp
@@ -701,7 +712,7 @@
             #1{minted at pyopt@##1##2@#2}{####1}%
           \else
             \expandafter\def\csname minted at pyopt@##1##2@#2\endcsname{#1{####1}}%
-          \fi\fi,
+          \fi\fi},
       }%
     \fi
     \ifx\minted at const@pgfkeysnovalue#4\relax
@@ -712,7 +723,7 @@
     \else
       \pgfkeys{%
         /minted/##1/.cd,
-        #2/.default=#4,
+        #2/.default={#4},
       }%
     \fi
   }%
@@ -719,7 +730,7 @@
   \minted at forcsvlist{\minted at do}{\minted at optscopes}%
   \pgfkeys{%
     /minted/global/.cd,
-    #2=#3,
+    #2={#3},
   }}
 \def\mintedpyoptvalueof#1{%
   \ifbool{minted at isinline}%
@@ -780,13 +791,13 @@
     \if\relax\detokenize{#1}\relax
       \pgfkeys{%
         /minted/##1/.cd,
-        #2/.code=\expandafter\def\csname minted at texopt@##1##2@#2\endcsname{####1},
+        #2/.code={\expandafter\def\csname minted at texopt@##1##2@#2\endcsname{####1}},
         #2/.value required,
       }%
     \else
       \pgfkeys{%
         /minted/##1/.cd,
-        #2/.code=
+        #2/.code={%
           \def\minted at tmp{####1}%
           \ifx\minted at tmp\minted at const@pgfkeysnovalue
             \expandafter\let\csname minted at texopt@##1##2@#2\endcsname\minted at tmp
@@ -794,7 +805,7 @@
             #1{minted at texopt@##1##2@#2}{####1}%
           \else
             \expandafter\def\csname minted at texopt@##1##2@#2\endcsname{#1{####1}}%
-          \fi\fi,
+          \fi\fi},
         #2/.value required,
       }%
     \fi
@@ -802,7 +813,7 @@
   \minted at forcsvlist{\minted at do}{\minted at optscopes}%
   \pgfkeys{%
     /minted/global/.cd,
-    #2=#3,
+    #2={#3},
   }}
 \def\mintedtexoptvalueof#1{%
   \ifbool{minted at isinline}%
@@ -1023,8 +1034,13 @@
   \fi
   \ifbool{minted at fasthighlightmode}%
    {}%
-   {\minted at exec@clean
-    \global\boolfalse{minted at canexec}}}
+   {\ifnum\value{minted at numcachefiles}>0\relax
+      \expandafter\minted at exec@clean
+    \else
+      \expandafter\minted at exec@cleantemp
+    \fi
+    \global\boolfalse{minted at canexec}}%
+  \setcounter{minted at numcachefiles}{0}}
 \def\minted at savecachelist{%
   \pydatasetfilename{\MintedDataFilename}%
   \minted at fasthighlightmode@checkstart
@@ -1044,7 +1060,6 @@
       \let\csname minted at cachefile\arabic{minted at tmpcnt}\endcsname\minted at undefined
     \stepcounter{minted at tmpcnt}%
   \repeat
-  \setcounter{minted at numcachefiles}{0}%
   \pydatawritemlvalueline{]}%
   \pydatawritemlvalueend
   \pydatawritedictclose
@@ -1342,7 +1357,8 @@
         \input{\minted at highlightfilepath}}%
       \minted at addcachefilename{\minted at highlightfilename}}%
      {\ifbool{minted at canexec}%
-       {\minted at highlight@create}%
+       {\minted at iffasthighlightmode@buffertempfile
+        \minted at highlight@create}%
        {\minted at error{Cannot highlight code (minted executable is unavailable or
           disabled); attempting to typeset without highlighting}%
         \minted at highlight@fallback}}}%
@@ -1408,6 +1424,110 @@
       \minted at highlight@fallback}}}
 \def\minted at highlight@fallback{%
   \minted at insertplaceholder}
+\begingroup
+\def\minted at set@tempfileextension#1{%
+  \if\relax\detokenize{#1}\relax
+  \else
+    \expandafter\global\expandafter
+      \let\csname minted at buffertempfileextension@#1\endcsname\relax
+  \fi}
+\minted at forcsvlist{\minted at set@tempfileextension}{
+  listing,
+  out,
+  outfile,
+  output,
+  temp,
+  tempfile,
+  tmp,
+  verb,
+  vrb,
+}
+\endgroup
+\begingroup
+\catcode`\/=12
+\catcode`\.=12
+\gdef\minted at iffasthighlightmode@buffertempfile{%
+  \ifbool{minted at fasthighlightmode}%
+   {\ifcsname minted at inputfilepath\endcsname
+      \expandafter\@firstofone
+    \else
+      \expandafter\@gobble
+    \fi
+     {\expandafter
+        \minted at iffasthighlightmode@buffertempfile at i\minted at inputfilepath/\FV at Sentinel}}%
+   {}}
+\gdef\minted at iffasthighlightmode@buffertempfile at i#1/#2\FV at Sentinel{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
+   {\minted at iffasthighlightmode@buffertempfile at ii#1.\FV at Sentinel}%
+   {\minted at iffasthighlightmode@buffertempfile at i#2\FV at Sentinel}}
+\gdef\minted at iffasthighlightmode@buffertempfile at ii#1.#2\FV at Sentinel{%
+  \if\relax\detokenize{#2}\relax
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+   {\minted at iffasthighlightmode@buffertempfile at iii#2\FV at Sentinel}}
+\gdef\minted at iffasthighlightmode@buffertempfile at iii#1.\FV at Sentinel{%
+  \ifcsname minted at buffertempfileextension@#1\endcsname
+    \expandafter\@firstofone
+  \else
+    \expandafter\@gobble
+  \fi
+   {\minted at iffasthighlightmode@buffertempfile at iv}}
+\endgroup
+\def\minted at iffasthighlightmode@buffertempfile at iv{%
+  \begingroup
+  \setcounter{minted at tmpcodebufferlength}{0}%
+  \newread\minted at intempfile
+  \openin\minted at intempfile=\minted at inputfilepath
+  \endlinechar=-1%
+  \let\do\@makeother\FVExtraDoSpecials
+  \loop\unless\ifeof\minted at intempfile
+    \read\minted at intempfile to\minted at intempfileline
+    \stepcounter{minted at tmpcodebufferlength}%
+    \expandafter\global\expandafter\let\csname
+      minted at tmpcodebufferline\arabic{minted at tmpcodebufferlength}%
+      \endcsname\minted at intempfileline
+  \repeat
+  \closein\minted at intempfile
+  \expandafter\ifx\csname
+      minted at tmpcodebufferline\arabic{minted at tmpcodebufferlength}%
+      \endcsname\@empty
+    \expandafter\global\expandafter\let\csname
+      minted at tmpcodebufferline\arabic{minted at tmpcodebufferlength}%
+      \endcsname\minted at undefined
+    \addtocounter{minted at tmpcodebufferlength}{-1}%
+  \fi
+  \endgroup
+  \edef\minted at inputfilemdfivesum@check{\pdf at filemdfivesum{\minted at inputfilepath}}%
+  \ifx\minted at inputfilemdfivesum@check\minted at inputfilemdfivesum
+    \expandafter\@gobble
+  \else
+    \expandafter\@firstofone
+  \fi
+   {\VerbatimClearBuffer[buffername=minted at tmpcodebuffer]}%
+  \ifnum\value{minted at tmpcodebufferlength}>0\relax
+    \expandafter\@firstofone
+  \else
+    \expandafter\@gobble
+  \fi
+   {\minted at iffasthighlightmode@buffertempfile at v}}
+\def\minted at iffasthighlightmode@buffertempfile at v{%
+  \pydatabufferkey{code}%
+  \pydatabuffermlvaluestart
+  \setcounter{minted at tmpcnt}{1}%
+  \loop\unless\ifnum\value{minted at tmpcnt}>\value{minted at tmpcodebufferlength}\relax
+    \expandafter\let\expandafter
+      \minted at tmp\csname minted at tmpcodebufferline\arabic{minted at tmpcnt}\endcsname
+    \expandafter\pydatabuffermlvalueline\expandafter{\minted at tmp}%
+    \stepcounter{minted at tmpcnt}%
+  \repeat
+  \pydatabuffermlvalueend
+  \VerbatimClearBuffer[buffername=minted at tmpcodebuffer]}
 \newcommand{\setminted}[2][]{%
   \ifstrempty{#1}%
    {\pgfkeys{/minted/global/.cd,#2}}%
@@ -1422,7 +1542,7 @@
     \edef\minted at lexer{#1}%
     \pgfkeys{/minted/lexerinline/.cd,#2}%
     \let\minted at lexer\minted at tmplexer}}
-\newcommand{\usemintedstyle}[2][]{\setminted[#1]{style=#2}}
+\newcommand{\usemintedstyle}[2][]{\setminted[#1]{style={#2}}}
 \def\mintinline{%
   \FVExtraRobustCommand\RobustMintInline\FVExtraUnexpandedReadStarOArgMArgBVArg}
 \FVExtrapdfstringdefDisableCommands{%



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