pygments.rb 1.2.1 → 2.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/dependabot.yml +13 -0
- data/.github/workflows/ci.yml +28 -0
- data/.github/workflows/release.yml +24 -0
- data/.gitignore +5 -6
- data/CHANGELOG.adoc +119 -0
- data/Gemfile +3 -1
- data/LICENSE +1 -1
- data/README.adoc +161 -0
- data/Rakefile +10 -21
- data/bench.rb +8 -7
- data/cache-lexers.rb +3 -2
- data/lib/pygments.rb +10 -11
- data/lib/pygments/lexer.rb +5 -5
- data/lib/pygments/mentos.py +23 -66
- data/lib/pygments/popen.rb +152 -204
- data/lib/pygments/version.rb +2 -2
- data/pygments.rb.gemspec +11 -9
- data/test/test_pygments.rb +51 -84
- data/vendor/pygments-main/{AUTHORS → Pygments-2.7.3.dist-info/AUTHORS} +21 -3
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/INSTALLER +1 -0
- data/vendor/pygments-main/{LICENSE → Pygments-2.7.3.dist-info/LICENSE} +1 -1
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/METADATA +49 -0
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/RECORD +482 -0
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/REQUESTED +0 -0
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/WHEEL +5 -0
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/entry_points.txt +3 -0
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/top_level.txt +1 -0
- data/vendor/pygments-main/bin/pygmentize +8 -0
- data/vendor/pygments-main/pygments/__init__.py +6 -11
- data/vendor/pygments-main/pygments/__main__.py +18 -0
- data/vendor/pygments-main/pygments/cmdline.py +38 -29
- data/vendor/pygments-main/pygments/console.py +6 -9
- data/vendor/pygments-main/pygments/filter.py +4 -6
- data/vendor/pygments-main/pygments/filters/__init__.py +609 -21
- data/vendor/pygments-main/pygments/formatter.py +4 -4
- data/vendor/pygments-main/pygments/formatters/__init__.py +9 -8
- data/vendor/pygments-main/pygments/formatters/_mapping.py +1 -3
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/html.py +223 -135
- data/vendor/pygments-main/pygments/formatters/img.py +68 -41
- data/vendor/pygments-main/pygments/formatters/irc.py +39 -39
- data/vendor/pygments-main/pygments/formatters/latex.py +56 -26
- data/vendor/pygments-main/pygments/formatters/other.py +12 -8
- data/vendor/pygments-main/pygments/formatters/rtf.py +29 -29
- data/vendor/pygments-main/pygments/formatters/svg.py +38 -4
- data/vendor/pygments-main/pygments/formatters/terminal.py +25 -31
- data/vendor/pygments-main/pygments/formatters/terminal256.py +22 -12
- data/vendor/pygments-main/pygments/lexer.py +41 -39
- data/vendor/pygments-main/pygments/lexers/__init__.py +342 -0
- data/vendor/pygments-main/pygments/lexers/_asy_builtins.py +1645 -0
- data/vendor/pygments-main/pygments/lexers/_cl_builtins.py +232 -0
- data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +71 -0
- data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +1725 -0
- data/vendor/pygments-main/pygments/lexers/_lasso_builtins.py +5327 -0
- data/vendor/pygments-main/pygments/lexers/_lua_builtins.py +293 -0
- data/vendor/pygments-main/pygments/lexers/_mapping.py +551 -0
- data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1172 -0
- data/vendor/pygments-main/pygments/lexers/_mysql_builtins.py +1282 -0
- data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +2547 -0
- data/vendor/pygments-main/pygments/lexers/_php_builtins.py +4753 -0
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +678 -0
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +3094 -0
- data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +1161 -0
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +558 -0
- data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +421 -0
- data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1004 -0
- data/vendor/pygments-main/pygments/lexers/_usd_builtins.py +113 -0
- data/vendor/pygments-main/pygments/lexers/_vbscript_builtins.py +280 -0
- data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1939 -0
- data/vendor/pygments-main/pygments/lexers/actionscript.py +245 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +24 -0
- data/vendor/pygments-main/pygments/lexers/algebra.py +240 -0
- data/vendor/pygments-main/pygments/lexers/ambient.py +76 -0
- data/vendor/pygments-main/pygments/lexers/ampl.py +87 -0
- data/vendor/pygments-main/pygments/lexers/apl.py +101 -0
- data/vendor/pygments-main/pygments/lexers/archetype.py +318 -0
- data/vendor/pygments-main/pygments/lexers/arrow.py +117 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +1005 -0
- data/vendor/pygments-main/pygments/lexers/automation.py +374 -0
- data/vendor/pygments-main/pygments/lexers/bare.py +104 -0
- data/vendor/pygments-main/pygments/lexers/basic.py +662 -0
- data/vendor/pygments-main/pygments/lexers/bibtex.py +160 -0
- data/vendor/pygments-main/pygments/lexers/boa.py +102 -0
- data/vendor/pygments-main/pygments/lexers/business.py +627 -0
- data/vendor/pygments-main/pygments/lexers/c_cpp.py +344 -0
- data/vendor/pygments-main/pygments/lexers/c_like.py +566 -0
- data/vendor/pygments-main/pygments/lexers/capnproto.py +78 -0
- data/vendor/pygments-main/pygments/lexers/chapel.py +112 -0
- data/vendor/pygments-main/pygments/lexers/clean.py +179 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +34 -0
- data/vendor/pygments-main/pygments/lexers/configs.py +984 -0
- data/vendor/pygments-main/pygments/lexers/console.py +114 -0
- data/vendor/pygments-main/pygments/lexers/crystal.py +392 -0
- data/vendor/pygments-main/pygments/lexers/csound.py +467 -0
- data/vendor/pygments-main/pygments/lexers/css.py +691 -0
- data/vendor/pygments-main/pygments/lexers/d.py +256 -0
- data/vendor/pygments-main/pygments/lexers/dalvik.py +125 -0
- data/vendor/pygments-main/pygments/lexers/data.py +698 -0
- data/vendor/pygments-main/pygments/lexers/devicetree.py +109 -0
- data/vendor/pygments-main/pygments/lexers/diff.py +165 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +707 -0
- data/vendor/pygments-main/pygments/lexers/dsls.py +960 -0
- data/vendor/pygments-main/pygments/lexers/dylan.py +287 -0
- data/vendor/pygments-main/pygments/lexers/ecl.py +139 -0
- data/vendor/pygments-main/pygments/lexers/eiffel.py +65 -0
- data/vendor/pygments-main/pygments/lexers/elm.py +121 -0
- data/vendor/pygments-main/pygments/lexers/email.py +151 -0
- data/vendor/pygments-main/pygments/lexers/erlang.py +530 -0
- data/vendor/pygments-main/pygments/lexers/esoteric.py +304 -0
- data/vendor/pygments-main/pygments/lexers/ezhil.py +77 -0
- data/vendor/pygments-main/pygments/lexers/factor.py +344 -0
- data/vendor/pygments-main/pygments/lexers/fantom.py +250 -0
- data/vendor/pygments-main/pygments/lexers/felix.py +273 -0
- data/vendor/pygments-main/pygments/lexers/floscript.py +83 -0
- data/vendor/pygments-main/pygments/lexers/forth.py +178 -0
- data/vendor/pygments-main/pygments/lexers/fortran.py +206 -0
- data/vendor/pygments-main/pygments/lexers/foxpro.py +428 -0
- data/vendor/pygments-main/pygments/lexers/freefem.py +898 -0
- data/vendor/pygments-main/pygments/lexers/functional.py +21 -0
- data/vendor/pygments-main/pygments/lexers/gdscript.py +346 -0
- data/vendor/pygments-main/pygments/lexers/go.py +101 -0
- data/vendor/pygments-main/pygments/lexers/grammar_notation.py +270 -0
- data/vendor/pygments-main/pygments/lexers/graph.py +85 -0
- data/vendor/pygments-main/pygments/lexers/graphics.py +800 -0
- data/vendor/pygments-main/pygments/lexers/haskell.py +870 -0
- data/vendor/pygments-main/pygments/lexers/haxe.py +936 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +472 -0
- data/vendor/pygments-main/pygments/lexers/hexdump.py +103 -0
- data/vendor/pygments-main/pygments/lexers/html.py +614 -0
- data/vendor/pygments-main/pygments/lexers/idl.py +281 -0
- data/vendor/pygments-main/pygments/lexers/igor.py +420 -0
- data/vendor/pygments-main/pygments/lexers/inferno.py +96 -0
- data/vendor/pygments-main/pygments/lexers/installers.py +322 -0
- data/vendor/pygments-main/pygments/lexers/int_fiction.py +1368 -0
- data/vendor/pygments-main/pygments/lexers/iolang.py +63 -0
- data/vendor/pygments-main/pygments/lexers/j.py +146 -0
- data/vendor/pygments-main/pygments/lexers/javascript.py +1540 -0
- data/vendor/pygments-main/pygments/lexers/julia.py +331 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +1673 -0
- data/vendor/pygments-main/pygments/lexers/lisp.py +2699 -0
- data/vendor/pygments-main/pygments/lexers/make.py +206 -0
- data/vendor/pygments-main/pygments/lexers/markup.py +765 -0
- data/vendor/pygments-main/pygments/lexers/math.py +21 -0
- data/vendor/pygments-main/pygments/lexers/matlab.py +720 -0
- data/vendor/pygments-main/pygments/lexers/mime.py +226 -0
- data/vendor/pygments-main/pygments/lexers/ml.py +958 -0
- data/vendor/pygments-main/pygments/lexers/modeling.py +366 -0
- data/vendor/pygments-main/pygments/lexers/modula2.py +1580 -0
- data/vendor/pygments-main/pygments/lexers/monte.py +204 -0
- data/vendor/pygments-main/pygments/lexers/mosel.py +448 -0
- data/vendor/pygments-main/pygments/lexers/ncl.py +894 -0
- data/vendor/pygments-main/pygments/lexers/nimrod.py +159 -0
- data/vendor/pygments-main/pygments/lexers/nit.py +64 -0
- data/vendor/pygments-main/pygments/lexers/nix.py +136 -0
- data/vendor/pygments-main/pygments/lexers/oberon.py +121 -0
- data/vendor/pygments-main/pygments/lexers/objective.py +504 -0
- data/vendor/pygments-main/pygments/lexers/ooc.py +85 -0
- data/vendor/pygments-main/pygments/lexers/other.py +41 -0
- data/vendor/pygments-main/pygments/lexers/parasail.py +79 -0
- data/vendor/pygments-main/pygments/lexers/parsers.py +800 -0
- data/vendor/pygments-main/pygments/lexers/pascal.py +644 -0
- data/vendor/pygments-main/pygments/lexers/pawn.py +205 -0
- data/vendor/pygments-main/pygments/lexers/perl.py +732 -0
- data/vendor/pygments-main/pygments/lexers/php.py +321 -0
- data/vendor/pygments-main/pygments/lexers/pointless.py +71 -0
- data/vendor/pygments-main/pygments/lexers/pony.py +94 -0
- data/vendor/pygments-main/pygments/lexers/praat.py +302 -0
- data/vendor/pygments-main/pygments/lexers/prolog.py +306 -0
- data/vendor/pygments-main/pygments/lexers/promql.py +183 -0
- data/vendor/pygments-main/pygments/lexers/python.py +1151 -0
- data/vendor/pygments-main/pygments/lexers/qvt.py +152 -0
- data/vendor/pygments-main/pygments/lexers/r.py +191 -0
- data/vendor/pygments-main/pygments/lexers/rdf.py +463 -0
- data/vendor/pygments-main/pygments/lexers/rebol.py +431 -0
- data/vendor/pygments-main/pygments/lexers/resource.py +85 -0
- data/vendor/pygments-main/pygments/lexers/ride.py +139 -0
- data/vendor/pygments-main/pygments/lexers/rnc.py +67 -0
- data/vendor/pygments-main/pygments/lexers/roboconf.py +82 -0
- data/vendor/pygments-main/pygments/lexers/robotframework.py +552 -0
- data/vendor/pygments-main/pygments/lexers/ruby.py +517 -0
- data/vendor/pygments-main/pygments/lexers/rust.py +224 -0
- data/vendor/pygments-main/pygments/lexers/sas.py +228 -0
- data/vendor/pygments-main/pygments/lexers/scdoc.py +83 -0
- data/vendor/pygments-main/pygments/lexers/scripting.py +1284 -0
- data/vendor/pygments-main/pygments/lexers/sgf.py +61 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +914 -0
- data/vendor/pygments-main/pygments/lexers/sieve.py +69 -0
- data/vendor/pygments-main/pygments/lexers/slash.py +185 -0
- data/vendor/pygments-main/pygments/lexers/smalltalk.py +195 -0
- data/vendor/pygments-main/pygments/lexers/smv.py +79 -0
- data/vendor/pygments-main/pygments/lexers/snobol.py +83 -0
- data/vendor/pygments-main/pygments/lexers/solidity.py +92 -0
- data/vendor/pygments-main/pygments/lexers/special.py +105 -0
- data/vendor/pygments-main/pygments/lexers/sql.py +837 -0
- data/vendor/pygments-main/pygments/lexers/stata.py +171 -0
- data/vendor/pygments-main/pygments/lexers/supercollider.py +95 -0
- data/vendor/pygments-main/pygments/lexers/tcl.py +145 -0
- data/vendor/pygments-main/pygments/lexers/templates.py +2264 -0
- data/vendor/pygments-main/pygments/lexers/teraterm.py +335 -0
- data/vendor/pygments-main/pygments/lexers/testing.py +207 -0
- data/vendor/pygments-main/pygments/lexers/text.py +26 -0
- data/vendor/pygments-main/pygments/lexers/textedit.py +169 -0
- data/vendor/pygments-main/pygments/lexers/textfmts.py +430 -0
- data/vendor/pygments-main/pygments/lexers/theorem.py +474 -0
- data/vendor/pygments-main/pygments/lexers/tnt.py +263 -0
- data/vendor/pygments-main/pygments/lexers/trafficscript.py +54 -0
- data/vendor/pygments-main/pygments/lexers/typoscript.py +219 -0
- data/vendor/pygments-main/pygments/lexers/unicon.py +412 -0
- data/vendor/pygments-main/pygments/lexers/urbi.py +146 -0
- data/vendor/pygments-main/pygments/lexers/usd.py +90 -0
- data/vendor/pygments-main/pygments/lexers/varnish.py +190 -0
- data/vendor/pygments-main/pygments/lexers/verification.py +114 -0
- data/vendor/pygments-main/pygments/lexers/web.py +24 -0
- data/vendor/pygments-main/pygments/lexers/webidl.py +299 -0
- data/vendor/pygments-main/pygments/lexers/webmisc.py +991 -0
- data/vendor/pygments-main/pygments/lexers/whiley.py +116 -0
- data/vendor/pygments-main/pygments/lexers/x10.py +69 -0
- data/vendor/pygments-main/pygments/lexers/xorg.py +37 -0
- data/vendor/pygments-main/pygments/lexers/yang.py +104 -0
- data/vendor/pygments-main/pygments/lexers/zig.py +124 -0
- data/vendor/pygments-main/pygments/modeline.py +1 -1
- data/vendor/pygments-main/pygments/plugin.py +4 -2
- data/vendor/pygments-main/pygments/regexopt.py +1 -1
- data/vendor/pygments-main/pygments/scanner.py +2 -2
- data/vendor/pygments-main/pygments/sphinxext.py +2 -4
- data/vendor/pygments-main/pygments/style.py +61 -24
- data/vendor/pygments-main/pygments/styles/__init__.py +10 -4
- data/vendor/pygments-main/pygments/styles/abap.py +1 -1
- data/vendor/pygments-main/pygments/styles/algol.py +1 -1
- data/vendor/pygments-main/pygments/styles/algol_nu.py +1 -1
- data/vendor/pygments-main/pygments/styles/arduino.py +2 -2
- data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
- data/vendor/pygments-main/pygments/styles/borland.py +1 -1
- data/vendor/pygments-main/pygments/styles/bw.py +1 -1
- data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
- data/vendor/pygments-main/pygments/styles/default.py +1 -1
- data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
- data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
- data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
- data/vendor/pygments-main/pygments/styles/igor.py +1 -1
- data/vendor/pygments-main/pygments/styles/inkpot.py +67 -0
- data/vendor/pygments-main/pygments/styles/lovelace.py +1 -1
- data/vendor/pygments-main/pygments/styles/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/monokai.py +4 -3
- data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
- data/vendor/pygments-main/pygments/styles/native.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_dark.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_light.py +1 -1
- data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
- data/vendor/pygments-main/pygments/styles/perldoc.py +1 -1
- data/vendor/pygments-main/pygments/styles/rainbow_dash.py +1 -1
- data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
- data/vendor/pygments-main/pygments/styles/sas.py +1 -1
- data/vendor/pygments-main/pygments/styles/solarized.py +134 -0
- data/vendor/pygments-main/pygments/styles/stata_dark.py +41 -0
- data/vendor/pygments-main/pygments/styles/{stata.py → stata_light.py} +14 -15
- data/vendor/pygments-main/pygments/styles/tango.py +1 -1
- data/vendor/pygments-main/pygments/styles/trac.py +1 -1
- data/vendor/pygments-main/pygments/styles/vim.py +1 -1
- data/vendor/pygments-main/pygments/styles/vs.py +1 -1
- data/vendor/pygments-main/pygments/styles/xcode.py +1 -1
- data/vendor/pygments-main/pygments/token.py +1 -1
- data/vendor/pygments-main/pygments/unistring.py +47 -108
- data/vendor/pygments-main/pygments/util.py +15 -92
- metadata +69 -136
- data/CHANGELOG.md +0 -111
- data/README.md +0 -121
- data/circle.yml +0 -20
- data/test/test_data.py +0 -514
- data/test/test_data_generated +0 -2582
- data/vendor/custom_lexers/github.py +0 -565
- data/vendor/pygments-main/CHANGES +0 -1186
- data/vendor/pygments-main/MANIFEST.in +0 -6
- data/vendor/pygments-main/Makefile +0 -65
- data/vendor/pygments-main/README.rst +0 -39
- data/vendor/pygments-main/REVISION +0 -1
- data/vendor/pygments-main/TODO +0 -12
- data/vendor/pygments-main/doc/Makefile +0 -153
- data/vendor/pygments-main/doc/_static/favicon.ico +0 -0
- data/vendor/pygments-main/doc/_static/logo_new.png +0 -0
- data/vendor/pygments-main/doc/_static/logo_only.png +0 -0
- data/vendor/pygments-main/doc/_templates/docssidebar.html +0 -3
- data/vendor/pygments-main/doc/_templates/indexsidebar.html +0 -25
- data/vendor/pygments-main/doc/_themes/pygments14/layout.html +0 -98
- data/vendor/pygments-main/doc/_themes/pygments14/static/bodybg.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/docbg.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/listitem.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/logo.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/pocoo.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +0 -401
- data/vendor/pygments-main/doc/_themes/pygments14/theme.conf +0 -15
- data/vendor/pygments-main/doc/conf.py +0 -241
- data/vendor/pygments-main/doc/docs/api.rst +0 -354
- data/vendor/pygments-main/doc/docs/authors.rst +0 -4
- data/vendor/pygments-main/doc/docs/changelog.rst +0 -1
- data/vendor/pygments-main/doc/docs/cmdline.rst +0 -166
- data/vendor/pygments-main/doc/docs/filterdevelopment.rst +0 -71
- data/vendor/pygments-main/doc/docs/filters.rst +0 -41
- data/vendor/pygments-main/doc/docs/formatterdevelopment.rst +0 -169
- data/vendor/pygments-main/doc/docs/formatters.rst +0 -48
- data/vendor/pygments-main/doc/docs/index.rst +0 -66
- data/vendor/pygments-main/doc/docs/integrate.rst +0 -40
- data/vendor/pygments-main/doc/docs/java.rst +0 -70
- data/vendor/pygments-main/doc/docs/lexerdevelopment.rst +0 -728
- data/vendor/pygments-main/doc/docs/lexers.rst +0 -69
- data/vendor/pygments-main/doc/docs/moinmoin.rst +0 -39
- data/vendor/pygments-main/doc/docs/plugins.rst +0 -93
- data/vendor/pygments-main/doc/docs/quickstart.rst +0 -205
- data/vendor/pygments-main/doc/docs/rstdirective.rst +0 -22
- data/vendor/pygments-main/doc/docs/styles.rst +0 -201
- data/vendor/pygments-main/doc/docs/tokens.rst +0 -372
- data/vendor/pygments-main/doc/docs/unicode.rst +0 -58
- data/vendor/pygments-main/doc/download.rst +0 -41
- data/vendor/pygments-main/doc/faq.rst +0 -139
- data/vendor/pygments-main/doc/index.rst +0 -54
- data/vendor/pygments-main/doc/languages.rst +0 -154
- data/vendor/pygments-main/doc/make.bat +0 -190
- data/vendor/pygments-main/doc/pygmentize.1 +0 -94
- data/vendor/pygments-main/external/autopygmentize +0 -101
- data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +0 -162
- data/vendor/pygments-main/external/markdown-processor.py +0 -67
- data/vendor/pygments-main/external/moin-parser.py +0 -112
- data/vendor/pygments-main/external/pygments.bashcomp +0 -38
- data/vendor/pygments-main/external/rst-directive.py +0 -82
- data/vendor/pygments-main/pygmentize +0 -8
- data/vendor/pygments-main/requirements.txt +0 -5
- data/vendor/pygments-main/scripts/check_sources.py +0 -211
- data/vendor/pygments-main/scripts/debug_lexer.py +0 -246
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +0 -33
- data/vendor/pygments-main/scripts/epydoc.css +0 -280
- data/vendor/pygments-main/scripts/get_vimkw.py +0 -74
- data/vendor/pygments-main/scripts/pylintrc +0 -301
- data/vendor/pygments-main/scripts/vim2pygments.py +0 -935
- data/vendor/pygments-main/setup.cfg +0 -10
- data/vendor/pygments-main/setup.py +0 -77
- data/vendor/pygments-main/tox.ini +0 -7
- data/vendor/simplejson/.gitignore +0 -10
- data/vendor/simplejson/.travis.yml +0 -5
- data/vendor/simplejson/CHANGES.txt +0 -291
- data/vendor/simplejson/LICENSE.txt +0 -19
- data/vendor/simplejson/MANIFEST.in +0 -5
- data/vendor/simplejson/README.rst +0 -19
- data/vendor/simplejson/conf.py +0 -179
- data/vendor/simplejson/index.rst +0 -628
- data/vendor/simplejson/scripts/make_docs.py +0 -18
- data/vendor/simplejson/setup.py +0 -104
- data/vendor/simplejson/simplejson/__init__.py +0 -510
- data/vendor/simplejson/simplejson/_speedups.c +0 -2745
- data/vendor/simplejson/simplejson/decoder.py +0 -425
- data/vendor/simplejson/simplejson/encoder.py +0 -567
- data/vendor/simplejson/simplejson/ordered_dict.py +0 -119
- data/vendor/simplejson/simplejson/scanner.py +0 -77
- data/vendor/simplejson/simplejson/tests/__init__.py +0 -67
- data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +0 -55
- data/vendor/simplejson/simplejson/tests/test_check_circular.py +0 -30
- data/vendor/simplejson/simplejson/tests/test_decimal.py +0 -66
- data/vendor/simplejson/simplejson/tests/test_decode.py +0 -83
- data/vendor/simplejson/simplejson/tests/test_default.py +0 -9
- data/vendor/simplejson/simplejson/tests/test_dump.py +0 -67
- data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +0 -46
- data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +0 -32
- data/vendor/simplejson/simplejson/tests/test_errors.py +0 -34
- data/vendor/simplejson/simplejson/tests/test_fail.py +0 -91
- data/vendor/simplejson/simplejson/tests/test_float.py +0 -19
- data/vendor/simplejson/simplejson/tests/test_indent.py +0 -86
- data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +0 -20
- data/vendor/simplejson/simplejson/tests/test_namedtuple.py +0 -121
- data/vendor/simplejson/simplejson/tests/test_pass1.py +0 -76
- data/vendor/simplejson/simplejson/tests/test_pass2.py +0 -14
- data/vendor/simplejson/simplejson/tests/test_pass3.py +0 -20
- data/vendor/simplejson/simplejson/tests/test_recursion.py +0 -67
- data/vendor/simplejson/simplejson/tests/test_scanstring.py +0 -117
- data/vendor/simplejson/simplejson/tests/test_separators.py +0 -42
- data/vendor/simplejson/simplejson/tests/test_speedups.py +0 -20
- data/vendor/simplejson/simplejson/tests/test_tuple.py +0 -49
- data/vendor/simplejson/simplejson/tests/test_unicode.py +0 -109
- data/vendor/simplejson/simplejson/tool.py +0 -39
@@ -1 +0,0 @@
|
|
1
|
-
.. include:: ../../CHANGES
|
@@ -1,166 +0,0 @@
|
|
1
|
-
.. -*- mode: rst -*-
|
2
|
-
|
3
|
-
======================
|
4
|
-
Command Line Interface
|
5
|
-
======================
|
6
|
-
|
7
|
-
You can use Pygments from the shell, provided you installed the
|
8
|
-
:program:`pygmentize` script::
|
9
|
-
|
10
|
-
$ pygmentize test.py
|
11
|
-
print "Hello World"
|
12
|
-
|
13
|
-
will print the file test.py to standard output, using the Python lexer
|
14
|
-
(inferred from the file name extension) and the terminal formatter (because
|
15
|
-
you didn't give an explicit formatter name).
|
16
|
-
|
17
|
-
If you want HTML output::
|
18
|
-
|
19
|
-
$ pygmentize -f html -l python -o test.html test.py
|
20
|
-
|
21
|
-
As you can see, the -l option explicitly selects a lexer. As seen above, if you
|
22
|
-
give an input file name and it has an extension that Pygments recognizes, you can
|
23
|
-
omit this option.
|
24
|
-
|
25
|
-
The ``-o`` option gives an output file name. If it is not given, output is
|
26
|
-
written to stdout.
|
27
|
-
|
28
|
-
The ``-f`` option selects a formatter (as with ``-l``, it can also be omitted
|
29
|
-
if an output file name is given and has a supported extension).
|
30
|
-
If no output file name is given and ``-f`` is omitted, the
|
31
|
-
:class:`.TerminalFormatter` is used.
|
32
|
-
|
33
|
-
The above command could therefore also be given as::
|
34
|
-
|
35
|
-
$ pygmentize -o test.html test.py
|
36
|
-
|
37
|
-
To create a full HTML document, including line numbers and stylesheet (using the
|
38
|
-
"emacs" style), highlighting the Python file ``test.py`` to ``test.html``::
|
39
|
-
|
40
|
-
$ pygmentize -O full,style=emacs -o test.html test.py
|
41
|
-
|
42
|
-
|
43
|
-
Options and filters
|
44
|
-
-------------------
|
45
|
-
|
46
|
-
Lexer and formatter options can be given using the ``-O`` option::
|
47
|
-
|
48
|
-
$ pygmentize -f html -O style=colorful,linenos=1 -l python test.py
|
49
|
-
|
50
|
-
Be sure to enclose the option string in quotes if it contains any special shell
|
51
|
-
characters, such as spaces or expansion wildcards like ``*``. If an option
|
52
|
-
expects a list value, separate the list entries with spaces (you'll have to
|
53
|
-
quote the option value in this case too, so that the shell doesn't split it).
|
54
|
-
|
55
|
-
Since the ``-O`` option argument is split at commas and expects the split values
|
56
|
-
to be of the form ``name=value``, you can't give an option value that contains
|
57
|
-
commas or equals signs. Therefore, an option ``-P`` is provided (as of Pygments
|
58
|
-
0.9) that works like ``-O`` but can only pass one option per ``-P``. Its value
|
59
|
-
can then contain all characters::
|
60
|
-
|
61
|
-
$ pygmentize -P "heading=Pygments, the Python highlighter" ...
|
62
|
-
|
63
|
-
Filters are added to the token stream using the ``-F`` option::
|
64
|
-
|
65
|
-
$ pygmentize -f html -l pascal -F keywordcase:case=upper main.pas
|
66
|
-
|
67
|
-
As you see, options for the filter are given after a colon. As for ``-O``, the
|
68
|
-
filter name and options must be one shell word, so there may not be any spaces
|
69
|
-
around the colon.
|
70
|
-
|
71
|
-
|
72
|
-
Generating styles
|
73
|
-
-----------------
|
74
|
-
|
75
|
-
Formatters normally don't output full style information. For example, the HTML
|
76
|
-
formatter by default only outputs ``<span>`` tags with ``class`` attributes.
|
77
|
-
Therefore, there's a special ``-S`` option for generating style definitions.
|
78
|
-
Usage is as follows::
|
79
|
-
|
80
|
-
$ pygmentize -f html -S colorful -a .syntax
|
81
|
-
|
82
|
-
generates a CSS style sheet (because you selected the HTML formatter) for
|
83
|
-
the "colorful" style prepending a ".syntax" selector to all style rules.
|
84
|
-
|
85
|
-
For an explanation what ``-a`` means for :doc:`a particular formatter
|
86
|
-
<formatters>`, look for the `arg` argument for the formatter's
|
87
|
-
:meth:`.get_style_defs()` method.
|
88
|
-
|
89
|
-
|
90
|
-
Getting lexer names
|
91
|
-
-------------------
|
92
|
-
|
93
|
-
.. versionadded:: 1.0
|
94
|
-
|
95
|
-
The ``-N`` option guesses a lexer name for a given filename, so that ::
|
96
|
-
|
97
|
-
$ pygmentize -N setup.py
|
98
|
-
|
99
|
-
will print out ``python``. It won't highlight anything yet. If no specific
|
100
|
-
lexer is known for that filename, ``text`` is printed.
|
101
|
-
|
102
|
-
Custom Lexers and Formatters
|
103
|
-
----------------------------
|
104
|
-
|
105
|
-
.. versionadded:: 2.2
|
106
|
-
|
107
|
-
The ``-x`` flag enables custom lexers and formatters to be loaded
|
108
|
-
from files relative to the current directory. Create a file with a class named
|
109
|
-
CustomLexer or CustomFormatter, then specify it on the command line::
|
110
|
-
|
111
|
-
$ pygmentize -l your_lexer.py -f your_formatter.py -x
|
112
|
-
|
113
|
-
You can also specify the name of your class with a colon::
|
114
|
-
|
115
|
-
$ pygmentize -l your_lexer.py:SomeLexer -x
|
116
|
-
|
117
|
-
For more information, see :doc:`the Pygments documentation on Lexer development
|
118
|
-
<lexerdevelopment>`.
|
119
|
-
|
120
|
-
Getting help
|
121
|
-
------------
|
122
|
-
|
123
|
-
The ``-L`` option lists lexers, formatters, along with their short
|
124
|
-
names and supported file name extensions, styles and filters. If you want to see
|
125
|
-
only one category, give it as an argument::
|
126
|
-
|
127
|
-
$ pygmentize -L filters
|
128
|
-
|
129
|
-
will list only all installed filters.
|
130
|
-
|
131
|
-
The ``-H`` option will give you detailed information (the same that can be found
|
132
|
-
in this documentation) about a lexer, formatter or filter. Usage is as follows::
|
133
|
-
|
134
|
-
$ pygmentize -H formatter html
|
135
|
-
|
136
|
-
will print the help for the HTML formatter, while ::
|
137
|
-
|
138
|
-
$ pygmentize -H lexer python
|
139
|
-
|
140
|
-
will print the help for the Python lexer, etc.
|
141
|
-
|
142
|
-
|
143
|
-
A note on encodings
|
144
|
-
-------------------
|
145
|
-
|
146
|
-
.. versionadded:: 0.9
|
147
|
-
|
148
|
-
Pygments tries to be smart regarding encodings in the formatting process:
|
149
|
-
|
150
|
-
* If you give an ``encoding`` option, it will be used as the input and
|
151
|
-
output encoding.
|
152
|
-
|
153
|
-
* If you give an ``outencoding`` option, it will override ``encoding``
|
154
|
-
as the output encoding.
|
155
|
-
|
156
|
-
* If you give an ``inencoding`` option, it will override ``encoding``
|
157
|
-
as the input encoding.
|
158
|
-
|
159
|
-
* If you don't give an encoding and have given an output file, the default
|
160
|
-
encoding for lexer and formatter is the terminal encoding or the default
|
161
|
-
locale encoding of the system. As a last resort, ``latin1`` is used (which
|
162
|
-
will pass through all non-ASCII characters).
|
163
|
-
|
164
|
-
* If you don't give an encoding and haven't given an output file (that means
|
165
|
-
output is written to the console), the default encoding for lexer and
|
166
|
-
formatter is the terminal encoding (``sys.stdout.encoding``).
|
@@ -1,71 +0,0 @@
|
|
1
|
-
.. -*- mode: rst -*-
|
2
|
-
|
3
|
-
=====================
|
4
|
-
Write your own filter
|
5
|
-
=====================
|
6
|
-
|
7
|
-
.. versionadded:: 0.7
|
8
|
-
|
9
|
-
Writing own filters is very easy. All you have to do is to subclass
|
10
|
-
the `Filter` class and override the `filter` method. Additionally a
|
11
|
-
filter is instantiated with some keyword arguments you can use to
|
12
|
-
adjust the behavior of your filter.
|
13
|
-
|
14
|
-
|
15
|
-
Subclassing Filters
|
16
|
-
===================
|
17
|
-
|
18
|
-
As an example, we write a filter that converts all `Name.Function` tokens
|
19
|
-
to normal `Name` tokens to make the output less colorful.
|
20
|
-
|
21
|
-
.. sourcecode:: python
|
22
|
-
|
23
|
-
from pygments.util import get_bool_opt
|
24
|
-
from pygments.token import Name
|
25
|
-
from pygments.filter import Filter
|
26
|
-
|
27
|
-
class UncolorFilter(Filter):
|
28
|
-
|
29
|
-
def __init__(self, **options):
|
30
|
-
Filter.__init__(self, **options)
|
31
|
-
self.class_too = get_bool_opt(options, 'classtoo')
|
32
|
-
|
33
|
-
def filter(self, lexer, stream):
|
34
|
-
for ttype, value in stream:
|
35
|
-
if ttype is Name.Function or (self.class_too and
|
36
|
-
ttype is Name.Class):
|
37
|
-
ttype = Name
|
38
|
-
yield ttype, value
|
39
|
-
|
40
|
-
Some notes on the `lexer` argument: that can be quite confusing since it doesn't
|
41
|
-
need to be a lexer instance. If a filter was added by using the `add_filter()`
|
42
|
-
function of lexers, that lexer is registered for the filter. In that case
|
43
|
-
`lexer` will refer to the lexer that has registered the filter. It *can* be used
|
44
|
-
to access options passed to a lexer. Because it could be `None` you always have
|
45
|
-
to check for that case if you access it.
|
46
|
-
|
47
|
-
|
48
|
-
Using a decorator
|
49
|
-
=================
|
50
|
-
|
51
|
-
You can also use the `simplefilter` decorator from the `pygments.filter` module:
|
52
|
-
|
53
|
-
.. sourcecode:: python
|
54
|
-
|
55
|
-
from pygments.util import get_bool_opt
|
56
|
-
from pygments.token import Name
|
57
|
-
from pygments.filter import simplefilter
|
58
|
-
|
59
|
-
|
60
|
-
@simplefilter
|
61
|
-
def uncolor(self, lexer, stream, options):
|
62
|
-
class_too = get_bool_opt(options, 'classtoo')
|
63
|
-
for ttype, value in stream:
|
64
|
-
if ttype is Name.Function or (class_too and
|
65
|
-
ttype is Name.Class):
|
66
|
-
ttype = Name
|
67
|
-
yield ttype, value
|
68
|
-
|
69
|
-
The decorator automatically subclasses an internal filter class and uses the
|
70
|
-
decorated function as a method for filtering. (That's why there is a `self`
|
71
|
-
argument that you probably won't end up using in the method.)
|
@@ -1,41 +0,0 @@
|
|
1
|
-
.. -*- mode: rst -*-
|
2
|
-
|
3
|
-
=======
|
4
|
-
Filters
|
5
|
-
=======
|
6
|
-
|
7
|
-
.. versionadded:: 0.7
|
8
|
-
|
9
|
-
You can filter token streams coming from lexers to improve or annotate the
|
10
|
-
output. For example, you can highlight special words in comments, convert
|
11
|
-
keywords to upper or lowercase to enforce a style guide etc.
|
12
|
-
|
13
|
-
To apply a filter, you can use the `add_filter()` method of a lexer:
|
14
|
-
|
15
|
-
.. sourcecode:: pycon
|
16
|
-
|
17
|
-
>>> from pygments.lexers import PythonLexer
|
18
|
-
>>> l = PythonLexer()
|
19
|
-
>>> # add a filter given by a string and options
|
20
|
-
>>> l.add_filter('codetagify', case='lower')
|
21
|
-
>>> l.filters
|
22
|
-
[<pygments.filters.CodeTagFilter object at 0xb785decc>]
|
23
|
-
>>> from pygments.filters import KeywordCaseFilter
|
24
|
-
>>> # or give an instance
|
25
|
-
>>> l.add_filter(KeywordCaseFilter(case='lower'))
|
26
|
-
|
27
|
-
The `add_filter()` method takes keyword arguments which are forwarded to
|
28
|
-
the constructor of the filter.
|
29
|
-
|
30
|
-
To get a list of all registered filters by name, you can use the
|
31
|
-
`get_all_filters()` function from the `pygments.filters` module that returns an
|
32
|
-
iterable for all known filters.
|
33
|
-
|
34
|
-
If you want to write your own filter, have a look at :doc:`Write your own filter
|
35
|
-
<filterdevelopment>`.
|
36
|
-
|
37
|
-
|
38
|
-
Builtin Filters
|
39
|
-
===============
|
40
|
-
|
41
|
-
.. pygmentsdoc:: filters
|
@@ -1,169 +0,0 @@
|
|
1
|
-
.. -*- mode: rst -*-
|
2
|
-
|
3
|
-
========================
|
4
|
-
Write your own formatter
|
5
|
-
========================
|
6
|
-
|
7
|
-
As well as creating :doc:`your own lexer <lexerdevelopment>`, writing a new
|
8
|
-
formatter for Pygments is easy and straightforward.
|
9
|
-
|
10
|
-
A formatter is a class that is initialized with some keyword arguments (the
|
11
|
-
formatter options) and that must provides a `format()` method.
|
12
|
-
Additionally a formatter should provide a `get_style_defs()` method that
|
13
|
-
returns the style definitions from the style in a form usable for the
|
14
|
-
formatter's output format.
|
15
|
-
|
16
|
-
|
17
|
-
Quickstart
|
18
|
-
==========
|
19
|
-
|
20
|
-
The most basic formatter shipped with Pygments is the `NullFormatter`. It just
|
21
|
-
sends the value of a token to the output stream:
|
22
|
-
|
23
|
-
.. sourcecode:: python
|
24
|
-
|
25
|
-
from pygments.formatter import Formatter
|
26
|
-
|
27
|
-
class NullFormatter(Formatter):
|
28
|
-
def format(self, tokensource, outfile):
|
29
|
-
for ttype, value in tokensource:
|
30
|
-
outfile.write(value)
|
31
|
-
|
32
|
-
As you can see, the `format()` method is passed two parameters: `tokensource`
|
33
|
-
and `outfile`. The first is an iterable of ``(token_type, value)`` tuples,
|
34
|
-
the latter a file like object with a `write()` method.
|
35
|
-
|
36
|
-
Because the formatter is that basic it doesn't overwrite the `get_style_defs()`
|
37
|
-
method.
|
38
|
-
|
39
|
-
|
40
|
-
Styles
|
41
|
-
======
|
42
|
-
|
43
|
-
Styles aren't instantiated but their metaclass provides some class functions
|
44
|
-
so that you can access the style definitions easily.
|
45
|
-
|
46
|
-
Styles are iterable and yield tuples in the form ``(ttype, d)`` where `ttype`
|
47
|
-
is a token and `d` is a dict with the following keys:
|
48
|
-
|
49
|
-
``'color'``
|
50
|
-
Hexadecimal color value (eg: ``'ff0000'`` for red) or `None` if not
|
51
|
-
defined.
|
52
|
-
|
53
|
-
``'bold'``
|
54
|
-
`True` if the value should be bold
|
55
|
-
|
56
|
-
``'italic'``
|
57
|
-
`True` if the value should be italic
|
58
|
-
|
59
|
-
``'underline'``
|
60
|
-
`True` if the value should be underlined
|
61
|
-
|
62
|
-
``'bgcolor'``
|
63
|
-
Hexadecimal color value for the background (eg: ``'eeeeeee'`` for light
|
64
|
-
gray) or `None` if not defined.
|
65
|
-
|
66
|
-
``'border'``
|
67
|
-
Hexadecimal color value for the border (eg: ``'0000aa'`` for a dark
|
68
|
-
blue) or `None` for no border.
|
69
|
-
|
70
|
-
Additional keys might appear in the future, formatters should ignore all keys
|
71
|
-
they don't support.
|
72
|
-
|
73
|
-
|
74
|
-
HTML 3.2 Formatter
|
75
|
-
==================
|
76
|
-
|
77
|
-
For an more complex example, let's implement a HTML 3.2 Formatter. We don't
|
78
|
-
use CSS but inline markup (``<u>``, ``<font>``, etc). Because this isn't good
|
79
|
-
style this formatter isn't in the standard library ;-)
|
80
|
-
|
81
|
-
.. sourcecode:: python
|
82
|
-
|
83
|
-
from pygments.formatter import Formatter
|
84
|
-
|
85
|
-
class OldHtmlFormatter(Formatter):
|
86
|
-
|
87
|
-
def __init__(self, **options):
|
88
|
-
Formatter.__init__(self, **options)
|
89
|
-
|
90
|
-
# create a dict of (start, end) tuples that wrap the
|
91
|
-
# value of a token so that we can use it in the format
|
92
|
-
# method later
|
93
|
-
self.styles = {}
|
94
|
-
|
95
|
-
# we iterate over the `_styles` attribute of a style item
|
96
|
-
# that contains the parsed style values.
|
97
|
-
for token, style in self.style:
|
98
|
-
start = end = ''
|
99
|
-
# a style item is a tuple in the following form:
|
100
|
-
# colors are readily specified in hex: 'RRGGBB'
|
101
|
-
if style['color']:
|
102
|
-
start += '<font color="#%s">' % style['color']
|
103
|
-
end = '</font>' + end
|
104
|
-
if style['bold']:
|
105
|
-
start += '<b>'
|
106
|
-
end = '</b>' + end
|
107
|
-
if style['italic']:
|
108
|
-
start += '<i>'
|
109
|
-
end = '</i>' + end
|
110
|
-
if style['underline']:
|
111
|
-
start += '<u>'
|
112
|
-
end = '</u>' + end
|
113
|
-
self.styles[token] = (start, end)
|
114
|
-
|
115
|
-
def format(self, tokensource, outfile):
|
116
|
-
# lastval is a string we use for caching
|
117
|
-
# because it's possible that an lexer yields a number
|
118
|
-
# of consecutive tokens with the same token type.
|
119
|
-
# to minimize the size of the generated html markup we
|
120
|
-
# try to join the values of same-type tokens here
|
121
|
-
lastval = ''
|
122
|
-
lasttype = None
|
123
|
-
|
124
|
-
# wrap the whole output with <pre>
|
125
|
-
outfile.write('<pre>')
|
126
|
-
|
127
|
-
for ttype, value in tokensource:
|
128
|
-
# if the token type doesn't exist in the stylemap
|
129
|
-
# we try it with the parent of the token type
|
130
|
-
# eg: parent of Token.Literal.String.Double is
|
131
|
-
# Token.Literal.String
|
132
|
-
while ttype not in self.styles:
|
133
|
-
ttype = ttype.parent
|
134
|
-
if ttype == lasttype:
|
135
|
-
# the current token type is the same of the last
|
136
|
-
# iteration. cache it
|
137
|
-
lastval += value
|
138
|
-
else:
|
139
|
-
# not the same token as last iteration, but we
|
140
|
-
# have some data in the buffer. wrap it with the
|
141
|
-
# defined style and write it to the output file
|
142
|
-
if lastval:
|
143
|
-
stylebegin, styleend = self.styles[lasttype]
|
144
|
-
outfile.write(stylebegin + lastval + styleend)
|
145
|
-
# set lastval/lasttype to current values
|
146
|
-
lastval = value
|
147
|
-
lasttype = ttype
|
148
|
-
|
149
|
-
# if something is left in the buffer, write it to the
|
150
|
-
# output file, then close the opened <pre> tag
|
151
|
-
if lastval:
|
152
|
-
stylebegin, styleend = self.styles[lasttype]
|
153
|
-
outfile.write(stylebegin + lastval + styleend)
|
154
|
-
outfile.write('</pre>\n')
|
155
|
-
|
156
|
-
The comments should explain it. Again, this formatter doesn't override the
|
157
|
-
`get_style_defs()` method. If we would have used CSS classes instead of
|
158
|
-
inline HTML markup, we would need to generate the CSS first. For that
|
159
|
-
purpose the `get_style_defs()` method exists:
|
160
|
-
|
161
|
-
|
162
|
-
Generating Style Definitions
|
163
|
-
============================
|
164
|
-
|
165
|
-
Some formatters like the `LatexFormatter` and the `HtmlFormatter` don't
|
166
|
-
output inline markup but reference either macros or css classes. Because
|
167
|
-
the definitions of those are not part of the output, the `get_style_defs()`
|
168
|
-
method exists. It is passed one parameter (if it's used and how it's used
|
169
|
-
is up to the formatter) and has to return a string or ``None``.
|