texlive[41524] Master/texmf-dist: minted (22jun16)
commits+karl at tug.org
commits+karl at tug.org
Wed Jun 22 23:30:31 CEST 2016
Revision: 41524
http://tug.org/svn/texlive?view=revision&revision=41524
Author: karl
Date: 2016-06-22 23:30:31 +0200 (Wed, 22 Jun 2016)
Log Message:
-----------
minted (22jun16)
Modified Paths:
--------------
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
Modified: trunk/Master/texmf-dist/doc/latex/minted/minted.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/minted/minted.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/minted/minted.dtx 2016-06-22 21:30:19 UTC (rev 41523)
+++ trunk/Master/texmf-dist/source/latex/minted/minted.dtx 2016-06-22 21:30:31 UTC (rev 41524)
@@ -31,7 +31,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{minted}
%<*package>
- [2016/06/15 v2.2.1 Yet another Pygments shim for LaTeX]
+ [2016/06/21 v2.2.2 Yet another Pygments shim for LaTeX]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -170,7 +170,7 @@
%</driver>
% \fi
%
-% \CheckSum{3853}
+% \CheckSum{3841}
%
% \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
@@ -191,6 +191,13 @@
%
%
%
+%
+%
+% \begin{changelog}{v2.2.2}{2016/06/21}
+% \item Fixed a bug introduced in v2.2 that prevented setting the Pygments style in the preamble. Style definitions are now more compatible with using \texttt{\string\MintedPygmentize} to call a custom \texttt{pygmentize}.
+% \end{changelog}
+%
+%
% \begin{changelog}{v2.2.1}{2016/06/15}
% \item The \texttt{shellesc} package is loaded before \texttt{ifplatform} and other packages that might invoke \texttt{\string\write18} (\#112).
% \item When caching is enabled, XeTeX uses the new \texttt{\string\mdfivesum} macro from TeX Live 2016 to hash cache content, rather than using \texttt{\string\ShellEscape} with Python to perform hashing.
@@ -2249,34 +2256,12 @@
\@namedef{minted at opt@lang\minted at lang @i:#2}{##1}}
\define at key{minted at opt@cmd}{#2}{%
\@namedef{minted at opt@cmd:#2}{##1}}
+ \ifstrempty{#1}{}{\@namedef{minted at opt@g:#2}{#1}}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\minted at def@opt at style}
-% Define an option for styles. These are defined independently because styles need slightly different handling. It is conventient to create style macros when styles are set. Otherwise, it would be necessary to check for the existence of style macros at the beginning of every command or environment.
-% \begin{macrocode}
-\newcommand{\minted at def@opt at style}{%
- \define at key{minted at opt@g}{style}{%
- \minted at checkstyle{##1}%
- \@namedef{minted at opt@g:style}{##1}}%
- \define at key{minted at opt@g at i}{style}{%
- \minted at checkstyle{##1}%
- \@namedef{minted at opt@g at i:style}{##1}}%
- \define at key{minted at opt@lang}{style}{%
- \minted at checkstyle{##1}%
- \@namedef{minted at opt@lang\minted at lang:style}{##1}}%
- \define at key{minted at opt@lang at i}{style}{%
- \minted at checkstyle{##1}%
- \@namedef{minted at opt@lang\minted at lang @i:style}{##1}}%
- \define at key{minted at opt@cmd}{style}{%
- \minted at checkstyle{##1}%
- \@namedef{minted at opt@cmd:style}{##1}}%
-}
-% \end{macrocode}
-% \end{macro}
%
-%
% \begin{macro}{\minted at checkstyle}
% Make sure that style macros exist.
%
@@ -2285,9 +2270,14 @@
% 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.
%
% 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.}
+%
+% 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.
+%
+% 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.
% \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}}%
@@ -2345,12 +2335,7 @@
% \end{macrocode}
% \end{macro}
%
-% At the beginning of the document, create the symbol macros with |PYG| prefix and generate the |default| style. This must wait until |\AtBeginDocument|, because the existence of |pygmentize| isn't tested and may not be final until |\AtEndPreamble|.
-% \begin{macrocode}
-\AtBeginDocument{\minted at checkstyle{}\setminted{style=default}}
-% \end{macrocode}
%
-%
% \begin{macro}{\minted at patch@PYGZsq}
% Patch the \pkg{Pygments} single quote macro for \pkg{upquote}. The single quote macro from Pygments 1.6+ needs to be patched if the \pkg{upquote} package is in use. The conditionals for the patch definition are borrowed from \pkg{upquote}. Patching is done |\AtBeginDocument|, after the macros will have been 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}
@@ -2479,7 +2464,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 at style
+\minted at def@opt{style}
% \end{macrocode}
%
% \pkg{fancyvrb} options.
@@ -3622,9 +3607,11 @@
% \end{macro}
%
% \begin{macro}{\minted at inputpyg}
-% For increased clarity, the actual |\input| process is separated out into its own macro. 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. |\FV at Space| is also patched for math mode, so that space characters will vanish rather than appear as literal spaces within math mode. To simplify the logic, |breakbytoken| is turned on if |breakbytokenanywhere| is on.
+% For increased clarity, the actual |\input| process is separated out into its own macro.
%
-% At the last possible moment, |\PYG| is |\let| to |\PYG<style>|. All modifications to the style macro for breaking are made to |\PYG<style>| rather than |\PYG|, so that the |\let|ing that must ultimately take place will indeed do what is intended.
+% A check is performed to make sure that style macros exist. This is done here, rather than when a style is set, so that creating the style macros is done as late as possible in case a custom |pygmentize| is in use via |\MintedPygmentize|. At the last possible moment, |\PYG| is |\let| to |\PYG<style>|. All modifications to the style macro for breaking are made to |\PYG<style>| rather than |\PYG|, so that the |\let|ing that must ultimately take place will indeed do what is intended.
+%
+% 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. |\FV at Space| is also patched for math mode, so that space characters will vanish rather than appear as literal spaces within math mode. To simplify the logic, |breakbytoken| is turned on if |breakbytokenanywhere| is on.
% \begin{macrocode}
\def\FV at SpaceMMode{ }
\def\minted at BreakBeforePrep@extension{%
@@ -3740,6 +3727,7 @@
\fi
}
\newcommand{\minted at inputpyg}{%
+ \minted at checkstyle{\minted at get@opt{style}{default}}%
\let\FV at BreakBeforePrep@orig\FV at BreakBeforePrep
\def\FV at BreakBeforePrep{%
\FV at BreakBeforePrep@orig\minted at BreakBeforePrep@extension}%
Modified: trunk/Master/texmf-dist/tex/latex/minted/minted.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/minted/minted.sty 2016-06-22 21:30:19 UTC (rev 41523)
+++ trunk/Master/texmf-dist/tex/latex/minted/minted.sty 2016-06-22 21:30:31 UTC (rev 41524)
@@ -27,7 +27,7 @@
%% and the derived file minted.sty.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{minted}
- [2016/06/15 v2.2.1 Yet another Pygments shim for LaTeX]
+ [2016/06/21 v2.2.2 Yet another Pygments shim for LaTeX]
\RequirePackage{keyval}
\RequirePackage{kvoptions}
\RequirePackage{fancyvrb}
@@ -480,26 +480,11 @@
\@namedef{minted at opt@lang\minted at lang @i:#2}{##1}}
\define at key{minted at opt@cmd}{#2}{%
\@namedef{minted at opt@cmd:#2}{##1}}
+ \ifstrempty{#1}{}{\@namedef{minted at opt@g:#2}{#1}}%
}
-\newcommand{\minted at def@opt at style}{%
- \define at key{minted at opt@g}{style}{%
- \minted at checkstyle{##1}%
- \@namedef{minted at opt@g:style}{##1}}%
- \define at key{minted at opt@g at i}{style}{%
- \minted at checkstyle{##1}%
- \@namedef{minted at opt@g at i:style}{##1}}%
- \define at key{minted at opt@lang}{style}{%
- \minted at checkstyle{##1}%
- \@namedef{minted at opt@lang\minted at lang:style}{##1}}%
- \define at key{minted at opt@lang at i}{style}{%
- \minted at checkstyle{##1}%
- \@namedef{minted at opt@lang\minted at lang @i:style}{##1}}%
- \define at key{minted at opt@cmd}{style}{%
- \minted at checkstyle{##1}%
- \@namedef{minted at opt@cmd:style}{##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}}%
@@ -554,7 +539,6 @@
\fi
}
\ifthenelse{\boolean{minted at draft}}{\renewcommand{\minted at checkstyle}[1]{}}{}
-\AtBeginDocument{\minted at checkstyle{}\setminted{style=default}}
\newcommand{\minted at patch@PYGZsq}{%
\ifcsname PYGZsq\endcsname
\ifx\upquote at cmtt\minted at undefined\else
@@ -644,7 +628,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 at style
+\minted at def@opt{style}
\minted at def@optfv{frame}
\minted at def@optfv{framesep}
\minted at def@optfv{framerule}
@@ -1438,6 +1422,7 @@
\fi
}
\newcommand{\minted at inputpyg}{%
+ \minted at checkstyle{\minted at get@opt{style}{default}}%
\let\FV at BreakBeforePrep@orig\FV at BreakBeforePrep
\def\FV at BreakBeforePrep{%
\FV at BreakBeforePrep@orig\minted at BreakBeforePrep@extension}%
More information about the tex-live-commits
mailing list