Am 14.02.2010 13:50, schrieb Armin Ronacher:
> Hi,
>
> On Feb 14, 7:46 am, "Mike.lifeguard" <[email protected]> wrote:
>> How can I get a machine-readable list of language/lexer names
>> pygmentize will understand? pygmentize -L lexer has quite strange
>> output, and pygmentize -L lexers | grep '* [^ ]' | sed -r 's/\* (.*):$/
>> \1/' or similar isn't much better.
> With a Python script:
>
> from pygments.lexers import list_all_lexers
> # or something similar, check the docs.
>
> Iterate over the return value and format them as you like.
To be more precise: the function is called pygments.lexers.get_all_lexers()
and returns an iterator. A command-line call would look like this:
python -c "import pygments.lexers as pl; print '\n'.join('\n'.join(l[1]) for l
in pl.get_all_lexers())"
if you want to find out all aliases usable for get_lexer(), or
python -c "import pygments.lexers as pl; print '\n'.join(l[0] for l in
pl.get_all_lexers())"
if you want to find out all lexer names.
cheers,
Georg
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pocoo-libs?hl=en.