diff options
author | Karl Berry <karl@freefriends.org> | 2017-07-20 21:22:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-07-20 21:22:54 +0000 |
commit | 63ad53fb1eb73d728d93f083d65fd585cd295978 (patch) | |
tree | eaa63654f927aee6c24df715f0236b34d5d1488f /Master/texmf-dist/tex/latex/minted | |
parent | 801f243e1382ba3fc8798cc8e38db540c8dc9d6e (diff) |
minted (20jul17)
git-svn-id: svn://tug.org/texlive/trunk@44855 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/minted')
-rw-r--r-- | Master/texmf-dist/tex/latex/minted/minted.sty | 140 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/minted/minted1.sty | 2 |
2 files changed, 78 insertions, 64 deletions
diff --git a/Master/texmf-dist/tex/latex/minted/minted.sty b/Master/texmf-dist/tex/latex/minted/minted.sty index 25b064a7b08..d755023db4b 100644 --- a/Master/texmf-dist/tex/latex/minted/minted.sty +++ b/Master/texmf-dist/tex/latex/minted/minted.sty @@ -5,7 +5,7 @@ %% The original source files were: %% %% minted.dtx (with options: `package') -%% Copyright 2013--2016 Geoffrey M. Poore +%% Copyright 2013--2017 Geoffrey M. Poore %% Copyright 2010--2011 Konrad Rudolph %% %% This work may be distributed and/or modified under the @@ -27,11 +27,10 @@ %% and the derived file minted.sty. \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{minted} - [2016/10/31 v2.4.1 Yet another Pygments shim for LaTeX] + [2017/07/19 v2.5 Yet another Pygments shim for LaTeX] \RequirePackage{keyval} \RequirePackage{kvoptions} \RequirePackage{fvextra} -\RequirePackage{float} \RequirePackage{ifthen} \RequirePackage{calc} \IfFileExists{shellesc.sty} @@ -76,7 +75,7 @@ \DeclareBoolOption{draft} \DeclareComplementaryOption{final}{draft} \ProcessKeyvalOptions* -\ifthenelse{\boolean{minted@newfloat}}{\RequirePackage{newfloat}}{} +\ifthenelse{\boolean{minted@newfloat}}{\RequirePackage{newfloat}}{\RequirePackage{float}} \ifcsname tikzifexternalizing\endcsname \tikzifexternalizing{\minted@drafttrue\minted@cachefalse}{} \else @@ -104,12 +103,10 @@ {\PackageError{minted}{Missing Pygments output; \string\inputminted\space was^^Jprobably given a file that does not exist--otherwise, you may need ^^Jthe outputdir package option, or may be using an incompatible build - tool\ifwindows,^^Jor may be using the kpsewhich option without having - PowerShell installed\fi,^^Jor may be using frozencache with a missing file}% + tool,^^Jor may be using frozencache with a missing file}% {This could be caused by using -output-directory or -aux-directory ^^Jwithout setting minted's outputdir, or by using a build tool that - ^^Jchanges paths in ways minted cannot detect\ifwindows, or by using the - ^^Jkpsewhich option without PowerShell\fi, + ^^Jchanges paths in ways minted cannot detect, ^^Jor using frozencache with a missing file.}}% } \newcommand{\minted@infile}{\minted@jobname.out.pyg} @@ -513,8 +510,10 @@ }% \begingroup \let\def\gdef + \catcode\string``=12 \catcode`\_=11 \catcode`\-=11 + \catcode`\%=14 \endlinechar=-1\relax \minted@input{% \minted@outputdir\minted@cachedir/\ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}% @@ -532,8 +531,10 @@ \fi \begingroup \let\def\gdef + \catcode\string``=12 \catcode`\_=11 \catcode`\-=11 + \catcode`\%=14 \endlinechar=-1\relax \minted@input{\minted@outputdir\minted@jobname.out.pyg}% \endgroup}% @@ -653,6 +654,7 @@ \minted@def@optfv{tab} \minted@def@optfv{tabcolor} \minted@def@optfv{highlightcolor} +\minted@def@optfv@switch{beameroverlays} \minted@def@optfv@switch{curlyquotes} \minted@def@optfv@switch{numberfirstline} \minted@def@optfv@switch{numberblanklines} @@ -667,16 +669,23 @@ \minted@def@optfv@switch{breakbytoken} \minted@def@optfv@switch{breakbytokenanywhere} \minted@def@optfv{breakindent} +\minted@def@optfv{breakindentnchars} \minted@def@optfv@switch{breakautoindent} \minted@def@optfv{breaksymbol} \minted@def@optfv{breaksymbolsep} +\minted@def@optfv{breaksymbolsepnchars} \minted@def@optfv{breaksymbolindent} +\minted@def@optfv{breaksymbolindentnchars} \minted@def@optfv{breaksymbolleft} \minted@def@optfv{breaksymbolsepleft} +\minted@def@optfv{breaksymbolsepleftnchars} \minted@def@optfv{breaksymbolindentleft} +\minted@def@optfv{breaksymbolindentleftnchars} \minted@def@optfv{breaksymbolright} \minted@def@optfv{breaksymbolsepright} +\minted@def@optfv{breaksymbolseprightnchars} \minted@def@optfv{breaksymbolindentright} +\minted@def@optfv{breaksymbolindentrightnchars} \minted@def@optfv{breakbefore} \minted@def@optfv{breakbeforesymbolpre} \minted@def@optfv{breakbeforesymbolpost} @@ -742,7 +751,11 @@ \csname minted@optlistcl@lang\minted@lang @i\endcsname}}% {\let\minted@optlistcl@inlines\@empty}% \def\minted@cmd{% - \ifminted@kpsewhich\ifwindows powershell\space\fi\fi + \ifminted@kpsewhich + \ifwindows + \detokenize{for /f "usebackq tokens=*"}\space\@percentchar\detokenize{a in (`kpsewhich}\space\minted@codefile\detokenize{`) do}\space + \fi + \fi \MintedPygmentize\space -l #2 -f latex -P commandprefix=PYG -F tokenmerge \minted@optlistcl@g \csname minted@optlistcl@lang\minted@lang\endcsname @@ -750,7 +763,7 @@ \minted@optlistcl@cmd -o \minted@outputdir\minted@infile\space \ifminted@kpsewhich \ifwindows - \detokenize{$}(kpsewhich \minted@codefile)% + \@percentchar\detokenize{a}% \else \detokenize{`}kpsewhich \minted@codefile\space \detokenize{||} \minted@codefile\detokenize{`}% @@ -812,29 +825,7 @@ \edef\minted@infile{\minted@cachedir/\minted@hash.pygtex}% \IfFileExists{\minted@infile}{}{% \ifthenelse{\equal{\minted@get@opt{autogobble}{false}}{true}}{% - \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]% - %Need a version of open() that supports encoding under Python 2 - \edef\minted@autogobblecmd{% - \detokenize{python -c "import sys; import os; - import textwrap; - from io import open; - f = open(os.path.expanduser(os.path.expandvars(\"}\minted@argone@esc\detokenize{\")), \"r\", encoding=\"}\minted@encoding\detokenize{\"); - t = f.readlines(); - f.close(); - f = open(os.path.expanduser(os.path.expandvars(\"}\minted@tmpfname@esc.pyg\detokenize{\")), \"w\", encoding=\"}\minted@encoding\detokenize{\"); - 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@autogobblecmd}}{}% + \minted@autogobble{#1}}{}% \ShellEscape{\minted@cmd}}% \fi \ifthenelse{\boolean{minted@finalizecache}}% @@ -844,9 +835,9 @@ \ifwindows \StrSubstitute{\minted@infile}{/}{\@backslashchar}[\minted@infile@windows] \StrSubstitute{\minted@actualinfile}{/}{\@backslashchar}[\minted@actualinfile@windows] - \ShellEscape{move /y \minted@infile@windows\space\minted@actualinfile@windows}% + \ShellEscape{move /y \minted@outputdir\minted@infile@windows\space\minted@outputdir\minted@actualinfile@windows}% \else - \ShellEscape{mv -f \minted@infile\space\minted@actualinfile}% + \ShellEscape{mv -f \minted@outputdir\minted@infile\space\minted@outputdir\minted@actualinfile}% \fi \let\minted@infile\minted@actualinfile \expandafter\minted@addcachefile\expandafter{\minted@cachefilename}% @@ -861,32 +852,55 @@ \minted@inputpyg}% {% \ifthenelse{\equal{\minted@get@opt{autogobble}{false}}{true}}{% - \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]% - %Need a version of open() that supports encoding under Python 2 - \edef\minted@autogobblecmd{% - \detokenize{python -c "import sys; import os; - import textwrap; - from io import open; - f = open(os.path.expanduser(os.path.expandvars(\"}\minted@argone@esc\detokenize{\")), \"r\", encoding=\"}\minted@encoding\detokenize{\"); - t = f.readlines(); - f.close(); - f = open(os.path.expanduser(os.path.expandvars(\"}\minted@tmpfname@esc.pyg\detokenize{\")), \"w\", encoding=\"}\minted@encoding\detokenize{\"); - 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@autogobblecmd}}{}% + \minted@autogobble{#1}}{}% \ShellEscape{\minted@cmd}% \minted@inputpyg}% } +\def\minted@autogobble#1{% + \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]% + %Need a version of open() that supports encoding under Python 2 + \edef\minted@autogobblecmd{% + \ifminted@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; + import textwrap; + from io import open; + fname = }% + \ifminted@kpsewhich + \detokenize{sys.argv[1];}\space% + \else + \detokenize{os.path.expanduser(os.path.expandvars(\"}\minted@argone@esc\detokenize{\"));}\space% + \fi + \detokenize{f = open(fname, \"r\", encoding=\"}\minted@encoding\detokenize{\") if os.path.isfile(fname) else None; + t = f.readlines() if f is not None else None; + t_opt = t if t is not None else []; + f.close() if f is not None else None; + tmpfname = os.path.expanduser(os.path.expandvars(\"}\minted@tmpfname@esc.pyg\detokenize{\")); + f = open(tmpfname, \"w\", encoding=\"}\minted@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); + [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@kpsewhich + \ifwindows + \space\@percentchar\detokenize{a}% + \else + \space\detokenize{`}kpsewhich #1\space\detokenize{||} #1\detokenize{`}% + \fi + \fi + }% + \ShellEscape{\minted@autogobblecmd}% +} \newcommand{\minted@inputpyg}{% \expandafter\let\expandafter\minted@PYGstyle% \csname PYG\minted@get@opt{style}{default}\endcsname @@ -1070,7 +1084,7 @@ \minted@configlang{#2}% \setkeys{minted@opt@cmd}{#1}% \minted@fvset - \begin{VerbatimOut}[codes={\catcode`\^^I=12}]{\minted@jobname.pyg}}% + \begin{VerbatimOut}[codes={\catcode`\^^I=12},firstline,lastline]{\minted@jobname.pyg}}% {\end{VerbatimOut}% \minted@langlinenoson \minted@pygmentize{\minted@lang}% @@ -1128,13 +1142,13 @@ } \ifthenelse{\boolean{minted@newfloat}}% {\@ifundefined{minted@float@within}% - {\DeclareFloatingEnvironment[fileext=lol,placement=h]{listing}}% + {\DeclareFloatingEnvironment[fileext=lol,placement=tbp]{listing}}% {\def\minted@tmp#1{% - \DeclareFloatingEnvironment[fileext=lol,placement=h, within=#1]{listing}}% + \DeclareFloatingEnvironment[fileext=lol,placement=tbp, within=#1]{listing}}% \expandafter\minted@tmp\expandafter{\minted@float@within}}}% {\@ifundefined{minted@float@within}% - {\newfloat{listing}{h}{lol}}% - {\newfloat{listing}{h}{lol}[\minted@float@within]}} + {\newfloat{listing}{tbp}{lol}}% + {\newfloat{listing}{tbp}{lol}[\minted@float@within]}} \ifminted@newfloat\else \newcommand{\listingscaption}{Listing} \floatname{listing}{\listingscaption} diff --git a/Master/texmf-dist/tex/latex/minted/minted1.sty b/Master/texmf-dist/tex/latex/minted/minted1.sty index 79ef87ed968..31814876142 100644 --- a/Master/texmf-dist/tex/latex/minted/minted1.sty +++ b/Master/texmf-dist/tex/latex/minted/minted1.sty @@ -5,7 +5,7 @@ %% The original source files were: %% %% minted.dtx (with options: `packageone') -%% Copyright 2013--2016 Geoffrey M. Poore +%% Copyright 2013--2017 Geoffrey M. Poore %% Copyright 2010--2011 Konrad Rudolph %% %% This work may be distributed and/or modified under the |