Skip to content

Commit

Permalink
update pygments by rake vendor:update
Browse files Browse the repository at this point in the history
  • Loading branch information
gfx committed Sep 13, 2017
1 parent f432153 commit b3eeeff
Show file tree
Hide file tree
Showing 223 changed files with 1,238 additions and 828 deletions.
2 changes: 2 additions & 0 deletions vendor/pygments-main/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ Other contributors, listed alphabetically, are:
* Dominik Picheta -- Nimrod lexer
* Andrew Pinkham -- RTF Formatter Refactoring
* Clément Prévost -- UrbiScript lexer
* Tanner Prynn -- cmdline -x option and loading lexers from files
* Oleh Prypin -- Crystal lexer (based on Ruby lexer)
* Elias Rabel -- Fortran fixed form lexer
* raichoo -- Idris lexer
Expand All @@ -173,6 +174,7 @@ Other contributors, listed alphabetically, are:
* Matteo Sasso -- Common Lisp lexer
* Joe Schafer -- Ada lexer
* Ken Schutte -- Matlab lexers
* René Schwaiger -- Rainbow Dash style
* Sebastian Schweizer -- Whiley lexer
* Tassilo Schweyer -- Io, MOOCode lexers
* Ted Shaw -- AutoIt lexer
Expand Down
31 changes: 27 additions & 4 deletions vendor/pygments-main/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Issue numbers refer to the tracker at
pull request numbers to the requests at
<https://bitbucket.org/birkenfeld/pygments-main/pull-requests/merged>.

Version 2.2
-----------
(in development)
Version 2.2.0
-------------
(release Jan 22, 2017)

- Added lexers:

Expand All @@ -24,6 +24,17 @@ Version 2.2
* NCAR command language (PR#536)
* Extempore (PR#530)
* Cap'n Proto (PR#595)
* Whiley (PR#573)
* Monte (PR#592)
* Crystal (PR#576)
* Snowball (PR#589)
* CapDL (PR#579)
* NuSMV (PR#564)
* SAS, Stata (PR#593)

- Added the ability to load lexer and formatter classes directly from files
with the `-x` command line option and the `lexers.load_lexer_from_file()`
and `formatters.load_formatter_from_file()` functions. (PR#559)

- Added `lexers.find_lexer_class_by_name()`. (#1203)

Expand All @@ -41,12 +52,24 @@ Version 2.2

- Improved the CSS lexer. (#1083, #1130)

- Added "Rainbow Dash" style. (PR#623)

- Delay loading `pkg_resources`, which takes a long while to import. (PR#690)


Version 2.1.3
-------------
(released Mar 2, 2016)

- Fixed regression in Bash lexer (PR#563)


Version 2.1.2
-------------
(in development)
(released Feb 29, 2016)

- Fixed Python 3 regression in image formatter (#1215)
- Fixed regression in Bash lexer (PR#562)


Version 2.1.1
Expand Down
2 changes: 1 addition & 1 deletion vendor/pygments-main/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2006-2015 by the respective authors (see AUTHORS file).
Copyright (c) 2006-2017 by the respective authors (see AUTHORS file).
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion vendor/pygments-main/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include pygmentize
include external/*
include Makefile CHANGES LICENSE AUTHORS TODO ez_setup.py
include Makefile CHANGES LICENSE AUTHORS TODO
recursive-include tests *
recursive-include doc *
recursive-include scripts *
2 changes: 1 addition & 1 deletion vendor/pygments-main/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Combines scripts for common tasks.
#
# :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
# :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
# :license: BSD, see LICENSE for details.
#

Expand Down
2 changes: 1 addition & 1 deletion vendor/pygments-main/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a042025b350c
7941677dc77d
2 changes: 1 addition & 1 deletion vendor/pygments-main/doc/_themes/pygments14/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

{% block footer %}
<div class="footer" role="contentinfo">
&copy; Copyright 2006-2015, Georg Brandl and Pygments contributors.
&copy; Copyright 2006-2017, Georg Brandl and Pygments contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> {{
sphinx_version }}. <br/>
Pygments logo created by <a href="http://joelunger.com">Joel Unger</a>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- pygments14 theme. Heavily copied from sphinx13.
*
* :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
* :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down
23 changes: 23 additions & 0 deletions vendor/pygments-main/doc/docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ Functions from :mod:`pygments.lexers`:
Will raise :exc:`pygments.util.ClassNotFound` if not lexer for that mimetype
is found.

.. function:: load_lexer_from_file(filename, lexername="CustomLexer", **options)

Return a `Lexer` subclass instance loaded from the provided file, relative
to the current directory. The file is expected to contain a Lexer class
named `lexername` (by default, CustomLexer). Users should be very careful with
the input, because this method is equivalent to running eval on the input file.
The lexer is given the `options` at its instantiation.

:exc:`ClassNotFound` is raised if there are any errors loading the Lexer

.. versionadded:: 2.2

.. function:: guess_lexer(text, **options)

Return a `Lexer` subclass instance that's guessed from the text in
Expand Down Expand Up @@ -125,6 +137,17 @@ Functions from :mod:`pygments.formatters`:
Will raise :exc:`pygments.util.ClassNotFound` if no formatter for that filename
is found.

.. function:: load_formatter_from_file(filename, formattername="CustomFormatter", **options)

Return a `Formatter` subclass instance loaded from the provided file, relative
to the current directory. The file is expected to contain a Formatter class
named ``formattername`` (by default, CustomFormatter). Users should be very
careful with the input, because this method is equivalent to running eval
on the input file. The formatter is given the `options` at its instantiation.

:exc:`ClassNotFound` is raised if there are any errors loading the Formatter

.. versionadded:: 2.2

.. module:: pygments.styles

Expand Down
17 changes: 17 additions & 0 deletions vendor/pygments-main/doc/docs/cmdline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,23 @@ The ``-N`` option guesses a lexer name for a given filename, so that ::
will print out ``python``. It won't highlight anything yet. If no specific
lexer is known for that filename, ``text`` is printed.

Custom Lexers and Formatters
----------------------------

.. versionadded:: 2.2

The ``-x`` flag enables custom lexers and formatters to be loaded
from files relative to the current directory. Create a file with a class named
CustomLexer or CustomFormatter, then specify it on the command line::

$ pygmentize -l your_lexer.py -f your_formatter.py -x

You can also specify the name of your class with a colon::

$ pygmentize -l your_lexer.py:SomeLexer -x

For more information, see :doc:`the Pygments documentation on Lexer development
<lexerdevelopment>`.

Getting help
------------
Expand Down
45 changes: 42 additions & 3 deletions vendor/pygments-main/doc/docs/lexerdevelopment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,47 @@ one.
Adding and testing a new lexer
==============================

Using a lexer that is not part of Pygments can be done via the Python API. You
can import and instantiate the lexer, and pass it to :func:`pygments.highlight`.
The easiest way to use a new lexer is to use Pygments' support for loading
the lexer from a file relative to your current directory.

First, change the name of your lexer class to CustomLexer:

.. code-block:: python
from pygments.lexer import RegexLexer
from pygments.token import *
class CustomLexer(RegexLexer):
"""All your lexer code goes here!"""
Then you can load the lexer from the command line with the additional
flag ``-x``:

.. code-block:: console
$ pygmentize -l your_lexer_file.py -x
To specify a class name other than CustomLexer, append it with a colon:

.. code-block:: console
$ pygmentize -l your_lexer.py:SomeLexer -x
Or, using the Python API:

.. code-block:: python
# For a lexer named CustomLexer
your_lexer = load_lexer_from_file(filename, **options)
# For a lexer named MyNewLexer
your_named_lexer = load_lexer_from_file(filename, "MyNewLexer", **options)
When loading custom lexers and formatters, be extremely careful to use only
trusted files; Pygments will perform the equivalent of ``eval`` on them.

If you only want to use your lexer with the Pygments API, you can import and
instantiate the lexer yourself, then pass it to :func:`pygments.highlight`.

To prepare your new lexer for inclusion in the Pygments distribution, so that it
will be found when passing filenames or lexer aliases from the command line, you
Expand Down Expand Up @@ -361,7 +400,7 @@ There are a few more things you can do with states:
tokens = {...}

def get_tokens_unprocessed(self, text, stack=('root', 'otherstate')):
for item in RegexLexer.get_tokens_unprocessed(text, stack):
for item in RegexLexer.get_tokens_unprocessed(self, text, stack):
yield item

Some lexers like the `PhpLexer` use this to make the leading ``<?php``
Expand Down
39 changes: 28 additions & 11 deletions vendor/pygments-main/external/autopygmentize
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# Best effort auto-pygmentization with transparent decompression
# by Reuben Thomas 2008-2015
# by Reuben Thomas 2008-2016
# This program is in the public domain.

# Strategy: first see if pygmentize can find a lexer; if not, ask file; if that finds nothing, fail
Expand All @@ -25,6 +25,7 @@ if [[ "$lexer" == text ]]; then
text/x-awk) lexer=awk;;
text/x-c) lexer=c;;
text/x-c++) lexer=cpp;;
text/x-crystal) lexer=crystal;;
text/x-diff) lexer=diff;;
text/x-fortran) lexer=fortran;;
text/x-gawk) lexer=gawk;;
Expand All @@ -40,7 +41,6 @@ if [[ "$lexer" == text ]]; then
text/x-po) lexer=po;;
text/x-python) lexer=python;;
text/x-ruby) lexer=ruby;;
text/x-crystal) lexer=crystal;;
text/x-shellscript) lexer=sh;;
text/x-tcl) lexer=tcl;;
text/x-tex|text/x-texinfo) lexer=latex;; # FIXME: texinfo really needs its own lexer
Expand All @@ -66,19 +66,36 @@ if [[ "$lexer" == text ]]; then
esac
fi

# Find a preprocessor for compressed files
concat=cat
case $(file $file_common_opts --mime-type "$file") in
application/x-gzip) concat=zcat;;
application/x-bzip2) concat=bzcat;;
application/x-xz) concat=xzcat;;
esac

# Find a suitable lexer, preceded by a hex dump for binary files
prereader=""
encoding=$(file --mime-encoding --uncompress $file_common_opts "$file")
if [[ $encoding == "binary" ]]; then
encoding="latin1"
prereader="od -x" # POSIX fallback
if [[ -n $(which hd) ]]; then
prereader="hd" # preferred
fi
lexer=hexdump
encoding=latin1
fi

if [[ -n "$lexer" ]]; then
concat=cat
case $(file $file_common_opts --mime-type "$file") in
application/x-gzip) concat=zcat;;
application/x-bzip2) concat=bzcat;;
application/x-xz) concat=xzcat;;
esac
exec $concat "$file" | pygmentize -O inencoding=$encoding $PYGMENTIZE_OPTS $options -l $lexer
reader="pygmentize -O inencoding=$encoding $PYGMENTIZE_OPTS $options -l $lexer"
fi

# If we found a reader, run it
if [[ -n "$reader" ]]; then
if [[ -n "$prereader" ]]; then
exec $concat "$file" | $prereader | $reader
else
exec $concat "$file" | $reader
fi
fi

exit 1
2 changes: 1 addition & 1 deletion vendor/pygments-main/external/markdown-processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
.. _Markdown: https://pypi.python.org/pypi/Markdown
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

Expand Down
2 changes: 1 addition & 1 deletion vendor/pygments-main/external/moin-parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
If you do not want to do that and are willing to accept larger HTML
output, you can set the INLINESTYLES option below to True.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

Expand Down
2 changes: 1 addition & 1 deletion vendor/pygments-main/external/rst-directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
.. _directive documentation:
http://docutils.sourceforge.net/docs/howto/rst-directives.html
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

Expand Down
4 changes: 2 additions & 2 deletions vendor/pygments-main/pygments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
.. _Pygments tip:
http://bitbucket.org/birkenfeld/pygments-main/get/tip.zip#egg=Pygments-dev
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys

from pygments.util import StringIO, BytesIO

__version__ = '2.2a0'
__version__ = '2.2.0'
__docformat__ = 'restructuredtext'

__all__ = ['lex', 'format', 'highlight']
Expand Down
Loading

0 comments on commit b3eeeff

Please sign in to comment.