From fca717399bb79f5db531685f7e16aa0e0f40a71f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 18 Jun 2016 15:50:36 +0000 Subject: minted (16jun16) git-svn-id: svn://tug.org/texlive/trunk@41483 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/minted/minted.sty | 78 +++++++++++++++------------ 1 file changed, 43 insertions(+), 35 deletions(-) (limited to 'Master/texmf-dist/tex/latex/minted') diff --git a/Master/texmf-dist/tex/latex/minted/minted.sty b/Master/texmf-dist/tex/latex/minted/minted.sty index a9928e477a8..3a7e9432732 100644 --- a/Master/texmf-dist/tex/latex/minted/minted.sty +++ b/Master/texmf-dist/tex/latex/minted/minted.sty @@ -27,25 +27,25 @@ %% and the derived file minted.sty. \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{minted} - [2016/06/08 v2.2 Yet another Pygments shim for LaTeX] + [2016/06/15 v2.2.1 Yet another Pygments shim for LaTeX] \RequirePackage{keyval} \RequirePackage{kvoptions} \RequirePackage{fancyvrb} \RequirePackage{float} \RequirePackage{ifthen} \RequirePackage{calc} -\RequirePackage{ifplatform} -\RequirePackage{pdftexcmds} -\RequirePackage{etoolbox} -\RequirePackage{xstring} -\RequirePackage{lineno} -\RequirePackage{framed} \IfFileExists{shellesc.sty} {\RequirePackage{shellesc} \@ifpackagelater{shellesc}{2016/04/29} {} {\protected\def\ShellEscape{\immediate\write18 }}} {\protected\def\ShellEscape{\immediate\write18 }} +\RequirePackage{ifplatform} +\RequirePackage{pdftexcmds} +\RequirePackage{etoolbox} +\RequirePackage{xstring} +\RequirePackage{lineno} +\RequirePackage{framed} \AtBeginDocument{% \@ifpackageloaded{color}{}{% \@ifpackageloaded{xcolor}{}{\RequirePackage{xcolor}}}% @@ -1217,34 +1217,42 @@ {\edef\minted@hash{\pdf@filemdfivesum{#1}% \pdf@mdfivesum{\minted@cmd}}}% \else - \immediate\openout\minted@code\minted@jobname.mintedcmd\relax - \immediate\write\minted@code{\minted@cmd}% - \ifthenelse{\equal{\minted@get@opt{autogobble}{false}}{true}}% - {\immediate\write\minted@code{autogobble}}{}% - \immediate\closeout\minted@code - \edef\minted@argone@esc{#1}% - \StrSubstitute{\minted@argone@esc}{\@backslashchar}{\@backslashchar\@backslashchar}[\minted@argone@esc]% - \StrSubstitute{\minted@argone@esc}{"}{\@backslashchar"}[\minted@argone@esc]% - \edef\minted@tmpfname@esc{\minted@outputdir\minted@jobname}% - \StrSubstitute{\minted@tmpfname@esc}{\@backslashchar}{\@backslashchar\@backslashchar}[\minted@tmpfname@esc]% - \StrSubstitute{\minted@tmpfname@esc}{"}{\@backslashchar"}[\minted@tmpfname@esc]% - %Cheating a little here by using ASCII codes to write `{` and `}` - %in the Python code - \def\minted@hashcmd{% - \detokenize{python -c "import hashlib; import os; - hasher = hashlib.sha1(); - f = open(os.path.expanduser(os.path.expandvars(\"}\minted@tmpfname@esc.mintedcmd\detokenize{\")), \"rb\"); - hasher.update(f.read()); - f.close(); - f = open(os.path.expanduser(os.path.expandvars(\"}\minted@argone@esc\detokenize{\")), \"rb\"); - hasher.update(f.read()); - f.close(); - f = open(os.path.expanduser(os.path.expandvars(\"}\minted@tmpfname@esc.mintedmd5\detokenize{\")), \"w\"); - macro = \"\\edef\\minted@hash\" + chr(123) + hasher.hexdigest() + chr(125) + \"\"; - f.write(\"\\makeatletter\" + macro + \"\\makeatother\\endinput\n\"); - f.close();"}}% - \ShellEscape{\minted@hashcmd}% - \minted@input{\minted@outputdir\minted@jobname.mintedmd5}% + \ifx\mdfivesum\minted@undefined + \immediate\openout\minted@code\minted@jobname.mintedcmd\relax + \immediate\write\minted@code{\minted@cmd}% + \ifthenelse{\equal{\minted@get@opt{autogobble}{false}}{true}}% + {\immediate\write\minted@code{autogobble}}{}% + \immediate\closeout\minted@code + \edef\minted@argone@esc{#1}% + \StrSubstitute{\minted@argone@esc}{\@backslashchar}{\@backslashchar\@backslashchar}[\minted@argone@esc]% + \StrSubstitute{\minted@argone@esc}{"}{\@backslashchar"}[\minted@argone@esc]% + \edef\minted@tmpfname@esc{\minted@outputdir\minted@jobname}% + \StrSubstitute{\minted@tmpfname@esc}{\@backslashchar}{\@backslashchar\@backslashchar}[\minted@tmpfname@esc]% + \StrSubstitute{\minted@tmpfname@esc}{"}{\@backslashchar"}[\minted@tmpfname@esc]% + %Cheating a little here by using ASCII codes to write `{` and `}` + %in the Python code + \def\minted@hashcmd{% + \detokenize{python -c "import hashlib; import os; + hasher = hashlib.sha1(); + f = open(os.path.expanduser(os.path.expandvars(\"}\minted@tmpfname@esc.mintedcmd\detokenize{\")), \"rb\"); + hasher.update(f.read()); + f.close(); + f = open(os.path.expanduser(os.path.expandvars(\"}\minted@argone@esc\detokenize{\")), \"rb\"); + hasher.update(f.read()); + f.close(); + f = open(os.path.expanduser(os.path.expandvars(\"}\minted@tmpfname@esc.mintedmd5\detokenize{\")), \"w\"); + macro = \"\\edef\\minted@hash\" + chr(123) + hasher.hexdigest() + chr(125) + \"\"; + f.write(\"\\makeatletter\" + macro + \"\\makeatother\\endinput\n\"); + f.close();"}}% + \ShellEscape{\minted@hashcmd}% + \minted@input{\minted@outputdir\minted@jobname.mintedmd5}% + \else + \ifthenelse{\equal{\minted@get@opt{autogobble}{false}}{true}}% + {\edef\minted@hash{\mdfivesum file {#1}% + \mdfivesum{\minted@cmd autogobble}}}% + {\edef\minted@hash{\mdfivesum file {#1}% + \mdfivesum{\minted@cmd}}}% + \fi \fi \edef\minted@infile{\minted@cachedir/\minted@hash.pygtex}% \IfFileExists{\minted@infile}{}{% -- cgit v1.2.3