Closed schtandard closed 9 months ago
This used to work, but I can't get it to work with current versions of minted.
I've successfully modified the old version to work again.
\makeatletter
\newcommand{\minted@addto@optlistclswitch}[2]{%
\expandafter\def\expandafter#1\expandafter{#1%
\detokenize{#2}\space}}
\newcommand{\minted@addto@optlistcl@langswitch}[2]{%
\expandafter\let\expandafter\minted@tmp\csname #1\endcsname
\expandafter\def\expandafter\minted@tmp\expandafter{\minted@tmp%
\detokenize{#2}\space}%
\expandafter\let\csname #1\endcsname\minted@tmp}
\newcommand{\minted@def@optcl@filterswitch}[2]{%
\define@booleankey{minted@opt@g}{#1}%
{\minted@addto@optlistclswitch{\minted@optlistcl@g}{#2}{}%
\@namedef{minted@opt@g:#1}{true}}
{\minted@addto@optlistclswitch{\minted@optlistcl@g}{}{}%
\@namedef{minted@opt@g:#1}{false}}
\define@booleankey{minted@opt@g@i}{#1}%
{\minted@addto@optlistclswitch{\minted@optlistcl@g@i}{#2}{}%
\@namedef{minted@opt@g@i:#1}{true}}
{\minted@addto@optlistclswitch{\minted@optlistcl@g@i}{}{}%
\@namedef{minted@opt@g@i:#1}{false}}
\define@booleankey{minted@opt@lang}{#1}%
{\minted@addto@optlistcl@langswitch{minted@optlistcl@lang\minted@lang}{#2}{}%
\@namedef{minted@opt@lang\minted@lang:#1}{true}}
{\minted@addto@optlistcl@langswitch{minted@optlistcl@lang\minted@lang}{}{}%
\@namedef{minted@opt@lang\minted@lang:#1}{false}}
\define@booleankey{minted@opt@lang@i}{#1}%
{\minted@addto@optlistcl@langswitch{minted@optlistcl@lang\minted@lang@i}{#2}{}%
\@namedef{minted@opt@lang\minted@lang@i:#1}{true}}
{\minted@addto@optlistcl@langswitch{minted@optlistcl@lang\minted@lang@i}{}{}%
\@namedef{minted@opt@lang\minted@lang@i:#1}{false}}
\define@booleankey{minted@opt@cmd}{#1}%
{\minted@addto@optlistclswitch{\minted@optlistcl@cmd}{#2}{}%
\@namedef{minted@opt@cmd:#1}{true}}
{\minted@addto@optlistclswitch{\minted@optlistcl@cmd}{}{}%
\@namedef{minted@opt@cmd:#1}{false}}
}
\minted@def@optcl@filterswitch{allowlocal}{-x}
\makeatother
\setminted{allowlocal}
minted
version 3.0 is now under development, thanks to a grant from the TeX Users Group. It will include official support for custom lexers. It will also be able to be extended using Python, not just LaTeX macro programming, which will make possible many new lexer-related features. Progress on custom lexers will be tracked in #372. Initial beta releases of minted
version 3.0 are expected by early 2024.
I sometimes want to use a custom pygments lexer residing in the document directory (i.e. not installed system-wide). This can be achieved using
pygmentize
's-x
option. Of course,minted
is callingpygmentize
for me, so I have to get it to pass that flag for me. In the past, I could just enter it as part of the "language name". For example, if I have a file namedpygmentsmod.py
in the document directory in which I define apygments
lexerMyTexLexer
, I could sayThis no longer works, as
\minted@opt@quote
now quotes my "language", including the-x
. I can still trickminted
by usinginstead (on Windows), but while while I found the previous hack to be somewhat acceptable, this is just ugly.
So, I would like to request
-x
)minted
(in the usual key-value fashion)minted
just setting the-x
flag for all calls (which could lead to conflicts when there is a file with the same name as apygmentize
language, but won't have an effect otherwise).