|
31 | 31 | %<package>\NeedsTeXFormat{LaTeX2e} |
32 | 32 | %<package>\ProvidesPackage{minted} |
33 | 33 | %<*package> |
34 | | - [2021/12/23 v2.6dev Yet another Pygments shim for LaTeX] |
| 34 | + [2021/12/24 v2.6dev Yet another Pygments shim for LaTeX] |
35 | 35 | %</package> |
36 | 36 | %<*driver> |
37 | 37 | \documentclass{ltxdoc} |
|
49 | 49 | \usepackage[svgnames]{xcolor} |
50 | 50 | \usepackage{textcomp} |
51 | 51 | \usepackage[cache, langlinenos]{minted} |
52 | | -% Need to set the style here so that it is defined and brought in here. |
53 | | -% If the style is set later, then docstrip interferes with any comments in |
54 | | -% the style definition so that they appear as literal text in the document. |
55 | | -\setminted{style=default} |
56 | 52 |
|
57 | 53 | \usepackage{environ} |
58 | 54 | \usepackage{graphicx} |
|
61 | 57 |
|
62 | 58 |
|
63 | 59 | \makeatletter |
| 60 | +% The typesetting for macrocode doesn't use \@noligs, which upquote modifies. |
| 61 | +% So apply the upquote fix to \verbatim@nolig@list as well, which is in macrocode. |
| 62 | +\begingroup |
| 63 | +\catcode`'=\active |
| 64 | +\catcode``=\active |
| 65 | +\g@addto@macro\verbatim@nolig@list{% |
| 66 | + \let'\textquotesingle |
| 67 | + \let`\textasciigrave |
| 68 | + \ifx\encodingdefault\upquote@OTone |
| 69 | + \ifx\ttdefault\upquote@cmtt |
| 70 | + \def'{\char13 }% |
| 71 | + \def`{\char18 }% |
| 72 | + \fi\fi} |
| 73 | +\endgroup |
64 | 74 |
|
65 | 75 | % Create a short verbatim pipe that handles quotation marks properly |
66 | 76 | \begingroup |
|
195 | 205 | %</driver> |
196 | 206 | % \fi |
197 | 207 | % |
198 | | -% \CheckSum{2587} |
| 208 | +% \CheckSum{2593} |
199 | 209 | % |
200 | 210 | % \CharacterTable |
201 | 211 | % {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 |
|
218 | 228 | % |
219 | 229 | % \begin{changelog}{v2.6}{2021/12/??} |
220 | 230 | % \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). |
| 231 | +% \item Fixed \texttt{autogobble} compatibility with \texttt{fancyvrb} 4.0+ (\#315, \#316). |
| 232 | +% \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}). |
221 | 233 | % \item Removed Python-based MD5 hashing for XeTeX, which was necessary before XeTeX added \texttt{\string\mdfivesum} in 2017. |
222 | 234 | % \item The default for \texttt{stripnl} is now \texttt{false}, so that original code is preserved exactly by default (\#198). |
223 | 235 | % \item Added support for \texttt{fontencoding} option from \texttt{fvextra} (\#208). |
224 | | -% \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). |
225 | | -% \item Fixed \texttt{autogobble} compatibility with \texttt{fancyvrb} 4.0+ (\#315, \#316). |
226 | 236 | % \item Added note to FAQ about getting \texttt{texi2pdf} to work with \texttt{minted} given \texttt{texi2pdf}'s assumptions about temp files (\#186). |
227 | 237 | % \item Reimplemented \texttt{bgcolor} option to be compatible with \texttt{color} package. |
228 | 238 | % \end{changelog} |
|
556 | 566 | % \item framed |
557 | 567 | % \item shellesc (for luatex 0.87+) |
558 | 568 | % \item catchfile |
| 569 | +% |
| 570 | +% ~ |
559 | 571 | % \end{list} |
560 | 572 | % \endgroup |
561 | 573 | % \end{multicols} |
|
2453 | 2465 | % |
2454 | 2466 | % 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@defstyle|) to convert |\minted@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@get@opt|, not the value at the end of the document when cache data is written to the |.aux| file. |
2455 | 2467 | % |
2456 | | -% Certain catcodes are required when loading Pygments style definitions from file. |catchfile| should automatically set everything to correct default values, except for |@| and |\endlinechar| which are handled manually. If a different approach to handling macros is ever used in the future, these require special handling: |
| 2468 | +% Certain catcodes are required when loading Pygments style definitions from file. |
2457 | 2469 | % \begin{itemize} |
2458 | | -% \item Backtick |`| is made active by some \pkg{babel} package options, such as |magyar|. |
| 2470 | +% \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. |
2459 | 2471 | % \item Percent |%| may not have its normal meaning within a |.dtx| file. |
| 2472 | +% \item Backtick |`| is made active by some \pkg{babel} package options, such as |magyar|. |
2460 | 2473 | % \end{itemize} |
| 2474 | +% |\endlinechar| also requires special handling to avoid introducing unwanted spaces. |
2461 | 2475 | % |
2462 | 2476 | % 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. |
2463 | 2477 | % \begin{macrocode} |
|
2485 | 2499 | }% |
2486 | 2500 | }% |
2487 | 2501 | \CatchFileDef{\minted@tmp@filecontents}% |
2488 | | - {\minted@pygstylepath@load}{\catcode`@=11\endlinechar=-1}% |
| 2502 | + {\minted@pygstylepath@load}{\catcode`@=11\catcode`\%=14\catcode``=12\endlinechar=-1}% |
2489 | 2503 | \begingroup |
2490 | 2504 | \let\PYG\relax |
2491 | 2505 | \minted@tmp@filecontents |
|
2500 | 2514 | > \minted@pygstylepath@save |
2501 | 2515 | }% |
2502 | 2516 | \CatchFileDef{\minted@tmp@filecontents}% |
2503 | | - {\minted@pygstylepath@load}{\catcode`@=11\endlinechar=-1}% |
| 2517 | + {\minted@pygstylepath@load}{\catcode`@=11\catcode`\%=14\catcode``=12\endlinechar=-1}% |
2504 | 2518 | \minted@tmp@filecontents |
2505 | 2519 | \ifx\PYG\relax |
2506 | 2520 | \PackageError{minted}% |
|
0 commit comments