texlive[61405] Master/texmf-dist: minted (25dec21)

commits+karl at tug.org commits+karl at tug.org
Sat Dec 25 22:41:49 CET 2021


Revision: 61405
          http://tug.org/svn/texlive?view=revision&revision=61405
Author:   karl
Date:     2021-12-25 22:41:49 +0100 (Sat, 25 Dec 2021)
Log Message:
-----------
minted (25dec21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/minted/minted.pdf
    trunk/Master/texmf-dist/source/latex/minted/minted.dtx
    trunk/Master/texmf-dist/source/latex/minted/minted.ins
    trunk/Master/texmf-dist/tex/latex/minted/minted.sty
    trunk/Master/texmf-dist/tex/latex/minted/minted1.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/source/latex/minted/Makefile

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/minted/Makefile

Deleted: trunk/Master/texmf-dist/doc/latex/minted/Makefile
===================================================================
--- trunk/Master/texmf-dist/doc/latex/minted/Makefile	2021-12-25 21:41:30 UTC (rev 61404)
+++ trunk/Master/texmf-dist/doc/latex/minted/Makefile	2021-12-25 21:41:49 UTC (rev 61405)
@@ -1,38 +0,0 @@
-TEXFLAGS = -e '$$pdflatex=q/pdflatex %O -shell-escape %S/' -pdf
-LATEXMK = latexmk
-
-PACKAGE = minted.dtx \
-		  minted.ins \
-		  minted.pdf \
-		  README \
-		  Makefile
-
-.PHONY: minted all doc dist clean cleanall
-
-minted: minted.sty
-
-doc: minted.pdf
-
-all: minted doc
-
-minted.sty: minted.ins minted.dtx
-	tex minted.ins
-
-minted.pdf: minted.sty minted.gls minted.dtx
-	$(LATEXMK) $(TEXFLAGS) minted.dtx
-
-minted.gls: minted.glo
-	makeindex -s gglo.ist -o minted.gls minted.glo
-
-minted.glo: minted.dtx minted.sty
-	$(LATEXMK) $(TEXFLAGS) minted.dtx
-
-dist: $(PACKAGE)
-	@$(RM) minted.zip
-	@zip minted-$(shell grep '^\\ProvidesPackage' < minted.sty | grep -o '\<v[[:digit:]]*\.[[:digit:]]*\>').zip $(PACKAGE)
-
-clean:
-	@$(RM) *.aux *.log *.out *.toc *.fdb_latexmk *.ilg *.glo *.gls *.lol
-
-cleanall: clean
-	@$(RM) minted.sty minted.zip

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

Added: trunk/Master/texmf-dist/source/latex/minted/Makefile
===================================================================
--- trunk/Master/texmf-dist/source/latex/minted/Makefile	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/minted/Makefile	2021-12-25 21:41:49 UTC (rev 61405)
@@ -0,0 +1,38 @@
+TEXFLAGS = -e '$$pdflatex=q/pdflatex %O -shell-escape %S/' -pdf
+LATEXMK = latexmk
+
+PACKAGE = minted.dtx \
+		  minted.ins \
+		  minted.pdf \
+		  README \
+		  Makefile
+
+.PHONY: minted all doc dist clean cleanall
+
+minted: minted.sty
+
+doc: minted.pdf
+
+all: minted doc
+
+minted.sty: minted.ins minted.dtx
+	tex minted.ins
+
+minted.pdf: minted.sty minted.gls minted.dtx
+	$(LATEXMK) $(TEXFLAGS) minted.dtx
+
+minted.gls: minted.glo
+	makeindex -s gglo.ist -o minted.gls minted.glo
+
+minted.glo: minted.dtx minted.sty
+	$(LATEXMK) $(TEXFLAGS) minted.dtx
+
+dist: $(PACKAGE)
+	@$(RM) minted.zip
+	@zip minted-$(shell grep '^\\ProvidesPackage' < minted.sty | grep -o '\<v[[:digit:]]*\.[[:digit:]]*\>').zip $(PACKAGE)
+
+clean:
+	@$(RM) *.aux *.log *.out *.toc *.fdb_latexmk *.ilg *.glo *.gls *.lol
+
+cleanall: clean
+	@$(RM) minted.sty minted.zip


Property changes on: trunk/Master/texmf-dist/source/latex/minted/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ 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	2021-12-25 21:41:30 UTC (rev 61404)
+++ trunk/Master/texmf-dist/source/latex/minted/minted.dtx	2021-12-25 21:41:49 UTC (rev 61405)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 2013-2017 by Geoffrey M. Poore <gpoore at gmail.com>
+% Copyright (C) 2013-2021 by Geoffrey M. Poore <gpoore at gmail.com>
 % Copyright (C) 2010-2011 by Konrad Rudolph <konrad_rudolph at madrat.net>
 % ---------------------------------------------------------------------------
 % This work may be distributed and/or modified under the
@@ -31,7 +31,7 @@
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{minted}
 %<*package>
-    [2017/07/19 v2.5 Yet another Pygments shim for LaTeX]
+    [2021/12/24 v2.6 Yet another Pygments shim for LaTeX]
 %</package>
 %<*driver>
 \documentclass{ltxdoc}
@@ -49,10 +49,6 @@
 \usepackage[svgnames]{xcolor}
 \usepackage{textcomp}
 \usepackage[cache, langlinenos]{minted}
-% Need to set the style here so that it is defined and brought in here.
-% If the style is set later, then docstrip interferes with any comments in
-% the style definition so that they appear as literal text in the document.
-\setminted{style=default}
 
 \usepackage{environ}
 \usepackage{graphicx}
@@ -61,6 +57,20 @@
 
 
 \makeatletter
+% The typesetting for macrocode doesn't use \@noligs, which upquote modifies.
+% So apply the upquote fix to \verbatim at nolig@list as well, which is in macrocode.
+\begingroup
+\catcode`'=\active
+\catcode``=\active
+\g at addto@macro\verbatim at nolig@list{%
+  \let'\textquotesingle
+  \let`\textasciigrave
+  \ifx\encodingdefault\upquote at OTone
+  \ifx\ttdefault\upquote at cmtt
+    \def'{\char13 }%
+    \def`{\char18 }%
+  \fi\fi}
+\endgroup
 
 % Create a short verbatim pipe that handles quotation marks properly
 \begingroup
@@ -98,8 +108,8 @@
     \g at addto@macro\changestext{\end{itemize}}%
 }
 \newcommand{\PrintChangelog}{%
+    \section*{Version History}%
     \addcontentsline{toc}{section}{Version History}
-    \section*{Version History}%
     \label{sec:version-history}
     \begin{description}%
     \changestext
@@ -195,7 +205,7 @@
 %</driver>
 % \fi
 %
-% \CheckSum{2604}
+% \CheckSum{2593}
 %
 % \CharacterTable
 %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -216,6 +226,18 @@
 %
 %
 %
+% \begin{changelog}{v2.6}{2021/12/24}
+% \item \texttt{autogobble} automatically uses \texttt{python} or \texttt{python3} executables, depending on availability, instead of requiring \texttt{python}.  A custom executable can be specified by redefining \texttt{\string\MintedPython} (\#277, \#287).
+% \item Fixed \texttt{autogobble} compatibility with \texttt{fancyvrb} 4.0+ (\#315, \#316).
+% \item Pygments style names may now contain arbitrary non-whitespace characters.  Previously, style names containing digits and some punctuation characters were incompatible (\#210, \#294, \#299, \#317).  Pygments macros are now only defined just before use locally within \texttt{minted} commands and environments, rather than globally.  Pygments macros now always use a \texttt{\string\PYG} prefix regardless of style, rather than a prefix of the form \texttt{\string\PYG<style>} (for example, what was previously \texttt{\string\PYGdefault} is now simply \texttt{\string\PYG}).
+% \item Removed Python-based MD5 hashing for XeTeX, which was necessary before XeTeX added \texttt{\string\mdfivesum} in 2017.
+% \item The default for \texttt{stripnl} is now \texttt{false}, so that original code is preserved exactly by default (\#198).
+% \item Added support for \texttt{fontencoding} option from \texttt{fvextra} (\#208).
+% \item Added note to FAQ about getting \texttt{texi2pdf} to work with \texttt{minted} given \texttt{texi2pdf}'s assumptions about temp files (\#186).
+% \item Reimplemented \texttt{bgcolor} option to be compatible with \texttt{color} package.
+% \end{changelog}
+%
+%
 % \begin{changelog}{v2.5}{2017/07/19}
 % \item The default placement for the \texttt{listing} float is now \texttt{tbp} instead of \texttt{h}, to parallel \texttt{figure} and \texttt{table} and also avoid warnings caused by \texttt{h} (\#165).  The documentation now contains information about changing default placement.  The \texttt{float} package is no longer loaded when the \texttt{newfloat} package option is used.
 % \item Added support for \texttt{*nchars} options from \texttt{fvextra} v1.3 that allow setting \texttt{breaklines}-related indentation in terms of a number of characters, rather than as a fixed dimension.
@@ -543,6 +565,9 @@
 %   \item lineno
 %   \item framed
 %   \item shellesc (for luatex 0.87+)
+%   \item catchfile
+%
+%   ~
 % \end{list}
 % \endgroup
 % \end{multicols}
@@ -815,6 +840,11 @@
 % Compiling with the |finalizecache| option prepares the cache for use in an environment without |-shell-escape|.\footnote{Ordinarily, cache files are named using an MD5 hash of highlighting settings and highlighted text.  \texttt{finalizecache} renames cache files using a \texttt{listing<number>.pygtex} scheme.  This makes it simpler to match up document content and cache files, and is also necessary for the XeTeX engine since prior to TeX Live 2016 it lacked the built-in MD5 capabilities that pdfTeX and LuaTeX have.}  Once this has been done, the |finalizecache| option may be swapped for the |frozencache| option, which will then use the frozen (static) cache in the future, without needing |-shell-escape|.
 %
 %
+% \DescribeMacro{fontencoding=\meta{encoding} (default:~\meta{doc~encoding})}
+% Set font encoding used for typesetting code.
+%
+% For example, |fontencoding=T1|.
+%
 % \DescribeMacro{frozencache=\meta{boolean} (default:~false)}
 % Use a frozen (static) cache created with the |finalizecache| option.  When |frozencache| is on, |-shell-escape| is not needed, and Python and Pygments are not required.  In addition, any external files accessed through |\inputminted| are no longer necessary.
 %
@@ -1361,7 +1391,7 @@
 %
 %   \item[stripall (boolean) (false)]
 %     Strip all leading and trailing whitespace from the input.
-%   \item[stripnl (boolean) (true)]
+%   \item[stripnl (boolean) (false)]
 %     Strip leading and trailing newlines from the input.
 %
 %
@@ -1481,7 +1511,7 @@
 %
 % \begin{itemize}
 % \item \textbf{There are intermittent ``I can't write on file'' errors.}  This can be caused by using \pkg{minted} in a directory that is synchronized with Dropbox or a similar file syncing program.  These programs can try to sync \pkg{minted}'s temporary files while it still needs to be able to modify them.  The solution is to turn off file syncing or use a directory that is not synced.
-% \item \textbf{I receive a ``Font Warning:  Some font shapes were not available'' message, or bold or italic seem to be missing.}  This due to a limitation in the font that is currently in use for typesetting code.  In some cases, the default font shapes that \LaTeX\ substitutes are perfectly adequate, and the warning may be ignored.  In other cases, the font substitutions may not clearly indicate bold or italic text, and you will want to switch to a different font.  See The \LaTeX\ Font Catalogue's section on \href{http://www.tug.dk/FontCatalogue/typewriterfonts.html}{Typewriter Fonts} for alternatives.  If you like the default \LaTeX\ fonts, the \pkg{lmodern} package is a good place to start.  The \pkg{beramono} and \pkg{courier} packages may also be good options.
+% \item \textbf{I receive a ``Font Warning:  Some font shapes were not available'' message, or bold or italic seem to be missing.}  This is due to a limitation in the font that is currently in use for typesetting code.  In some cases, the default font shapes that \LaTeX\ substitutes are perfectly adequate, and the warning may be ignored.  In other cases, the font substitutions may not clearly indicate bold or italic text, and you will want to switch to a different font.  See The \LaTeX\ Font Catalogue's section on \href{http://www.tug.dk/FontCatalogue/typewriterfonts.html}{Typewriter Fonts} for alternatives.  If you like the default \LaTeX\ fonts, the \pkg{lmodern} package is a good place to start.  The \pkg{beramono} and \pkg{courier} packages may also be good options.
 % \item \textbf{I receive a ``Too many open files'' error under OS X when using caching.}  See the note on OS X under Section~\ref{sec:basic:preliminary}.
 % \item \textbf{TeXShop can't find \texttt{pygmentize}.}  You may need to create a symlink.  See \url{https://tex.stackexchange.com/questions/279214}.
 % \item \textbf{Weird things happen when I use the \pkg{fancybox} package.}  \pkg{fancybox} conflicts with \pkg{fancyvrb}, which \pkg{minted} uses internally.  When using \pkg{fancybox}, make sure that it is loaded before \pkg{minted} (or before \pkg{fancyvrb}, if \pkg{fancyvrb} is not loaded by \pkg{minted}).
@@ -1558,6 +1588,7 @@
 % \item \textbf{I want extended characters in frame labels, but am getting errors.}  This can happen with \pkg{minted} <2.0 and Python 2.7, due to a \href{https://bitbucket.org/birkenfeld/pygments-main/issue/801/python-2-fails-to-detect-terminal-encoding}{terminal encoding issue with Pygments}.  It should work with any version of Python with \pkg{minted} 2.0+, which processes labels internally and does not send them to Python.
 % \item \textbf{\texttt{minted} environments have extra vertical space inside \texttt{tabular}.}  It is possible to \href{https://github.com/gpoore/minted/issues/82}{create a custom environment} that eliminates the extra space.  However, a general solution that behaves as expected in the presence of adjacent text remains to be found.
 % \item \textbf{I'm receiving a warning from \texttt{lineno.sty} that ``Command \texttt{\string\@parboxrestore} has changed.''}  This can happen when \pkg{minted} is loaded after \pkg{csquotes}.  Try loading \pkg{minted} first.  If you receive this message when you are not using \pkg{csquotes}, you may want to experiment with the order of loading packages and might also open an issue.
+% \item \textbf{I'm using \app{texi2pdf}, and getting ``Cannot stat'' errors from \app{tar}}:  This is due to the way that \app{texi2pdf} handles temporary files.  \pkg{minted} automatically cleans up its temporary files, but \app{texi2pdf} assumes that any temporary file that is ever created will still exist at the end of the run, so it tries to access the files that \pkg{minted} has deleted. It's possible to disable minted's temp file cleanup by adding |\renewcommand{\DeleteFile}[2][]{}| after the |\usepackage{minted}|.
 % \end{itemize}
 %
 %
@@ -1564,10 +1595,17 @@
 %
 %
 % \section*{Acknowledgements}
+% \addcontentsline{toc}{section}{Acknowledgements}
 %
-% Konrad Rudolph:  Special thanks to Philipp Stephani and the rest of the guys from \texttt{comp.text.tex} and \texttt{tex.stackexchange.com}.
+% \textbf{Konrad Rudolph:}  Special thanks to Philipp Stephani and the rest of the guys from \texttt{comp.text.tex} and \texttt{tex.stackexchange.com}.
 %
-% Geoffrey Poore:  Thanks to Marco Daniel for the code on \url{tex.stackexchange.com} that inspired automatic line breaking.  Thanks to Patrick Vogt for improving TikZ externalization compatibility.
+% \textbf{Geoffrey Poore:}
+% \begin{itemize}
+% \item Thanks to Marco Daniel for the code on \url{tex.stackexchange.com} that inspired automatic line breaking.
+% \item Thanks to Patrick Vogt for improving TikZ externalization compatibility.
+% \item Thanks to \textsf{@muzimuzhi} for assistance with GitHub issues.
+% \item Thanks to \textsf{@jfbu} for suggestions and discussion regarding support for arbitrary Pygments style names (\#210, \#294, \#299, \#317), and for debugging assistance.
+% \end{itemize}
 %
 % \PrintChangelog
 %
@@ -1601,6 +1639,7 @@
 \RequirePackage{xstring}
 \RequirePackage{lineno}
 \RequirePackage{framed}
+\RequirePackage{catchfile}
 %    \end{macrocode}
 %
 % Make sure that either |color| or |xcolor| is loaded by the beginning of the document.
@@ -1923,7 +1962,7 @@
 %    \begin{macrocode}
 \newboolean{AppExists}
 \newread\minted at appexistsfile
-\newcommand{\TestAppExists}[1]{
+\newcommand{\TestAppExists}[1]{%
   \ifwindows
 %    \end{macrocode}
 %
@@ -1932,21 +1971,21 @@
 % otherwise, it will contain the full path of the application.
 %
 %    \begin{macrocode}
-    \DeleteFile{\minted at jobname.aex}
+    \DeleteFile{\minted at jobname.aex}%
     \ShellEscape{for \string^\@percentchar i in (#1.exe #1.bat #1.cmd)
       do set > \minted at jobname.aex <nul: /p 
-      x=\string^\@percentchar \string~$PATH:i>> \minted at jobname.aex}
+      x=\string^\@percentchar \string~$PATH:i>> \minted at jobname.aex}%
     %$ <- balance syntax highlighting
     \immediate\openin\minted at appexistsfile\minted at jobname.aex
-    \expandafter\def\expandafter\@tmp at cr\expandafter{\the\endlinechar}
+    \expandafter\def\expandafter\@tmp at cr\expandafter{\the\endlinechar}%
     \endlinechar=-1\relax
     \readline\minted at appexistsfile to \minted at apppathifexists
     \endlinechar=\@tmp at cr
-    \ifthenelse{\equal{\minted at apppathifexists}{}}
-     {\AppExistsfalse}
-     {\AppExiststrue}
+    \ifthenelse{\equal{\minted at apppathifexists}{}}%
+     {\AppExistsfalse}%
+     {\AppExiststrue}%
     \immediate\closein\minted at appexistsfile
-    \DeleteFile{\minted at jobname.aex}
+    \DeleteFile{\minted at jobname.aex}%
   \else
 %    \end{macrocode}
 %
@@ -1953,11 +1992,11 @@
 % On Unix-like systems, we do a straightforward |which| test and create a file upon success, whose existence we can then check.
 %
 %    \begin{macrocode}
-    \ShellEscape{which #1 && touch \minted at jobname.aex}
-    \IfFileExists{\minted at jobname.aex}
+    \ShellEscape{which #1 && touch \minted at jobname.aex}%
+    \IfFileExists{\minted at jobname.aex}%
       {\AppExiststrue
-        \DeleteFile{\minted at jobname.aex}}
-      {\AppExistsfalse}
+        \DeleteFile{\minted at jobname.aex}}%
+      {\AppExistsfalse}%
   \fi
 }
 %    \end{macrocode}
@@ -2397,85 +2436,116 @@
 % \end{macro}
 %
 %
-% \begin{macro}{\minted at checkstyle}
-% Make sure that style macros exist.
+% \begin{macro}{\minted at def@opt at detok}
+% Same as |\minted at def@opt|, except wraps argument in |\detokenize|.
+%    \begin{macrocode}
+\newcommand{\minted at def@opt at detok}[2][]{%
+  \define at key{minted at opt@g}{#2}{%
+    \@namedef{minted at opt@g:#2}{\detokenize{##1}}}
+  \define at key{minted at opt@g at i}{#2}{%
+    \@namedef{minted at opt@g at i:#2}{\detokenize{##1}}}
+  \define at key{minted at opt@lang}{#2}{%
+    \@namedef{minted at opt@lang\minted at lang:#2}{\detokenize{##1}}}
+  \define at key{minted at opt@lang at i}{#2}{%
+    \@namedef{minted at opt@lang\minted at lang @i:#2}{\detokenize{##1}}}
+  \define at key{minted at opt@cmd}{#2}{%
+    \@namedef{minted at opt@cmd:#2}{\detokenize{##1}}}
+  \ifstrempty{#1}{}{\@namedef{minted at opt@g:#2}{\detokenize{#1}}}%
+}
+%    \end{macrocode}
+% \end{macro}
 %
-% We have to do some tricks with |\endlinechar| to prevent |\input| from inserting unwanted whitespace.  That is primarily for inline commands, where it would introduce a line break.  There is also the very unorthodox |\let\def\gdef| to make sure that macros are defined globally.  The catcodes for |-| and |_| must be changed during macro definition to accomodate style names like |paraiso-light|, |paraiso-dark|, and |algol_nu|.  The catcode for |%| must be changed to the default value in case \pkg{minted} is being used in a |.dtx| file; otherwise, \LaTeX\ comments in the Pygments style files will appear as literal text.
 %
-% If a style is not given, then revert to the |default| style, but create macros with prefix |PYG|, and create |default-pyg-prefix.pygstyle| if caching is on.  This allows a graceful fallback in the event that style is empty.  It is also purposefully used to create a complete set of macros with prefix |PYG|, so that the symbol macros may be used, as described next.
+% \begin{macro}{\minted at generate@PYGdef}
+% Generate Pygments style definition with |pygmentize| if a cached version does not exist.  Load the style definition into a global macro of the form 
+%\begin{Verbatim}
+%\csname minted at PYGdef@<style>\endcsname
+%\end{Verbatim}
+% to allow styles to be defined later.  Styles are not defined globally to avoid naming issues with style names that involve punctuation characters and numbers.  Rather, styles are redefined upon every use (within groups), and all styles use macros with a |\PYG| prefix.
 %
-% The typical style macros created by |\minted at checkstyle|, which are of the form |\PYG<style>|, are used indirectly.  All code is highlighted with |commandprefix=PYG|, so that it uses |\PYG|.  Then |\PYG| is |\let| to |\PYG<style>| as appropriate.  This way, code need not be highlighted again when the style is changed.  This has the disadvantage that none of the |\PYG<symbol>| macros will be defined; rather, only |\PYG<style><symbol>| macros will be defined.  It would be possible to |\let| |\PYG<symbol>| to |\PYG<style><symbol>|, but it is simpler to define a complete set of symbol macros using the |PYG| prefix, so that all symbol macros will be defined by default.\footnote{It would be possible to hard-code the symbol macros in \pkg{minted} itself, but that would have the disadvantage of tying \pkg{minted} more closely to a particular version of \pkg{Pygments}.  Similarly, \texttt{\string\let}ing symbol macros assumes a complete, fixed list of symbol macros.  The current approach is harder to break than these alternatives; the worst-case scenario should be needing to purge the cache, rather than dealing with an undefined macro.}
+% Takes a single argument that is the detokenized style name.  Getting the detokenized style name here requires expansion (|\edef|) in an earlier macro (currently |\minted at defstyle|) to convert |\minted at get@opt{style}{default}| into detokenized text.  The |style| value is always wrapped in |\detokenize| when it is set, so expansion automatically detokenizes.  Detokenization can be important depending on active characters.  Expansion is important because the style name may be used with caching, so we need the current value retrieved by |\minted at get@opt|, not the value at the end of the document when cache data is written to the |.aux| file.  
 %
-% Whenever |\minted at checkstyle| is invoked with a named style and style macros need to be created, there is a check to see if the |PYG| prefix macros have been created, and they are generated if they do not yet exist.  This is important when |\MintedPygmentize| is used to call a custom |pygmentize|; we want to wait as late as possible to use |pygmentize|, so we don't want to generate the |\PYG| macros until the last possible moment.  When the |\PYG| macros are actually created, the single quote macro is patched after loading.
+% Certain catcodes are required when loading Pygments style definitions from file.
+% \begin{itemize}
+% \item At sign |@| would be handled by the |\makeatletter| within the Pygments style definition if the style was brought in via |\input|, but |\makeatletter| doesn't affect tokenization with the |catchfile| approach.
+% \item Percent |%| may not have its normal meaning within a |.dtx| file.
+% \item Backtick |`| is made active by some \pkg{babel} package options, such as |magyar|.
+% \end{itemize}
+% |\endlinechar| also requires special handling to avoid introducing unwanted spaces.
 %
-% It isn't necessary to set the initial style to |default|, because the current style is always obtained via |\minted at get@opt{style}{default}|, so |default| is always the fallback value and need not be set explicitly.  |\minted at checkstyle| is used in each command/environment, so that using |pygmentize| can be delayed as long as possible.
+% The |\ifx\PYG\relax| tests detect outdated style definitions from \pkg{minted} <2.6 and replace them when possible, and also detect missing styles.  Before \pkg{minted} 2.6, style macros used a |\PYG<style>| prefix and were defined globally.  Starting with 2.6, styles are redefined upon every use (within groups), and all styles use macros with a |\PYG| prefix.  This allows more robust treatment of style names that involve punctuation characters and numbers.
 %    \begin{macrocode}
-\newcommand{\minted at checkstyle}[1]{%
-  \ifcsname minted at styleloaded@\ifstrempty{#1}{default-pyg-prefix}{#1}\endcsname\else
-    \ifstrempty{#1}{}{\ifcsname PYG\endcsname\else\minted at checkstyle{}\fi}%
-    \expandafter\gdef%
-      \csname minted at styleloaded@\ifstrempty{#1}{default-pyg-prefix}{#1}\endcsname{}%
-    \ifthenelse{\boolean{minted at cache}}%
-     {\IfFileExists
-       {\minted at outputdir\minted at cachedir/\ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}%
-       {}%
-       {%
-        \ifthenelse{\boolean{minted at frozencache}}%
-         {\PackageError{minted}%
-           {Missing style definition for #1 with frozencache}%
-           {Missing style definition for #1 with frozencache}}%
-         {\ifwindows
-            \ShellEscape{%
-              \MintedPygmentize\space -S \ifstrempty{#1}{default}{#1} -f latex 
-              -P commandprefix=PYG#1
-              > \minted at outputdir@windows\minted at cachedir@windows\@backslashchar%
-                   \ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}%
-          \else
-            \ShellEscape{%
-              \MintedPygmentize\space -S \ifstrempty{#1}{default}{#1} -f latex 
-              -P commandprefix=PYG#1
-              > \minted at outputdir\minted at cachedir/%
-                   \ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}%
-          \fi}%
-        }%
-        \begingroup
-        \let\def\gdef
-        \catcode\string``=12
-        \catcode`\_=11
-        \catcode`\-=11
-        \catcode`\%=14
-        \endlinechar=-1\relax
-        \minted at input{%
-          \minted at outputdir\minted at cachedir/\ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}%
-        \endgroup
-        \minted at addcachefile{\ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}}%
-     {%
-        \ifwindows
-          \ShellEscape{%
-            \MintedPygmentize\space -S \ifstrempty{#1}{default}{#1} -f latex
-            -P commandprefix=PYG#1 > \minted at outputdir@windows\minted at jobname.out.pyg}%
-        \else
-          \ShellEscape{%
-            \MintedPygmentize\space -S \ifstrempty{#1}{default}{#1} -f latex
-            -P commandprefix=PYG#1 > \minted at outputdir\minted at jobname.out.pyg}%
-        \fi
-        \begingroup
-        \let\def\gdef
-        \catcode\string``=12
-        \catcode`\_=11
-        \catcode`\-=11
-        \catcode`\%=14
-        \endlinechar=-1\relax
-        \minted at input{\minted at outputdir\minted at jobname.out.pyg}%
-        \endgroup}%
-    \ifstrempty{#1}{\minted at patch@PYGZsq}{}%
+\newcommand{\minted at generate@PYGdef}[1]{%
+  \ifthenelse{\boolean{minted at cache}}%
+   {\def\minted at pygstylepath@load{\minted at outputdir\minted at cachedir/#1.pygstyle}%
+    \minted at addcachefile{#1.pygstyle}}%
+   {\def\minted at pygstylepath@load{\minted at outputdir\minted at jobname.out.pyg}}%
+  \ifwindows
+    \StrSubstitute{\minted at pygstylepath@load}%
+      {/}{\@backslashchar}[\minted at pygstylepath@save]%
+  \else
+    \let\minted at pygstylepath@save\minted at pygstylepath@load
   \fi
+  \IfFileExists{\minted at pygstylepath@load}%
+   {}%
+   {\ifthenelse{\boolean{minted at frozencache}}%
+     {\PackageError{minted}%
+       {Missing style definition for #1 with frozencache}%
+       {Missing style definition for #1 with frozencache}}%
+     {}%
+    \ShellEscape{%
+      \MintedPygmentize\space -S #1 -f latex -P commandprefix=PYG 
+      > \minted at pygstylepath@save
+    }%
+   }%
+  \CatchFileDef{\minted at tmp@filecontents}%
+   {\minted at pygstylepath@load}{\catcode`@=11\catcode`\%=14\catcode``=12\endlinechar=-1}%
+  \begingroup
+  \let\PYG\relax
+  \minted at tmp@filecontents
+  \ifx\PYG\relax
+    \ifthenelse{\boolean{minted at frozencache}}%
+     {\PackageError{minted}%
+       {Outdated style definition for #1 with frozencache}%
+       {Outdated style definition for #1 with frozencache}}%
+     {}%
+    \ShellEscape{%
+      \MintedPygmentize\space -S #1 -f latex -P commandprefix=PYG 
+      > \minted at pygstylepath@save
+    }%
+    \CatchFileDef{\minted at tmp@filecontents}%
+     {\minted at pygstylepath@load}{\catcode`@=11\catcode`\%=14\catcode``=12\endlinechar=-1}%
+    \minted at tmp@filecontents
+    \ifx\PYG\relax
+      \PackageError{minted}%
+       {Cannot find Pygments style #1}%
+       {Cannot find Pygments style #1}%
+    \fi
+  \fi
+  \expandafter\global\expandafter\let\csname minted at PYGdef@#1\endcsname%
+    \minted at tmp@filecontents    
+  \endgroup  
 }
-\ifthenelse{\boolean{minted at draft}}{\renewcommand{\minted at checkstyle}[1]{}}{}
 %    \end{macrocode}
 % \end{macro}
 %
 %
+% \begin{macro}{\minted at defstyle}
+% Define Pygments style macros.  These are defined locally rather than globally, and redefined upon every use.  Patch single quote macro if needed.
+%    \begin{macrocode}
+\newcommand{\minted at defstyle}[1]{%
+  \edef\minted at style{#1}%
+  \ifcsname minted at PYGdef@\minted at style\endcsname\else
+    \expandafter\minted at generate@PYGdef\expandafter{\minted at style}%
+  \fi
+  \csname minted at PYGdef@\minted at style\endcsname
+  \minted at patch@PYGZsq
+}
+\ifthenelse{\boolean{minted at draft}}{\renewcommand{\minted at defstyle}[1]{}}{}
+%    \end{macrocode}
+% \end{macro}
+%
+%
 % \begin{macro}{\minted at patch@PYGZsq}
 % The single quote macro from \pkg{Pygments} 1.6+ needs to be patched if the \pkg{upquote} package is in use.  Patching is done when the default style is created.  Patching is only attempted if the macro exists, so that there is a graceful fallback in the event of a custom \pkg{Pygments} stylesheet.
 %    \begin{macrocode}
@@ -2597,7 +2667,7 @@
 \minted at def@optcl at switch{texcomments}{-P texcomments}
 \minted at def@optcl at switch{mathescape}{-P mathescape}
 \minted at def@optfv at switch{linenos}
-\minted at def@opt{style}
+\minted at def@opt at detok{style}
 %    \end{macrocode}
 %
 % \pkg{fancyvrb} and \pkg{fvextra} options.
@@ -2674,6 +2744,7 @@
 \minted at def@optfv at switch{breakanywhere}
 \minted at def@optfv{breakanywheresymbolpre}
 \minted at def@optfv{breakanywheresymbolpost}
+\minted at def@optfv{fontencoding}
 %    \end{macrocode}
 %
 % Finally, options specific to \pkg{minted}.
@@ -2700,6 +2771,22 @@
 %
 % \subsection{Internal helpers}
 %
+% \begin{environment}{minted at snugshade*}
+% Define a custom version of \pkg{framed}'s |snugshade*| that takes a color as argument.  This avoids the need to redefine |shadecolor|.
+%    \begin{macrocode}
+\newenvironment{minted at snugshade*}[1]{%
+  \def\FrameCommand##1{\hskip\@totalleftmargin 
+    \colorbox{#1}{##1}%
+    \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
+  \MakeFramed{\advance\hsize-\width 
+    \@totalleftmargin\z@ \linewidth\hsize
+    \advance\labelsep\fboxsep
+    \@setminipage}%
+ }{\par\unskip\@minipagefalse\endMakeFramed}
+%    \end{macrocode}
+% \end{environment}
+%
+%
 % \begin{environment}{\minted at bgbox}
 %
 % Define an environment that may be wrapped around a |minted| environment to assign a background color.  This is retained as a holdover from version 1.0.  In most cases, it is probably better to use a dedicated framing package, such as \pkg{tcolorbox} or \pkg{mdframed}.
@@ -2715,13 +2802,12 @@
 %    \begin{macrocode}
 \newenvironment{minted at colorbg}[1]{%
   \setlength{\OuterFrameSep}{0pt}%
-  \colorlet{shadecolor}{#1}%
   \let\minted at tmp\FV at NumberSep
   \edef\FV at NumberSep{%
     \the\numexpr\dimexpr\minted at tmp+\number\fboxsep\relax sp\relax}%
   \medskip
-  \begin{snugshade*}}
- {\end{snugshade*}%
+  \begin{minted at snugshade*}{#1}}
+ {\end{minted at snugshade*}%
   \medskip\noindent}
 %    \end{macrocode}
 % \end{environment}
@@ -2804,6 +2890,73 @@
 % \end{macro}
 %
 %
+% \begin{macro}{\MintedPython}
+% Python executable to be used for |autogobble|.
+%    \begin{macrocode}
+\ifwindows
+  \newcommand{\MintedPython}{python}
+\else
+  \newcommand{\MintedPython}{python3}
+\fi
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\minted at check@MintedPython}
+% Check that |\MintedPython| is a valid executable before use.  Swap |python| for |python3| and vice versa depending on what is available.
+%    \begin{macrocode}
+\newcommand{\minted at check@MintedPython}{%
+  \ifcsname minted at MintedPython@\MintedPython\endcsname
+  \else
+    \let\minted at altpython\minted at undefined
+    \ifdefstring{\MintedPython}{python}{\def\minted at altpython{python3}}{}%
+    \ifdefstring{\MintedPython}{python3}{\def\minted at altpython{python}}{}%
+    \ifx\minted at altpython\minted at undefined\relax
+      \TestAppExists{\MintedPython}%
+      \ifAppExists
+        \expandafter\global\expandafter\let%
+          \csname minted at MintedPython@\MintedPython\endcsname\relax
+      \else
+        \PackageError{minted}%
+         {Failed to find Python executable \MintedPython;
+          check Python installation (including PATH),
+          or redefine \string\MintedPython}%
+         {Failed to find Python executable \MintedPython;
+          check Python installation (including PATH),
+          or redefine \string\MintedPython}%
+      \fi
+    \else
+      \ifcsname minted at MintedPython@\minted at altpython\endcsname
+        \let\MintedPython\minted at altpython
+      \else
+        \TestAppExists{\MintedPython}%
+        \ifAppExists
+          \expandafter\global\expandafter\let%
+            \csname minted at MintedPython@\MintedPython\endcsname\relax
+        \else      
+          \TestAppExists{\minted at altpython}%
+          \ifAppExists
+            \expandafter\global\expandafter\let%
+              \csname minted at MintedPython@\minted at altpython\endcsname\relax
+            \let\MintedPython\minted at altpython
+          \else
+            \PackageError{minted}%
+             {Failed to find Python executables python or python3;
+              check Python installation (including PATH),
+              or redefine \string\MintedPython}%
+             {Failed to find Python executables python or python3;
+              check Python installation (including PATH),
+              or redefine \string\MintedPython}%
+          \fi
+        \fi
+      \fi
+    \fi
+  \fi
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
 % \begin{macro}{\minted at pygmentize}
 %
 % Pygmentize a file (default: |\minted at outputdir\minted at jobname.pyg|) using the options provided.
@@ -2820,7 +2973,7 @@
 %
 %    \begin{macrocode}
 \newcommand{\minted at pygmentize}[2][\minted at outputdir\minted at jobname.pyg]{%
-  \minted at checkstyle{\minted at get@opt{style}{default}}%
+  \minted at defstyle{\minted at get@opt{style}{default}}%
   \stepcounter{minted at pygmentizecounter}%
   \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}%
     {\def\minted at codefile{\minted at outputdir\minted at jobname.pyg}}%
@@ -2858,50 +3011,15 @@
     {%
       \ifminted at frozencache
       \else
-        \ifx\XeTeXinterchartoks\minted at undefined
-          \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}%
-            {\edef\minted at hash{\pdf at filemdfivesum{#1}%
-              \pdf at mdfivesum{\minted at cmd autogobble(\ifx\FancyVerbStartNum\z@ 0\else\FancyVerbStartNum\fi-\ifx\FancyVerbStopNum\z@ 0\else\FancyVerbStopNum\fi)}}}%
-            {\edef\minted at hash{\pdf at filemdfivesum{#1}%
-              \pdf at mdfivesum{\minted at cmd}}}%
-        \else
-          \ifx\mdfivesum\minted at undefined
-            \immediate\openout\minted at code\minted at jobname.mintedcmd\relax
-            \immediate\write\minted at code{\minted at cmd}%
-            \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}%
-              {\immediate\write\minted at code{autogobble(\ifx\FancyVerbStartNum\z@ 0\else\FancyVerbStartNum\fi-\ifx\FancyVerbStopNum\z@ 0\else\FancyVerbStopNum\fi)}}{}%
-            \immediate\closeout\minted at code 
-            \edef\minted at argone@esc{#1}%
-            \StrSubstitute{\minted at argone@esc}{\@backslashchar}{\@backslashchar\@backslashchar}[\minted at argone@esc]%
-            \StrSubstitute{\minted at argone@esc}{"}{\@backslashchar"}[\minted at argone@esc]%
-            \edef\minted at tmpfname@esc{\minted at outputdir\minted at jobname}%
-            \StrSubstitute{\minted at tmpfname@esc}{\@backslashchar}{\@backslashchar\@backslashchar}[\minted at tmpfname@esc]%
-            \StrSubstitute{\minted at tmpfname@esc}{"}{\@backslashchar"}[\minted at tmpfname@esc]%
-            %Cheating a little here by using ASCII codes to write `{` and `}`
-            %in the Python code
-            \def\minted at hashcmd{%
-              \detokenize{python -c "import hashlib; import os;
-                hasher = hashlib.sha1();
-                f = open(os.path.expanduser(os.path.expandvars(\"}\minted at tmpfname@esc.mintedcmd\detokenize{\")), \"rb\");
-                hasher.update(f.read());
-                f.close();
-                f = open(os.path.expanduser(os.path.expandvars(\"}\minted at argone@esc\detokenize{\")), \"rb\");
-                hasher.update(f.read());
-                f.close();
-                f = open(os.path.expanduser(os.path.expandvars(\"}\minted at tmpfname@esc.mintedmd5\detokenize{\")), \"w\");
-                macro = \"\\edef\\minted at hash\" + chr(123) + hasher.hexdigest() + chr(125) + \"\";
-                f.write(\"\\makeatletter\" + macro + \"\\makeatother\\endinput\n\");
-                f.close();"}}%
-            \ShellEscape{\minted at hashcmd}%
-            \minted at input{\minted at outputdir\minted at jobname.mintedmd5}%
-          \else
-            \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}%
-             {\edef\minted at hash{\mdfivesum file {#1}%
-                \mdfivesum{\minted at cmd autogobble(\ifx\FancyVerbStartNum\z@ 0\else\FancyVerbStartNum\fi-\ifx\FancyVerbStopNum\z@ 0\else\FancyVerbStopNum\fi)}}}%
-             {\edef\minted at hash{\mdfivesum file {#1}%
-                \mdfivesum{\minted at cmd}}}%
-          \fi
-        \fi
+        \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}%
+         {\edef\minted at hash{%
+            \pdf at filemdfivesum{#1}%
+            \pdf at mdfivesum{\minted at cmd\space%
+              autogobble(\the\numexpr\FancyVerbStartNum\relax-%
+                         \the\numexpr\FancyVerbStopNum\relax)}}}%
+         {\edef\minted at hash{%
+            \pdf at filemdfivesum{#1}%
+            \pdf at mdfivesum{\minted at cmd}}}%
         \edef\minted at infile{\minted at cachedir/\minted at hash.pygtex}%
         \IfFileExists{\minted at infile}{}{%
           \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}{%
@@ -2951,20 +3069,21 @@
   \StrSubstitute{\minted at tmpfname@esc}{\@backslashchar}{\@backslashchar\@backslashchar}[\minted at tmpfname@esc]%
   \StrSubstitute{\minted at tmpfname@esc}{"}{\@backslashchar"}[\minted at tmpfname@esc]%
   %Need a version of open() that supports encoding under Python 2
+  \minted at check@MintedPython
   \edef\minted at autogobblecmd{%
     \ifminted at kpsewhich
       \ifwindows
         \detokenize{for /f "usebackq tokens=*" }\@percentchar\detokenize{a in (`kpsewhich} #1\detokenize{`) do}\space
       \fi
-    \fi
-    \detokenize{python -c "import sys; import os;
+    \fi    
+    \MintedPython\detokenize{ -c "import sys; import os;
     import textwrap;
     from io import open;
     fname = }%
       \ifminted at kpsewhich
-        \detokenize{sys.argv[1];}\space%
+        \detokenize{sys.argv[1];}\space
       \else
-        \detokenize{os.path.expanduser(os.path.expandvars(\"}\minted at argone@esc\detokenize{\"));}\space%
+        \detokenize{os.path.expanduser(os.path.expandvars(\"}\minted at argone@esc\detokenize{\"));}\space
       \fi
     \detokenize{f = open(fname, \"r\", encoding=\"}\minted at encoding\detokenize{\") if os.path.isfile(fname) else None;
     t = f.readlines() if f is not None else None;
@@ -2972,10 +3091,10 @@
     f.close() if f is not None else None;
     tmpfname = os.path.expanduser(os.path.expandvars(\"}\minted at tmpfname@esc.pyg\detokenize{\"));
     f = open(tmpfname, \"w\", encoding=\"}\minted at encoding\detokenize{\") if t is not None else None;
-    fvstartnum = }\ifx\FancyVerbStartNum\z@ 0\else\FancyVerbStartNum\fi\detokenize{;
-    fvstopnum = }\ifx\FancyVerbStopNum\z@ 0\else\FancyVerbStopNum\fi\detokenize{;
-    s = fvstartnum-1 if fvstartnum != 0 else 0;
-    e = fvstopnum if fvstopnum != 0 else len(t_opt);
+    fvstartnum = }\the\numexpr\FancyVerbStartNum\detokenize{;
+    fvstopnum = }\the\numexpr\FancyVerbStopNum\detokenize{;
+    s = max(0, fvstartnum-1);
+    e = min(s, fvstopnum if fvstopnum > 0 else len(t_opt));
     [f.write(textwrap.dedent(\"\".join(x))) for x in (t_opt[0:s], t_opt[s:e], t_opt[e:]) if x and t is not None];
     f.close() if t is not None else os.remove(tmpfname);"}%
     \ifminted at kpsewhich
@@ -3000,9 +3119,7 @@
 % The |bgcolor| option needs to be dealt with in different ways depending on whether we are using |\mintinline|.  It is simplest to apply this option here, so that the macro redefinitions may be local and thus do not need to be manually reset later.
 %    \begin{macrocode}
 \newcommand{\minted at inputpyg}{%
-  \expandafter\let\expandafter\minted at PYGstyle%
-    \csname PYG\minted at get@opt{style}{default}\endcsname
-  \VerbatimPygments{\PYG}{\minted at PYGstyle}%
+  \VerbatimPygments{\PYG}{\PYG}%
   \ifthenelse{\boolean{minted at isinline}}%
    {\ifthenelse{\equal{\minted at get@opt{breaklines}{false}}{true}}%
     {\let\FV at BeginVBox\relax
@@ -3089,10 +3206,11 @@
 %
 % Now that the settings macros exist, we go ahead and create any needed defaults.
 %
-% PHP should use |startinline| for |\mintinline|.  Visible tabs should have a specified color so that they don't change colors when used to indent multiline strings or comments.
+% PHP should use |startinline| for |\mintinline|.  Visible tabs should have a specified color so that they don't change colors when used to indent multiline strings or comments.  Leading/trailing empty lines should be preserved by default.
 %    \begin{macrocode}
 \setmintedinline[php]{startinline=true}
 \setminted{tabcolor=black}
+\setminted{stripnl=false}
 %    \end{macrocode}
 %
 % \begin{macro}{\usemintedstyle}

Modified: trunk/Master/texmf-dist/source/latex/minted/minted.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/minted/minted.ins	2021-12-25 21:41:30 UTC (rev 61404)
+++ trunk/Master/texmf-dist/source/latex/minted/minted.ins	2021-12-25 21:41:49 UTC (rev 61405)
@@ -3,7 +3,7 @@
 \askforoverwritefalse
 
 \preamble
-Copyright 2013--2017 Geoffrey M. Poore
+Copyright 2013--2021 Geoffrey M. Poore
 Copyright 2010--2011 Konrad Rudolph
 
 This work may be distributed and/or modified under the

Modified: trunk/Master/texmf-dist/tex/latex/minted/minted.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/minted/minted.sty	2021-12-25 21:41:30 UTC (rev 61404)
+++ trunk/Master/texmf-dist/tex/latex/minted/minted.sty	2021-12-25 21:41:49 UTC (rev 61405)
@@ -5,7 +5,7 @@
 %% The original source files were:
 %%
 %% minted.dtx  (with options: `package')
-%% Copyright 2013--2017 Geoffrey M. Poore
+%% Copyright 2013--2021 Geoffrey M. Poore
 %% Copyright 2010--2011 Konrad Rudolph
 %% 
 %% This work may be distributed and/or modified under the
@@ -27,7 +27,7 @@
 %% and the derived file minted.sty.
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{minted}
-    [2017/07/19 v2.5 Yet another Pygments shim for LaTeX]
+    [2021/12/24 v2.6 Yet another Pygments shim for LaTeX]
 \RequirePackage{keyval}
 \RequirePackage{kvoptions}
 \RequirePackage{fvextra}
@@ -45,6 +45,7 @@
 \RequirePackage{xstring}
 \RequirePackage{lineno}
 \RequirePackage{framed}
+\RequirePackage{catchfile}
 \AtEndPreamble{%
   \@ifpackageloaded{color}{}{%
     \@ifpackageloaded{xcolor}{}{\RequirePackage{xcolor}}}%
@@ -175,29 +176,29 @@
 \fi
 \newboolean{AppExists}
 \newread\minted at appexistsfile
-\newcommand{\TestAppExists}[1]{
+\newcommand{\TestAppExists}[1]{%
   \ifwindows
-    \DeleteFile{\minted at jobname.aex}
+    \DeleteFile{\minted at jobname.aex}%
     \ShellEscape{for \string^\@percentchar i in (#1.exe #1.bat #1.cmd)
       do set > \minted at jobname.aex <nul: /p
-      x=\string^\@percentchar \string~$PATH:i>> \minted at jobname.aex}
+      x=\string^\@percentchar \string~$PATH:i>> \minted at jobname.aex}%
     %$ <- balance syntax highlighting
     \immediate\openin\minted at appexistsfile\minted at jobname.aex
-    \expandafter\def\expandafter\@tmp at cr\expandafter{\the\endlinechar}
+    \expandafter\def\expandafter\@tmp at cr\expandafter{\the\endlinechar}%
     \endlinechar=-1\relax
     \readline\minted at appexistsfile to \minted at apppathifexists
     \endlinechar=\@tmp at cr
-    \ifthenelse{\equal{\minted at apppathifexists}{}}
-     {\AppExistsfalse}
-     {\AppExiststrue}
+    \ifthenelse{\equal{\minted at apppathifexists}{}}%
+     {\AppExistsfalse}%
+     {\AppExiststrue}%
     \immediate\closein\minted at appexistsfile
-    \DeleteFile{\minted at jobname.aex}
+    \DeleteFile{\minted at jobname.aex}%
   \else
-    \ShellEscape{which #1 && touch \minted at jobname.aex}
-    \IfFileExists{\minted at jobname.aex}
+    \ShellEscape{which #1 && touch \minted at jobname.aex}%
+    \IfFileExists{\minted at jobname.aex}%
       {\AppExiststrue
-        \DeleteFile{\minted at jobname.aex}}
-      {\AppExistsfalse}
+        \DeleteFile{\minted at jobname.aex}}%
+      {\AppExistsfalse}%
   \fi
 }
 \newcommand{\minted at optlistcl@g}{}
@@ -480,68 +481,79 @@
     \@namedef{minted at opt@cmd:#2}{##1}}
   \ifstrempty{#1}{}{\@namedef{minted at opt@g:#2}{#1}}%
 }
-\newcommand{\minted at checkstyle}[1]{%
-  \ifcsname minted at styleloaded@\ifstrempty{#1}{default-pyg-prefix}{#1}\endcsname\else
-    \ifstrempty{#1}{}{\ifcsname PYG\endcsname\else\minted at checkstyle{}\fi}%
-    \expandafter\gdef%
-      \csname minted at styleloaded@\ifstrempty{#1}{default-pyg-prefix}{#1}\endcsname{}%
-    \ifthenelse{\boolean{minted at cache}}%
-     {\IfFileExists
-       {\minted at outputdir\minted at cachedir/\ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}%
-       {}%
-       {%
-        \ifthenelse{\boolean{minted at frozencache}}%
-         {\PackageError{minted}%
-           {Missing style definition for #1 with frozencache}%
-           {Missing style definition for #1 with frozencache}}%
-         {\ifwindows
-            \ShellEscape{%
-              \MintedPygmentize\space -S \ifstrempty{#1}{default}{#1} -f latex
-              -P commandprefix=PYG#1
-              > \minted at outputdir@windows\minted at cachedir@windows\@backslashchar%
-                   \ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}%
-          \else
-            \ShellEscape{%
-              \MintedPygmentize\space -S \ifstrempty{#1}{default}{#1} -f latex
-              -P commandprefix=PYG#1
-              > \minted at outputdir\minted at cachedir/%
-                   \ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}%
-          \fi}%
-        }%
-        \begingroup
-        \let\def\gdef
-        \catcode\string``=12
-        \catcode`\_=11
-        \catcode`\-=11
-        \catcode`\%=14
-        \endlinechar=-1\relax
-        \minted at input{%
-          \minted at outputdir\minted at cachedir/\ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}%
-        \endgroup
-        \minted at addcachefile{\ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}}%
-     {%
-        \ifwindows
-          \ShellEscape{%
-            \MintedPygmentize\space -S \ifstrempty{#1}{default}{#1} -f latex
-            -P commandprefix=PYG#1 > \minted at outputdir@windows\minted at jobname.out.pyg}%
-        \else
-          \ShellEscape{%
-            \MintedPygmentize\space -S \ifstrempty{#1}{default}{#1} -f latex
-            -P commandprefix=PYG#1 > \minted at outputdir\minted at jobname.out.pyg}%
-        \fi
-        \begingroup
-        \let\def\gdef
-        \catcode\string``=12
-        \catcode`\_=11
-        \catcode`\-=11
-        \catcode`\%=14
-        \endlinechar=-1\relax
-        \minted at input{\minted at outputdir\minted at jobname.out.pyg}%
-        \endgroup}%
-    \ifstrempty{#1}{\minted at patch@PYGZsq}{}%
+\newcommand{\minted at def@opt at detok}[2][]{%
+  \define at key{minted at opt@g}{#2}{%
+    \@namedef{minted at opt@g:#2}{\detokenize{##1}}}
+  \define at key{minted at opt@g at i}{#2}{%
+    \@namedef{minted at opt@g at i:#2}{\detokenize{##1}}}
+  \define at key{minted at opt@lang}{#2}{%
+    \@namedef{minted at opt@lang\minted at lang:#2}{\detokenize{##1}}}
+  \define at key{minted at opt@lang at i}{#2}{%
+    \@namedef{minted at opt@lang\minted at lang @i:#2}{\detokenize{##1}}}
+  \define at key{minted at opt@cmd}{#2}{%
+    \@namedef{minted at opt@cmd:#2}{\detokenize{##1}}}
+  \ifstrempty{#1}{}{\@namedef{minted at opt@g:#2}{\detokenize{#1}}}%
+}
+\newcommand{\minted at generate@PYGdef}[1]{%
+  \ifthenelse{\boolean{minted at cache}}%
+   {\def\minted at pygstylepath@load{\minted at outputdir\minted at cachedir/#1.pygstyle}%
+    \minted at addcachefile{#1.pygstyle}}%
+   {\def\minted at pygstylepath@load{\minted at outputdir\minted at jobname.out.pyg}}%
+  \ifwindows
+    \StrSubstitute{\minted at pygstylepath@load}%
+      {/}{\@backslashchar}[\minted at pygstylepath@save]%
+  \else
+    \let\minted at pygstylepath@save\minted at pygstylepath@load
   \fi
+  \IfFileExists{\minted at pygstylepath@load}%
+   {}%
+   {\ifthenelse{\boolean{minted at frozencache}}%
+     {\PackageError{minted}%
+       {Missing style definition for #1 with frozencache}%
+       {Missing style definition for #1 with frozencache}}%
+     {}%
+    \ShellEscape{%
+      \MintedPygmentize\space -S #1 -f latex -P commandprefix=PYG
+      > \minted at pygstylepath@save
+    }%
+   }%
+  \CatchFileDef{\minted at tmp@filecontents}%
+   {\minted at pygstylepath@load}{\catcode`@=11\catcode`\%=14\catcode``=12\endlinechar=-1}%
+  \begingroup
+  \let\PYG\relax
+  \minted at tmp@filecontents
+  \ifx\PYG\relax
+    \ifthenelse{\boolean{minted at frozencache}}%
+     {\PackageError{minted}%
+       {Outdated style definition for #1 with frozencache}%
+       {Outdated style definition for #1 with frozencache}}%
+     {}%
+    \ShellEscape{%
+      \MintedPygmentize\space -S #1 -f latex -P commandprefix=PYG
+      > \minted at pygstylepath@save
+    }%
+    \CatchFileDef{\minted at tmp@filecontents}%
+     {\minted at pygstylepath@load}{\catcode`@=11\catcode`\%=14\catcode``=12\endlinechar=-1}%
+    \minted at tmp@filecontents
+    \ifx\PYG\relax
+      \PackageError{minted}%
+       {Cannot find Pygments style #1}%
+       {Cannot find Pygments style #1}%
+    \fi
+  \fi
+  \expandafter\global\expandafter\let\csname minted at PYGdef@#1\endcsname%
+    \minted at tmp@filecontents
+  \endgroup
 }
-\ifthenelse{\boolean{minted at draft}}{\renewcommand{\minted at checkstyle}[1]{}}{}
+\newcommand{\minted at defstyle}[1]{%
+  \edef\minted at style{#1}%
+  \ifcsname minted at PYGdef@\minted at style\endcsname\else
+    \expandafter\minted at generate@PYGdef\expandafter{\minted at style}%
+  \fi
+  \csname minted at PYGdef@\minted at style\endcsname
+  \minted at patch@PYGZsq
+}
+\ifthenelse{\boolean{minted at draft}}{\renewcommand{\minted at defstyle}[1]{}}{}
 \newcommand{\minted at patch@PYGZsq}{%
   \ifcsname PYGZsq\endcsname
     \expandafter\ifdefstring\expandafter{\csname PYGZsq\endcsname}{\char`\'}%
@@ -624,7 +636,7 @@
 \minted at def@optcl at switch{texcomments}{-P texcomments}
 \minted at def@optcl at switch{mathescape}{-P mathescape}
 \minted at def@optfv at switch{linenos}
-\minted at def@opt{style}
+\minted at def@opt at detok{style}
 \minted at def@optfv{frame}
 \minted at def@optfv{framesep}
 \minted at def@optfv{framerule}
@@ -697,19 +709,28 @@
 \minted at def@optfv at switch{breakanywhere}
 \minted at def@optfv{breakanywheresymbolpre}
 \minted at def@optfv{breakanywheresymbolpost}
+\minted at def@optfv{fontencoding}
 \minted at def@opt{bgcolor}
 \minted at def@opt at switch{autogobble}
 \newcommand{\minted at encoding}{\minted at get@opt{encoding}{UTF8}}
+\newenvironment{minted at snugshade*}[1]{%
+  \def\FrameCommand##1{\hskip\@totalleftmargin
+    \colorbox{#1}{##1}%
+    \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
+  \MakeFramed{\advance\hsize-\width
+    \@totalleftmargin\z@ \linewidth\hsize
+    \advance\labelsep\fboxsep
+    \@setminipage}%
+ }{\par\unskip\@minipagefalse\endMakeFramed}
 \newsavebox{\minted at bgbox}
 \newenvironment{minted at colorbg}[1]{%
   \setlength{\OuterFrameSep}{0pt}%
-  \colorlet{shadecolor}{#1}%
   \let\minted at tmp\FV at NumberSep
   \edef\FV at NumberSep{%
     \the\numexpr\dimexpr\minted at tmp+\number\fboxsep\relax sp\relax}%
   \medskip
-  \begin{snugshade*}}
- {\end{snugshade*}%
+  \begin{minted at snugshade*}{#1}}
+ {\end{minted at snugshade*}%
   \medskip\noindent}
 \newwrite\minted at code
 \newcommand{\minted at savecode}[1]{
@@ -739,8 +760,61 @@
   \newcommand{\MintedPygmentize}{pygmentize}
 \fi
 \newcounter{minted at pygmentizecounter}
+\ifwindows
+  \newcommand{\MintedPython}{python}
+\else
+  \newcommand{\MintedPython}{python3}
+\fi
+\newcommand{\minted at check@MintedPython}{%
+  \ifcsname minted at MintedPython@\MintedPython\endcsname
+  \else
+    \let\minted at altpython\minted at undefined
+    \ifdefstring{\MintedPython}{python}{\def\minted at altpython{python3}}{}%
+    \ifdefstring{\MintedPython}{python3}{\def\minted at altpython{python}}{}%
+    \ifx\minted at altpython\minted at undefined\relax
+      \TestAppExists{\MintedPython}%
+      \ifAppExists
+        \expandafter\global\expandafter\let%
+          \csname minted at MintedPython@\MintedPython\endcsname\relax
+      \else
+        \PackageError{minted}%
+         {Failed to find Python executable \MintedPython;
+          check Python installation (including PATH),
+          or redefine \string\MintedPython}%
+         {Failed to find Python executable \MintedPython;
+          check Python installation (including PATH),
+          or redefine \string\MintedPython}%
+      \fi
+    \else
+      \ifcsname minted at MintedPython@\minted at altpython\endcsname
+        \let\MintedPython\minted at altpython
+      \else
+        \TestAppExists{\MintedPython}%
+        \ifAppExists
+          \expandafter\global\expandafter\let%
+            \csname minted at MintedPython@\MintedPython\endcsname\relax
+        \else
+          \TestAppExists{\minted at altpython}%
+          \ifAppExists
+            \expandafter\global\expandafter\let%
+              \csname minted at MintedPython@\minted at altpython\endcsname\relax
+            \let\MintedPython\minted at altpython
+          \else
+            \PackageError{minted}%
+             {Failed to find Python executables python or python3;
+              check Python installation (including PATH),
+              or redefine \string\MintedPython}%
+             {Failed to find Python executables python or python3;
+              check Python installation (including PATH),
+              or redefine \string\MintedPython}%
+          \fi
+        \fi
+      \fi
+    \fi
+  \fi
+}
 \newcommand{\minted at pygmentize}[2][\minted at outputdir\minted at jobname.pyg]{%
-  \minted at checkstyle{\minted at get@opt{style}{default}}%
+  \minted at defstyle{\minted at get@opt{style}{default}}%
   \stepcounter{minted at pygmentizecounter}%
   \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}%
     {\def\minted at codefile{\minted at outputdir\minted at jobname.pyg}}%
@@ -778,50 +852,15 @@
     {%
       \ifminted at frozencache
       \else
-        \ifx\XeTeXinterchartoks\minted at undefined
-          \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}%
-            {\edef\minted at hash{\pdf at filemdfivesum{#1}%
-              \pdf at mdfivesum{\minted at cmd autogobble(\ifx\FancyVerbStartNum\z@ 0\else\FancyVerbStartNum\fi-\ifx\FancyVerbStopNum\z@ 0\else\FancyVerbStopNum\fi)}}}%
-            {\edef\minted at hash{\pdf at filemdfivesum{#1}%
-              \pdf at mdfivesum{\minted at cmd}}}%
-        \else
-          \ifx\mdfivesum\minted at undefined
-            \immediate\openout\minted at code\minted at jobname.mintedcmd\relax
-            \immediate\write\minted at code{\minted at cmd}%
-            \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}%
-              {\immediate\write\minted at code{autogobble(\ifx\FancyVerbStartNum\z@ 0\else\FancyVerbStartNum\fi-\ifx\FancyVerbStopNum\z@ 0\else\FancyVerbStopNum\fi)}}{}%
-            \immediate\closeout\minted at code
-            \edef\minted at argone@esc{#1}%
-            \StrSubstitute{\minted at argone@esc}{\@backslashchar}{\@backslashchar\@backslashchar}[\minted at argone@esc]%
-            \StrSubstitute{\minted at argone@esc}{"}{\@backslashchar"}[\minted at argone@esc]%
-            \edef\minted at tmpfname@esc{\minted at outputdir\minted at jobname}%
-            \StrSubstitute{\minted at tmpfname@esc}{\@backslashchar}{\@backslashchar\@backslashchar}[\minted at tmpfname@esc]%
-            \StrSubstitute{\minted at tmpfname@esc}{"}{\@backslashchar"}[\minted at tmpfname@esc]%
-            %Cheating a little here by using ASCII codes to write `{` and `}`
-            %in the Python code
-            \def\minted at hashcmd{%
-              \detokenize{python -c "import hashlib; import os;
-                hasher = hashlib.sha1();
-                f = open(os.path.expanduser(os.path.expandvars(\"}\minted at tmpfname@esc.mintedcmd\detokenize{\")), \"rb\");
-                hasher.update(f.read());
-                f.close();
-                f = open(os.path.expanduser(os.path.expandvars(\"}\minted at argone@esc\detokenize{\")), \"rb\");
-                hasher.update(f.read());
-                f.close();
-                f = open(os.path.expanduser(os.path.expandvars(\"}\minted at tmpfname@esc.mintedmd5\detokenize{\")), \"w\");
-                macro = \"\\edef\\minted at hash\" + chr(123) + hasher.hexdigest() + chr(125) + \"\";
-                f.write(\"\\makeatletter\" + macro + \"\\makeatother\\endinput\n\");
-                f.close();"}}%
-            \ShellEscape{\minted at hashcmd}%
-            \minted at input{\minted at outputdir\minted at jobname.mintedmd5}%
-          \else
-            \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}%
-             {\edef\minted at hash{\mdfivesum file {#1}%
-                \mdfivesum{\minted at cmd autogobble(\ifx\FancyVerbStartNum\z@ 0\else\FancyVerbStartNum\fi-\ifx\FancyVerbStopNum\z@ 0\else\FancyVerbStopNum\fi)}}}%
-             {\edef\minted at hash{\mdfivesum file {#1}%
-                \mdfivesum{\minted at cmd}}}%
-          \fi
-        \fi
+        \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}%
+         {\edef\minted at hash{%
+            \pdf at filemdfivesum{#1}%
+            \pdf at mdfivesum{\minted at cmd\space%
+              autogobble(\the\numexpr\FancyVerbStartNum\relax-%
+                         \the\numexpr\FancyVerbStopNum\relax)}}}%
+         {\edef\minted at hash{%
+            \pdf at filemdfivesum{#1}%
+            \pdf at mdfivesum{\minted at cmd}}}%
         \edef\minted at infile{\minted at cachedir/\minted at hash.pygtex}%
         \IfFileExists{\minted at infile}{}{%
           \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}{%
@@ -864,6 +903,7 @@
   \StrSubstitute{\minted at tmpfname@esc}{\@backslashchar}{\@backslashchar\@backslashchar}[\minted at tmpfname@esc]%
   \StrSubstitute{\minted at tmpfname@esc}{"}{\@backslashchar"}[\minted at tmpfname@esc]%
   %Need a version of open() that supports encoding under Python 2
+  \minted at check@MintedPython
   \edef\minted at autogobblecmd{%
     \ifminted at kpsewhich
       \ifwindows
@@ -870,14 +910,14 @@
         \detokenize{for /f "usebackq tokens=*" }\@percentchar\detokenize{a in (`kpsewhich} #1\detokenize{`) do}\space
       \fi
     \fi
-    \detokenize{python -c "import sys; import os;
+    \MintedPython\detokenize{ -c "import sys; import os;
     import textwrap;
     from io import open;
     fname = }%
       \ifminted at kpsewhich
-        \detokenize{sys.argv[1];}\space%
+        \detokenize{sys.argv[1];}\space
       \else
-        \detokenize{os.path.expanduser(os.path.expandvars(\"}\minted at argone@esc\detokenize{\"));}\space%
+        \detokenize{os.path.expanduser(os.path.expandvars(\"}\minted at argone@esc\detokenize{\"));}\space
       \fi
     \detokenize{f = open(fname, \"r\", encoding=\"}\minted at encoding\detokenize{\") if os.path.isfile(fname) else None;
     t = f.readlines() if f is not None else None;
@@ -885,10 +925,10 @@
     f.close() if f is not None else None;
     tmpfname = os.path.expanduser(os.path.expandvars(\"}\minted at tmpfname@esc.pyg\detokenize{\"));
     f = open(tmpfname, \"w\", encoding=\"}\minted at encoding\detokenize{\") if t is not None else None;
-    fvstartnum = }\ifx\FancyVerbStartNum\z@ 0\else\FancyVerbStartNum\fi\detokenize{;
-    fvstopnum = }\ifx\FancyVerbStopNum\z@ 0\else\FancyVerbStopNum\fi\detokenize{;
-    s = fvstartnum-1 if fvstartnum != 0 else 0;
-    e = fvstopnum if fvstopnum != 0 else len(t_opt);
+    fvstartnum = }\the\numexpr\FancyVerbStartNum\detokenize{;
+    fvstopnum = }\the\numexpr\FancyVerbStopNum\detokenize{;
+    s = max(0, fvstartnum-1);
+    e = min(s, fvstopnum if fvstopnum > 0 else len(t_opt));
     [f.write(textwrap.dedent(\"\".join(x))) for x in (t_opt[0:s], t_opt[s:e], t_opt[e:]) if x and t is not None];
     f.close() if t is not None else os.remove(tmpfname);"}%
     \ifminted at kpsewhich
@@ -902,9 +942,7 @@
   \ShellEscape{\minted at autogobblecmd}%
 }
 \newcommand{\minted at inputpyg}{%
-  \expandafter\let\expandafter\minted at PYGstyle%
-    \csname PYG\minted at get@opt{style}{default}\endcsname
-  \VerbatimPygments{\PYG}{\minted at PYGstyle}%
+  \VerbatimPygments{\PYG}{\PYG}%
   \ifthenelse{\boolean{minted at isinline}}%
    {\ifthenelse{\equal{\minted at get@opt{breaklines}{false}}{true}}%
     {\let\FV at BeginVBox\relax
@@ -953,6 +991,7 @@
       \setkeys{minted at opt@lang at i}{#2}}}
 \setmintedinline[php]{startinline=true}
 \setminted{tabcolor=black}
+\setminted{stripnl=false}
 \newcommand{\usemintedstyle}[2][]{\setminted[#1]{style=#2}}
 \begingroup
 \catcode`\ =\active

Modified: trunk/Master/texmf-dist/tex/latex/minted/minted1.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/minted/minted1.sty	2021-12-25 21:41:30 UTC (rev 61404)
+++ trunk/Master/texmf-dist/tex/latex/minted/minted1.sty	2021-12-25 21:41:49 UTC (rev 61405)
@@ -5,7 +5,7 @@
 %% The original source files were:
 %%
 %% minted.dtx  (with options: `packageone')
-%% Copyright 2013--2017 Geoffrey M. Poore
+%% Copyright 2013--2021 Geoffrey M. Poore
 %% Copyright 2010--2011 Konrad Rudolph
 %% 
 %% This work may be distributed and/or modified under the



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