texlive[42418] Master/texmf-dist: minted (1nov16)

commits+karl at tug.org commits+karl at tug.org
Tue Nov 1 21:14:54 CET 2016


Revision: 42418
          http://tug.org/svn/texlive?view=revision&revision=42418
Author:   karl
Date:     2016-11-01 21:14:54 +0100 (Tue, 01 Nov 2016)
Log Message:
-----------
minted (1nov16)

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-11-01 20:14:41 UTC (rev 42417)
+++ trunk/Master/texmf-dist/source/latex/minted/minted.dtx	2016-11-01 20:14:54 UTC (rev 42418)
@@ -31,7 +31,7 @@
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{minted}
 %<*package>
-    [2016/07/20 v2.4 Yet another Pygments shim for LaTeX]
+    [2016/10/31 v2.4.1 Yet another Pygments shim for LaTeX]
 %</package>
 %<*driver>
 \documentclass{ltxdoc}
@@ -195,7 +195,7 @@
 %</driver>
 % \fi
 %
-% \CheckSum{2542}
+% \CheckSum{2614}
 %
 % \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,9 +216,16 @@
 %
 %
 %
+% \begin{changelog}{v2.4.1}{2016/10/31}
+% \item Single quotation marks in \texttt{\string\jobname} are now replaced with underscores in \texttt{\string\minted at jobname} to prevent quoting errors (\#137).
+% \item The \texttt{autogobble} option now takes \texttt{firstline} and \texttt{lastline} into account (\#130).
+% \item Fixed \texttt{numberblanklines}, which had been lost in the transition to v2.0+ (\#135).
+% \end{changelog}
+%
+%
 % \begin{changelog}{v2.4}{2016/07/20}
 % \item Line breaking and all associated options are now completely delegated to \texttt{fvextra}.
-% \item Fixed a bug from v2.2 that could cause the first command or environment to vanish when \texttt{caching=false} (related to work on \texttt{\string\MintedPygmentize}).
+% \item Fixed a bug from v2.2 that could cause the first command or environment to vanish when \texttt{cache=false} (related to work on \texttt{\string\MintedPygmentize}).
 % \end{changelog}
 %
 %
@@ -766,7 +773,7 @@
 %
 %
 % \DescribeMacro{cachedir=\meta{directory} (def:~\_minted-\meta{jobname})}
-% This allows the directory in which cached files are stored to be specified.  Paths should use forward spaces, even under Windows.
+% This allows the directory in which cached files are stored to be specified.  Paths should use forward slashes, even under Windows.
 %
 % Special characters must be escaped.  For example, |cachedir=~/mintedcache| would not work because the tilde |~| would be converted into the \LaTeX\ commands for a non-breaking space, rather than being treated literally.  Instead, use |\string~/mintedcache|, |\detokenize{~/mintedcache}|, or an equivalent solution.
 %
@@ -858,7 +865,7 @@
 % \DescribeMacro{outputdir=\meta{directory} (default:~\meta{none})}
 % The |-output-directory| and |-aux-directory| (MiKTeX) command-line options for \LaTeX\ cause problems for \pkg{minted}, because the \pkg{minted} temporary files are saved in |<outputdir>|, but \pkg{minted} still looks for them in the document root directory.  There is no way to access the value of the command-line option so that \pkg{minted} can automatically look in the right place.  But it is possible to allow the output directory to be specified manually as a package option.
 %
-% The output directory should be specified using an absolute path or a path relative to the document root directory.  Paths should use forward spaces, even under Windows.  Special characters must be escaped, while spaces require quoting and need the entire \meta{directory} to be wrapped in curly braces |{}|.  See |cachedir| above for examples of escaping and quoting.
+% The output directory should be specified using an absolute path or a path relative to the document root directory.  Paths should use forward slashes, even under Windows.  Special characters must be escaped, while spaces require quoting and need the entire \meta{directory} to be wrapped in curly braces |{}|.  See |cachedir| above for examples of escaping and quoting.
 %
 %
 % \DescribeMacro{section}
@@ -1582,11 +1589,12 @@
 %
 %
 % \begin{macro}{\minted at jobname}
-% At various points, temporary files and directories will need to be named after the main |.tex| file.  The typical way to do this is to use |\jobname|.  However, if the file name contains spaces, then |\jobname| will contain the name wrapped in quotes (older versions of MiKTeX replace spaces with asterisks instead, and \texttt{XeTeX} apparently \href{http://tex.stackexchange.com/a/93829/10742}{allows double quotes within file names}, in which case names are wrapped in single quotes).  While that is perfectly fine for working with \LaTeX\ internally, it causes problems with |\write18|, since quotes will end up in unwanted locations in shell commands.  It would be possible to strip the wrapping quotation marks when they are present, and maintain any spaces in the file name.  But it is simplest to create a ``sanitized'' version of |\jobname| in which spaces and asterisks are replaced by underscores, and double quotes are stripped.
+% At various points, temporary files and directories will need to be named after the main |.tex| file.  The typical way to do this is to use |\jobname|.  However, if the file name contains spaces, then |\jobname| will contain the name wrapped in quotes (older versions of MiKTeX replace spaces with asterisks instead, and \texttt{XeTeX} apparently \href{http://tex.stackexchange.com/a/93829/10742}{allows double quotes within file names}, in which case names are wrapped in single quotes).  While that is perfectly fine for working with \LaTeX\ internally, it causes problems with |\write18|, since quotes will end up in unwanted locations in shell commands.  It would be possible to strip the wrapping quotation marks when they are present, and maintain any spaces in the file name.  But it is simplest to create a ``sanitized'' version of |\jobname| in which spaces and asterisks are replaced by underscores, and double quotes are stripped.  Single quotes are also replaced, since they can cause quoted string errors, or become double quotes in the process of being passed to the system through |\write18|.
 %    \begin{macrocode}
 \StrSubstitute{\jobname}{ }{_}[\minted at jobname]
 \StrSubstitute{\minted at jobname}{*}{_}[\minted at jobname]
 \StrSubstitute{\minted at jobname}{"}{}[\minted at jobname]
+\StrSubstitute{\minted at jobname}{'}{_}[\minted at jobname]
 %    \end{macrocode}
 % \end{macro}
 %
@@ -2567,6 +2575,7 @@
 \minted at def@optfv{highlightcolor}
 \minted at def@optfv at switch{curlyquotes}
 \minted at def@optfv at switch{numberfirstline}
+\minted at def@optfv at switch{numberblanklines}
 \minted at def@optfv at switch{stepnumberfromfirst}
 \minted at def@optfv at switch{stepnumberoffsetvalues}
 \minted at def@optfv at switch{showspaces}
@@ -2782,7 +2791,7 @@
         \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}}}%
+              \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
@@ -2790,7 +2799,7 @@
             \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}}{}%
+              {\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]%
@@ -2818,7 +2827,7 @@
           \else
             \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}%
              {\edef\minted at hash{\mdfivesum file {#1}%
-                \mdfivesum{\minted at cmd autogobble}}}%
+                \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
@@ -2838,10 +2847,14 @@
               import textwrap;
               from io import open;
               f = open(os.path.expanduser(os.path.expandvars(\"}\minted at argone@esc\detokenize{\")), \"r\", encoding=\"}\minted at encoding\detokenize{\");
-              t = f.read();
+              t = f.readlines();
               f.close();
               f = open(os.path.expanduser(os.path.expandvars(\"}\minted at tmpfname@esc.pyg\detokenize{\")), \"w\", encoding=\"}\minted at encoding\detokenize{\");
-              f.write(textwrap.dedent(t));
+              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);
+              [f.write(textwrap.dedent(\"\".join(x))) for x in (t[0:s], t[s:e], t[e:]) if x];
               f.close();"}%
             }%
             \ShellEscape{\minted at autogobblecmd}}{}%
@@ -2883,10 +2896,14 @@
           import textwrap;
           from io import open;
           f = open(os.path.expanduser(os.path.expandvars(\"}\minted at argone@esc\detokenize{\")), \"r\", encoding=\"}\minted at encoding\detokenize{\");
-          t = f.read();
+          t = f.readlines();
           f.close();
           f = open(os.path.expanduser(os.path.expandvars(\"}\minted at tmpfname@esc.pyg\detokenize{\")), \"w\", encoding=\"}\minted at encoding\detokenize{\");
-          f.write(textwrap.dedent(t));
+          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);
+          [f.write(textwrap.dedent(\"\".join(x))) for x in (t[0:s], t[s:e], t[e:]) if x];
           f.close();"}%
         }%
         \ShellEscape{\minted at autogobblecmd}}{}%

Modified: trunk/Master/texmf-dist/tex/latex/minted/minted.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/minted/minted.sty	2016-11-01 20:14:41 UTC (rev 42417)
+++ trunk/Master/texmf-dist/tex/latex/minted/minted.sty	2016-11-01 20:14:54 UTC (rev 42418)
@@ -27,7 +27,7 @@
 %% and the derived file minted.sty.
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{minted}
-    [2016/07/20 v2.4 Yet another Pygments shim for LaTeX]
+    [2016/10/31 v2.4.1 Yet another Pygments shim for LaTeX]
 \RequirePackage{keyval}
 \RequirePackage{kvoptions}
 \RequirePackage{fvextra}
@@ -57,6 +57,7 @@
 \StrSubstitute{\jobname}{ }{_}[\minted at jobname]
 \StrSubstitute{\minted at jobname}{*}{_}[\minted at jobname]
 \StrSubstitute{\minted at jobname}{"}{}[\minted at jobname]
+\StrSubstitute{\minted at jobname}{'}{_}[\minted at jobname]
 \newcommand{\minted at cachedir}{\detokenize{_}minted-\minted at jobname}
 \let\minted at cachedir@windows\minted at cachedir
 \define at key{minted}{cachedir}{%
@@ -654,6 +655,7 @@
 \minted at def@optfv{highlightcolor}
 \minted at def@optfv at switch{curlyquotes}
 \minted at def@optfv at switch{numberfirstline}
+\minted at def@optfv at switch{numberblanklines}
 \minted at def@optfv at switch{stepnumberfromfirst}
 \minted at def@optfv at switch{stepnumberoffsetvalues}
 \minted at def@optfv at switch{showspaces}
@@ -766,7 +768,7 @@
         \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}}}%
+              \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
@@ -774,7 +776,7 @@
             \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}}{}%
+              {\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]%
@@ -802,7 +804,7 @@
           \else
             \ifthenelse{\equal{\minted at get@opt{autogobble}{false}}{true}}%
              {\edef\minted at hash{\mdfivesum file {#1}%
-                \mdfivesum{\minted at cmd autogobble}}}%
+                \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
@@ -822,10 +824,14 @@
               import textwrap;
               from io import open;
               f = open(os.path.expanduser(os.path.expandvars(\"}\minted at argone@esc\detokenize{\")), \"r\", encoding=\"}\minted at encoding\detokenize{\");
-              t = f.read();
+              t = f.readlines();
               f.close();
               f = open(os.path.expanduser(os.path.expandvars(\"}\minted at tmpfname@esc.pyg\detokenize{\")), \"w\", encoding=\"}\minted at encoding\detokenize{\");
-              f.write(textwrap.dedent(t));
+              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);
+              [f.write(textwrap.dedent(\"\".join(x))) for x in (t[0:s], t[s:e], t[e:]) if x];
               f.close();"}%
             }%
             \ShellEscape{\minted at autogobblecmd}}{}%
@@ -867,10 +873,14 @@
           import textwrap;
           from io import open;
           f = open(os.path.expanduser(os.path.expandvars(\"}\minted at argone@esc\detokenize{\")), \"r\", encoding=\"}\minted at encoding\detokenize{\");
-          t = f.read();
+          t = f.readlines();
           f.close();
           f = open(os.path.expanduser(os.path.expandvars(\"}\minted at tmpfname@esc.pyg\detokenize{\")), \"w\", encoding=\"}\minted at encoding\detokenize{\");
-          f.write(textwrap.dedent(t));
+          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);
+          [f.write(textwrap.dedent(\"\".join(x))) for x in (t[0:s], t[s:e], t[e:]) if x];
           f.close();"}%
         }%
         \ShellEscape{\minted at autogobblecmd}}{}%



More information about the tex-live-commits mailing list