pygments.rb 2.3.1 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/.rubocop.yml +7 -0
- data/CHANGELOG.adoc +4 -0
- data/README.adoc +1 -1
- data/bench.rb +1 -1
- data/lib/pygments/popen.rb +3 -7
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +2 -2
- data/test/test_pygments.rb +0 -19
- data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/AUTHORS +21 -1
- data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/LICENSE +1 -1
- data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/METADATA +19 -11
- data/vendor/pygments-main/Pygments-2.15.1.dist-info/RECORD +614 -0
- data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/WHEEL +1 -1
- data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/entry_points.txt +0 -1
- data/vendor/pygments-main/bin/pygmentize +1 -1
- data/vendor/pygments-main/pygments/__init__.py +20 -22
- data/vendor/pygments-main/pygments/__main__.py +1 -1
- data/vendor/pygments-main/pygments/cmdline.py +74 -8
- data/vendor/pygments-main/pygments/console.py +1 -1
- data/vendor/pygments-main/pygments/filter.py +1 -1
- data/vendor/pygments-main/pygments/filters/__init__.py +6 -3
- data/vendor/pygments-main/pygments/formatter.py +41 -11
- data/vendor/pygments-main/pygments/formatters/__init__.py +21 -16
- data/vendor/pygments-main/pygments/formatters/_mapping.py +5 -65
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/groff.py +170 -0
- data/vendor/pygments-main/pygments/formatters/html.py +54 -32
- data/vendor/pygments-main/pygments/formatters/img.py +9 -5
- data/vendor/pygments-main/pygments/formatters/irc.py +6 -33
- data/vendor/pygments-main/pygments/formatters/latex.py +24 -14
- data/vendor/pygments-main/pygments/formatters/other.py +1 -1
- data/vendor/pygments-main/pygments/formatters/pangomarkup.py +1 -1
- data/vendor/pygments-main/pygments/formatters/rtf.py +1 -1
- data/vendor/pygments-main/pygments/formatters/svg.py +1 -1
- data/vendor/pygments-main/pygments/formatters/terminal.py +1 -3
- data/vendor/pygments-main/pygments/formatters/terminal256.py +2 -4
- data/vendor/pygments-main/pygments/lexer.py +101 -32
- data/vendor/pygments-main/pygments/lexers/__init__.py +50 -29
- data/vendor/pygments-main/pygments/lexers/_ada_builtins.py +103 -0
- data/vendor/pygments-main/pygments/lexers/_asy_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_cl_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +2 -2
- data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +21 -6
- data/vendor/pygments-main/pygments/lexers/_css_builtins.py +558 -0
- data/vendor/pygments-main/pygments/lexers/_julia_builtins.py +10 -0
- data/vendor/pygments-main/pygments/lexers/_lasso_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_lilypond_builtins.py +4932 -0
- data/vendor/pygments-main/pygments/lexers/_lua_builtins.py +11 -18
- data/vendor/pygments-main/pygments/lexers/_mapping.py +71 -82
- data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_mysql_builtins.py +58 -4
- data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_php_builtins.py +408 -1835
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +70 -8
- data/vendor/pygments-main/pygments/lexers/_qlik_builtins.py +666 -0
- data/vendor/pygments-main/pygments/lexers/_scheme_builtins.py +1609 -0
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +3 -3
- data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +9 -18
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +185 -94
- data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_usd_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_vbscript_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/actionscript.py +15 -14
- data/vendor/pygments-main/pygments/lexers/ada.py +144 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +1 -1
- data/vendor/pygments-main/pygments/lexers/algebra.py +72 -9
- data/vendor/pygments-main/pygments/lexers/ambient.py +8 -7
- data/vendor/pygments-main/pygments/lexers/amdgpu.py +4 -3
- data/vendor/pygments-main/pygments/lexers/ampl.py +10 -8
- data/vendor/pygments-main/pygments/lexers/apdlexer.py +164 -20
- data/vendor/pygments-main/pygments/lexers/apl.py +6 -5
- data/vendor/pygments-main/pygments/lexers/archetype.py +23 -21
- data/vendor/pygments-main/pygments/lexers/arrow.py +10 -9
- data/vendor/pygments-main/pygments/lexers/arturo.py +250 -0
- data/vendor/pygments-main/pygments/lexers/asc.py +9 -5
- data/vendor/pygments-main/pygments/lexers/asm.py +68 -63
- data/vendor/pygments-main/pygments/lexers/automation.py +7 -5
- data/vendor/pygments-main/pygments/lexers/bare.py +20 -21
- data/vendor/pygments-main/pygments/lexers/basic.py +45 -41
- data/vendor/pygments-main/pygments/lexers/bdd.py +58 -0
- data/vendor/pygments-main/pygments/lexers/berry.py +99 -0
- data/vendor/pygments-main/pygments/lexers/bibtex.py +6 -6
- data/vendor/pygments-main/pygments/lexers/boa.py +4 -8
- data/vendor/pygments-main/pygments/lexers/business.py +18 -18
- data/vendor/pygments-main/pygments/lexers/c_cpp.py +80 -40
- data/vendor/pygments-main/pygments/lexers/c_like.py +21 -19
- data/vendor/pygments-main/pygments/lexers/capnproto.py +6 -8
- data/vendor/pygments-main/pygments/lexers/carbon.py +96 -0
- data/vendor/pygments-main/pygments/lexers/cddl.py +16 -33
- data/vendor/pygments-main/pygments/lexers/chapel.py +14 -9
- data/vendor/pygments-main/pygments/lexers/clean.py +3 -2
- data/vendor/pygments-main/pygments/lexers/comal.py +80 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +3 -2
- data/vendor/pygments-main/pygments/lexers/configs.py +235 -120
- data/vendor/pygments-main/pygments/lexers/console.py +5 -4
- data/vendor/pygments-main/pygments/lexers/cplint.py +44 -0
- data/vendor/pygments-main/pygments/lexers/crystal.py +22 -23
- data/vendor/pygments-main/pygments/lexers/csound.py +19 -17
- data/vendor/pygments-main/pygments/lexers/css.py +67 -159
- data/vendor/pygments-main/pygments/lexers/d.py +15 -12
- data/vendor/pygments-main/pygments/lexers/dalvik.py +14 -11
- data/vendor/pygments-main/pygments/lexers/data.py +119 -49
- data/vendor/pygments-main/pygments/lexers/dax.py +136 -0
- data/vendor/pygments-main/pygments/lexers/devicetree.py +9 -8
- data/vendor/pygments-main/pygments/lexers/diff.py +23 -19
- data/vendor/pygments-main/pygments/lexers/dotnet.py +216 -81
- data/vendor/pygments-main/pygments/lexers/dsls.py +86 -64
- data/vendor/pygments-main/pygments/lexers/dylan.py +16 -15
- data/vendor/pygments-main/pygments/lexers/ecl.py +46 -38
- data/vendor/pygments-main/pygments/lexers/eiffel.py +15 -10
- data/vendor/pygments-main/pygments/lexers/elm.py +12 -8
- data/vendor/pygments-main/pygments/lexers/elpi.py +165 -0
- data/vendor/pygments-main/pygments/lexers/email.py +21 -39
- data/vendor/pygments-main/pygments/lexers/erlang.py +21 -22
- data/vendor/pygments-main/pygments/lexers/esoteric.py +28 -30
- data/vendor/pygments-main/pygments/lexers/ezhil.py +10 -9
- data/vendor/pygments-main/pygments/lexers/factor.py +104 -83
- data/vendor/pygments-main/pygments/lexers/fantom.py +31 -29
- data/vendor/pygments-main/pygments/lexers/felix.py +18 -14
- data/vendor/pygments-main/pygments/lexers/fift.py +67 -0
- data/vendor/pygments-main/pygments/lexers/floscript.py +7 -7
- data/vendor/pygments-main/pygments/lexers/forth.py +8 -6
- data/vendor/pygments-main/pygments/lexers/fortran.py +16 -11
- data/vendor/pygments-main/pygments/lexers/foxpro.py +2 -2
- data/vendor/pygments-main/pygments/lexers/freefem.py +7 -10
- data/vendor/pygments-main/pygments/lexers/func.py +108 -0
- data/vendor/pygments-main/pygments/lexers/functional.py +1 -1
- data/vendor/pygments-main/pygments/lexers/futhark.py +12 -17
- data/vendor/pygments-main/pygments/lexers/gcodelexer.py +1 -2
- data/vendor/pygments-main/pygments/lexers/gdscript.py +76 -233
- data/vendor/pygments-main/pygments/lexers/go.py +12 -14
- data/vendor/pygments-main/pygments/lexers/grammar_notation.py +22 -26
- data/vendor/pygments-main/pygments/lexers/graph.py +36 -15
- data/vendor/pygments-main/pygments/lexers/graphics.py +37 -38
- data/vendor/pygments-main/pygments/lexers/graphviz.py +2 -1
- data/vendor/pygments-main/pygments/lexers/gsql.py +39 -27
- data/vendor/pygments-main/pygments/lexers/haskell.py +73 -71
- data/vendor/pygments-main/pygments/lexers/haxe.py +13 -11
- data/vendor/pygments-main/pygments/lexers/hdl.py +31 -34
- data/vendor/pygments-main/pygments/lexers/hexdump.py +21 -21
- data/vendor/pygments-main/pygments/lexers/html.py +11 -19
- data/vendor/pygments-main/pygments/lexers/idl.py +10 -5
- data/vendor/pygments-main/pygments/lexers/igor.py +3 -2
- data/vendor/pygments-main/pygments/lexers/inferno.py +9 -8
- data/vendor/pygments-main/pygments/lexers/installers.py +39 -33
- data/vendor/pygments-main/pygments/lexers/int_fiction.py +35 -20
- data/vendor/pygments-main/pygments/lexers/iolang.py +9 -9
- data/vendor/pygments-main/pygments/lexers/j.py +20 -13
- data/vendor/pygments-main/pygments/lexers/javascript.py +183 -149
- data/vendor/pygments-main/pygments/lexers/jmespath.py +68 -0
- data/vendor/pygments-main/pygments/lexers/jslt.py +4 -3
- data/vendor/pygments-main/pygments/lexers/jsonnet.py +168 -0
- data/vendor/pygments-main/pygments/lexers/julia.py +44 -32
- data/vendor/pygments-main/pygments/lexers/jvm.py +161 -140
- data/vendor/pygments-main/pygments/lexers/kuin.py +93 -59
- data/vendor/pygments-main/pygments/lexers/lilypond.py +226 -0
- data/vendor/pygments-main/pygments/lexers/lisp.py +244 -107
- data/vendor/pygments-main/pygments/lexers/macaulay2.py +1739 -0
- data/vendor/pygments-main/pygments/lexers/make.py +21 -16
- data/vendor/pygments-main/pygments/lexers/markup.py +752 -11
- data/vendor/pygments-main/pygments/lexers/math.py +1 -1
- data/vendor/pygments-main/pygments/lexers/matlab.py +18 -3
- data/vendor/pygments-main/pygments/lexers/maxima.py +85 -0
- data/vendor/pygments-main/pygments/lexers/meson.py +10 -25
- data/vendor/pygments-main/pygments/lexers/mime.py +2 -2
- data/vendor/pygments-main/pygments/lexers/minecraft.py +394 -0
- data/vendor/pygments-main/pygments/lexers/mips.py +128 -0
- data/vendor/pygments-main/pygments/lexers/ml.py +9 -6
- data/vendor/pygments-main/pygments/lexers/modeling.py +12 -8
- data/vendor/pygments-main/pygments/lexers/modula2.py +3 -2
- data/vendor/pygments-main/pygments/lexers/monte.py +3 -2
- data/vendor/pygments-main/pygments/lexers/mosel.py +1 -1
- data/vendor/pygments-main/pygments/lexers/ncl.py +1 -1
- data/vendor/pygments-main/pygments/lexers/nimrod.py +62 -20
- data/vendor/pygments-main/pygments/lexers/nit.py +3 -2
- data/vendor/pygments-main/pygments/lexers/nix.py +5 -5
- data/vendor/pygments-main/pygments/lexers/oberon.py +2 -2
- data/vendor/pygments-main/pygments/lexers/objective.py +6 -4
- data/vendor/pygments-main/pygments/lexers/ooc.py +3 -2
- data/vendor/pygments-main/pygments/lexers/other.py +1 -1
- data/vendor/pygments-main/pygments/lexers/parasail.py +3 -2
- data/vendor/pygments-main/pygments/lexers/parsers.py +23 -21
- data/vendor/pygments-main/pygments/lexers/pascal.py +196 -198
- data/vendor/pygments-main/pygments/lexers/pawn.py +1 -1
- data/vendor/pygments-main/pygments/lexers/perl.py +17 -15
- data/vendor/pygments-main/pygments/lexers/phix.py +364 -0
- data/vendor/pygments-main/pygments/lexers/php.py +35 -20
- data/vendor/pygments-main/pygments/lexers/pointless.py +3 -2
- data/vendor/pygments-main/pygments/lexers/pony.py +1 -1
- data/vendor/pygments-main/pygments/lexers/praat.py +41 -38
- data/vendor/pygments-main/pygments/lexers/procfile.py +2 -3
- data/vendor/pygments-main/pygments/lexers/prolog.py +7 -8
- data/vendor/pygments-main/pygments/lexers/promql.py +5 -12
- data/vendor/pygments-main/pygments/lexers/python.py +145 -119
- data/vendor/pygments-main/pygments/lexers/q.py +188 -0
- data/vendor/pygments-main/pygments/lexers/qlik.py +117 -0
- data/vendor/pygments-main/pygments/lexers/qvt.py +1 -1
- data/vendor/pygments-main/pygments/lexers/r.py +4 -4
- data/vendor/pygments-main/pygments/lexers/rdf.py +3 -3
- data/vendor/pygments-main/pygments/lexers/rebol.py +1 -12
- data/vendor/pygments-main/pygments/lexers/resource.py +1 -1
- data/vendor/pygments-main/pygments/lexers/ride.py +3 -2
- data/vendor/pygments-main/pygments/lexers/rita.py +43 -0
- data/vendor/pygments-main/pygments/lexers/rnc.py +3 -2
- data/vendor/pygments-main/pygments/lexers/roboconf.py +3 -3
- data/vendor/pygments-main/pygments/lexers/robotframework.py +6 -5
- data/vendor/pygments-main/pygments/lexers/ruby.py +24 -24
- data/vendor/pygments-main/pygments/lexers/rust.py +3 -2
- data/vendor/pygments-main/pygments/lexers/sas.py +2 -2
- data/vendor/pygments-main/pygments/lexers/savi.py +170 -0
- data/vendor/pygments-main/pygments/lexers/scdoc.py +4 -7
- data/vendor/pygments-main/pygments/lexers/scripting.py +24 -21
- data/vendor/pygments-main/pygments/lexers/sgf.py +6 -6
- data/vendor/pygments-main/pygments/lexers/shell.py +29 -21
- data/vendor/pygments-main/pygments/lexers/sieve.py +14 -4
- data/vendor/pygments-main/pygments/lexers/slash.py +1 -1
- data/vendor/pygments-main/pygments/lexers/smalltalk.py +5 -3
- data/vendor/pygments-main/pygments/lexers/smithy.py +5 -6
- data/vendor/pygments-main/pygments/lexers/smv.py +1 -1
- data/vendor/pygments-main/pygments/lexers/snobol.py +1 -1
- data/vendor/pygments-main/pygments/lexers/solidity.py +3 -7
- data/vendor/pygments-main/pygments/lexers/sophia.py +103 -0
- data/vendor/pygments-main/pygments/lexers/special.py +2 -5
- data/vendor/pygments-main/pygments/lexers/spice.py +71 -0
- data/vendor/pygments-main/pygments/lexers/sql.py +212 -17
- data/vendor/pygments-main/pygments/lexers/srcinfo.py +62 -0
- data/vendor/pygments-main/pygments/lexers/stata.py +4 -3
- data/vendor/pygments-main/pygments/lexers/supercollider.py +4 -3
- data/vendor/pygments-main/pygments/lexers/tal.py +74 -0
- data/vendor/pygments-main/pygments/lexers/tcl.py +21 -16
- data/vendor/pygments-main/pygments/lexers/teal.py +9 -8
- data/vendor/pygments-main/pygments/lexers/templates.py +62 -29
- data/vendor/pygments-main/pygments/lexers/teraterm.py +12 -20
- data/vendor/pygments-main/pygments/lexers/testing.py +6 -2
- data/vendor/pygments-main/pygments/lexers/text.py +3 -2
- data/vendor/pygments-main/pygments/lexers/textedit.py +41 -7
- data/vendor/pygments-main/pygments/lexers/textfmts.py +7 -5
- data/vendor/pygments-main/pygments/lexers/theorem.py +42 -36
- data/vendor/pygments-main/pygments/lexers/thingsdb.py +2 -4
- data/vendor/pygments-main/pygments/lexers/tlb.py +57 -0
- data/vendor/pygments-main/pygments/lexers/tnt.py +3 -4
- data/vendor/pygments-main/pygments/lexers/trafficscript.py +2 -4
- data/vendor/pygments-main/pygments/lexers/typoscript.py +2 -3
- data/vendor/pygments-main/pygments/lexers/ul4.py +267 -0
- data/vendor/pygments-main/pygments/lexers/unicon.py +1 -1
- data/vendor/pygments-main/pygments/lexers/urbi.py +4 -4
- data/vendor/pygments-main/pygments/lexers/usd.py +2 -1
- data/vendor/pygments-main/pygments/lexers/varnish.py +5 -5
- data/vendor/pygments-main/pygments/lexers/verification.py +4 -3
- data/vendor/pygments-main/pygments/lexers/web.py +1 -1
- data/vendor/pygments-main/pygments/lexers/webassembly.py +5 -5
- data/vendor/pygments-main/pygments/lexers/webidl.py +2 -1
- data/vendor/pygments-main/pygments/lexers/webmisc.py +90 -71
- data/vendor/pygments-main/pygments/lexers/wgsl.py +407 -0
- data/vendor/pygments-main/pygments/lexers/whiley.py +2 -1
- data/vendor/pygments-main/pygments/lexers/wowtoc.py +120 -0
- data/vendor/pygments-main/pygments/lexers/wren.py +99 -0
- data/vendor/pygments-main/pygments/lexers/x10.py +5 -6
- data/vendor/pygments-main/pygments/lexers/xorg.py +3 -2
- data/vendor/pygments-main/pygments/lexers/yang.py +6 -5
- data/vendor/pygments-main/pygments/lexers/zig.py +3 -2
- data/vendor/pygments-main/pygments/modeline.py +1 -1
- data/vendor/pygments-main/pygments/plugin.py +28 -9
- 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 +63 -1
- data/vendor/pygments-main/pygments/style.py +7 -1
- data/vendor/pygments-main/pygments/styles/__init__.py +19 -5
- data/vendor/pygments-main/pygments/styles/abap.py +2 -2
- data/vendor/pygments-main/pygments/styles/algol.py +1 -2
- data/vendor/pygments-main/pygments/styles/algol_nu.py +1 -2
- data/vendor/pygments-main/pygments/styles/arduino.py +2 -3
- data/vendor/pygments-main/pygments/styles/autumn.py +1 -3
- data/vendor/pygments-main/pygments/styles/borland.py +1 -3
- data/vendor/pygments-main/pygments/styles/bw.py +1 -2
- data/vendor/pygments-main/pygments/styles/colorful.py +1 -3
- data/vendor/pygments-main/pygments/styles/default.py +13 -14
- data/vendor/pygments-main/pygments/styles/dracula.py +102 -0
- data/vendor/pygments-main/pygments/styles/emacs.py +1 -2
- data/vendor/pygments-main/pygments/styles/friendly.py +1 -2
- data/vendor/pygments-main/pygments/styles/friendly_grayscale.py +75 -0
- data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
- data/vendor/pygments-main/pygments/styles/gh_dark.py +107 -0
- data/vendor/pygments-main/pygments/styles/gruvbox.py +4 -2
- data/vendor/pygments-main/pygments/styles/igor.py +1 -2
- data/vendor/pygments-main/pygments/styles/inkpot.py +3 -2
- data/vendor/pygments-main/pygments/styles/lilypond.py +56 -0
- data/vendor/pygments-main/pygments/styles/lovelace.py +1 -3
- data/vendor/pygments-main/pygments/styles/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/material.py +1 -2
- data/vendor/pygments-main/pygments/styles/monokai.py +3 -3
- data/vendor/pygments-main/pygments/styles/murphy.py +1 -3
- data/vendor/pygments-main/pygments/styles/native.py +11 -11
- data/vendor/pygments-main/pygments/styles/nord.py +150 -0
- data/vendor/pygments-main/pygments/styles/onedark.py +59 -0
- data/vendor/pygments-main/pygments/styles/paraiso_dark.py +1 -6
- data/vendor/pygments-main/pygments/styles/paraiso_light.py +1 -6
- data/vendor/pygments-main/pygments/styles/pastie.py +1 -3
- data/vendor/pygments-main/pygments/styles/perldoc.py +1 -2
- data/vendor/pygments-main/pygments/styles/rainbow_dash.py +3 -3
- data/vendor/pygments-main/pygments/styles/rrt.py +3 -2
- data/vendor/pygments-main/pygments/styles/sas.py +2 -4
- data/vendor/pygments-main/pygments/styles/solarized.py +1 -1
- data/vendor/pygments-main/pygments/styles/staroffice.py +26 -0
- data/vendor/pygments-main/pygments/styles/stata_dark.py +4 -6
- data/vendor/pygments-main/pygments/styles/stata_light.py +1 -2
- data/vendor/pygments-main/pygments/styles/tango.py +2 -3
- data/vendor/pygments-main/pygments/styles/trac.py +1 -3
- data/vendor/pygments-main/pygments/styles/vim.py +1 -2
- data/vendor/pygments-main/pygments/styles/vs.py +1 -2
- data/vendor/pygments-main/pygments/styles/xcode.py +1 -3
- data/vendor/pygments-main/pygments/styles/zenburn.py +4 -6
- data/vendor/pygments-main/pygments/token.py +2 -1
- data/vendor/pygments-main/pygments/unistring.py +4 -6
- data/vendor/pygments-main/pygments/util.py +27 -5
- metadata +59 -14
- data/vendor/pygments-main/Pygments-2.10.0.dist-info/RECORD +0 -524
- /data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/INSTALLER +0 -0
- /data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/REQUESTED +0 -0
- /data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,170 @@
|
|
1
|
+
"""
|
2
|
+
pygments.formatters.groff
|
3
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
4
|
+
|
5
|
+
Formatter for groff output.
|
6
|
+
|
7
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
8
|
+
:license: BSD, see LICENSE for details.
|
9
|
+
"""
|
10
|
+
|
11
|
+
import math
|
12
|
+
from pygments.formatter import Formatter
|
13
|
+
from pygments.util import get_bool_opt, get_int_opt
|
14
|
+
|
15
|
+
__all__ = ['GroffFormatter']
|
16
|
+
|
17
|
+
|
18
|
+
class GroffFormatter(Formatter):
|
19
|
+
"""
|
20
|
+
Format tokens with groff escapes to change their color and font style.
|
21
|
+
|
22
|
+
.. versionadded:: 2.11
|
23
|
+
|
24
|
+
Additional options accepted:
|
25
|
+
|
26
|
+
`style`
|
27
|
+
The style to use, can be a string or a Style subclass (default:
|
28
|
+
``'default'``).
|
29
|
+
|
30
|
+
`monospaced`
|
31
|
+
If set to true, monospace font will be used (default: ``true``).
|
32
|
+
|
33
|
+
`linenos`
|
34
|
+
If set to true, print the line numbers (default: ``false``).
|
35
|
+
|
36
|
+
`wrap`
|
37
|
+
Wrap lines to the specified number of characters. Disabled if set to 0
|
38
|
+
(default: ``0``).
|
39
|
+
"""
|
40
|
+
|
41
|
+
name = 'groff'
|
42
|
+
aliases = ['groff','troff','roff']
|
43
|
+
filenames = []
|
44
|
+
|
45
|
+
def __init__(self, **options):
|
46
|
+
Formatter.__init__(self, **options)
|
47
|
+
|
48
|
+
self.monospaced = get_bool_opt(options, 'monospaced', True)
|
49
|
+
self.linenos = get_bool_opt(options, 'linenos', False)
|
50
|
+
self._lineno = 0
|
51
|
+
self.wrap = get_int_opt(options, 'wrap', 0)
|
52
|
+
self._linelen = 0
|
53
|
+
|
54
|
+
self.styles = {}
|
55
|
+
self._make_styles()
|
56
|
+
|
57
|
+
|
58
|
+
def _make_styles(self):
|
59
|
+
regular = '\\f[CR]' if self.monospaced else '\\f[R]'
|
60
|
+
bold = '\\f[CB]' if self.monospaced else '\\f[B]'
|
61
|
+
italic = '\\f[CI]' if self.monospaced else '\\f[I]'
|
62
|
+
|
63
|
+
for ttype, ndef in self.style:
|
64
|
+
start = end = ''
|
65
|
+
if ndef['color']:
|
66
|
+
start += '\\m[%s]' % ndef['color']
|
67
|
+
end = '\\m[]' + end
|
68
|
+
if ndef['bold']:
|
69
|
+
start += bold
|
70
|
+
end = regular + end
|
71
|
+
if ndef['italic']:
|
72
|
+
start += italic
|
73
|
+
end = regular + end
|
74
|
+
if ndef['bgcolor']:
|
75
|
+
start += '\\M[%s]' % ndef['bgcolor']
|
76
|
+
end = '\\M[]' + end
|
77
|
+
|
78
|
+
self.styles[ttype] = start, end
|
79
|
+
|
80
|
+
|
81
|
+
def _define_colors(self, outfile):
|
82
|
+
colors = set()
|
83
|
+
for _, ndef in self.style:
|
84
|
+
if ndef['color'] is not None:
|
85
|
+
colors.add(ndef['color'])
|
86
|
+
|
87
|
+
for color in sorted(colors):
|
88
|
+
outfile.write('.defcolor ' + color + ' rgb #' + color + '\n')
|
89
|
+
|
90
|
+
|
91
|
+
def _write_lineno(self, outfile):
|
92
|
+
self._lineno += 1
|
93
|
+
outfile.write("%s% 4d " % (self._lineno != 1 and '\n' or '', self._lineno))
|
94
|
+
|
95
|
+
|
96
|
+
def _wrap_line(self, line):
|
97
|
+
length = len(line.rstrip('\n'))
|
98
|
+
space = ' ' if self.linenos else ''
|
99
|
+
newline = ''
|
100
|
+
|
101
|
+
if length > self.wrap:
|
102
|
+
for i in range(0, math.floor(length / self.wrap)):
|
103
|
+
chunk = line[i*self.wrap:i*self.wrap+self.wrap]
|
104
|
+
newline += (chunk + '\n' + space)
|
105
|
+
remainder = length % self.wrap
|
106
|
+
if remainder > 0:
|
107
|
+
newline += line[-remainder-1:]
|
108
|
+
self._linelen = remainder
|
109
|
+
elif self._linelen + length > self.wrap:
|
110
|
+
newline = ('\n' + space) + line
|
111
|
+
self._linelen = length
|
112
|
+
else:
|
113
|
+
newline = line
|
114
|
+
self._linelen += length
|
115
|
+
|
116
|
+
return newline
|
117
|
+
|
118
|
+
|
119
|
+
def _escape_chars(self, text):
|
120
|
+
text = text.replace('\\', '\\[u005C]'). \
|
121
|
+
replace('.', '\\[char46]'). \
|
122
|
+
replace('\'', '\\[u0027]'). \
|
123
|
+
replace('`', '\\[u0060]'). \
|
124
|
+
replace('~', '\\[u007E]')
|
125
|
+
copy = text
|
126
|
+
|
127
|
+
for char in copy:
|
128
|
+
if len(char) != len(char.encode()):
|
129
|
+
uni = char.encode('unicode_escape') \
|
130
|
+
.decode()[1:] \
|
131
|
+
.replace('x', 'u00') \
|
132
|
+
.upper()
|
133
|
+
text = text.replace(char, '\\[u' + uni[1:] + ']')
|
134
|
+
|
135
|
+
return text
|
136
|
+
|
137
|
+
|
138
|
+
def format_unencoded(self, tokensource, outfile):
|
139
|
+
self._define_colors(outfile)
|
140
|
+
|
141
|
+
outfile.write('.nf\n\\f[CR]\n')
|
142
|
+
|
143
|
+
if self.linenos:
|
144
|
+
self._write_lineno(outfile)
|
145
|
+
|
146
|
+
for ttype, value in tokensource:
|
147
|
+
while ttype not in self.styles:
|
148
|
+
ttype = ttype.parent
|
149
|
+
start, end = self.styles[ttype]
|
150
|
+
|
151
|
+
for line in value.splitlines(True):
|
152
|
+
if self.wrap > 0:
|
153
|
+
line = self._wrap_line(line)
|
154
|
+
|
155
|
+
if start and end:
|
156
|
+
text = self._escape_chars(line.rstrip('\n'))
|
157
|
+
if text != '':
|
158
|
+
outfile.write(''.join((start, text, end)))
|
159
|
+
else:
|
160
|
+
outfile.write(self._escape_chars(line.rstrip('\n')))
|
161
|
+
|
162
|
+
if line.endswith('\n'):
|
163
|
+
if self.linenos:
|
164
|
+
self._write_lineno(outfile)
|
165
|
+
self._linelen = 0
|
166
|
+
else:
|
167
|
+
outfile.write('\n')
|
168
|
+
self._linelen = 0
|
169
|
+
|
170
|
+
outfile.write('\n.fi')
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Formatter for HTML output.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
@@ -62,7 +62,7 @@ def _get_ttype_class(ttype):
|
|
62
62
|
CSSFILE_TEMPLATE = '''\
|
63
63
|
/*
|
64
64
|
generated by Pygments <https://pygments.org/>
|
65
|
-
Copyright 2006-
|
65
|
+
Copyright 2006-2023 by the Pygments team.
|
66
66
|
Licensed under the BSD license, see LICENSE for details.
|
67
67
|
*/
|
68
68
|
%(styledefs)s
|
@@ -73,7 +73,7 @@ DOC_HEADER = '''\
|
|
73
73
|
"http://www.w3.org/TR/html4/strict.dtd">
|
74
74
|
<!--
|
75
75
|
generated by Pygments <https://pygments.org/>
|
76
|
-
Copyright 2006-
|
76
|
+
Copyright 2006-2023 by the Pygments team.
|
77
77
|
Licensed under the BSD license, see LICENSE for details.
|
78
78
|
-->
|
79
79
|
<html>
|
@@ -112,9 +112,9 @@ DOC_FOOTER = '''\
|
|
112
112
|
|
113
113
|
class HtmlFormatter(Formatter):
|
114
114
|
r"""
|
115
|
-
Format tokens as HTML 4 ``<span>`` tags
|
116
|
-
in a ``<
|
117
|
-
option.
|
115
|
+
Format tokens as HTML 4 ``<span>`` tags. By default, the content is enclosed
|
116
|
+
in a ``<pre>`` tag, itself wrapped in a ``<div>`` tag (but see the `nowrap` option).
|
117
|
+
The ``<div>``'s CSS class can be set by the `cssclass` option.
|
118
118
|
|
119
119
|
If the `linenos` option is set to ``"table"``, the ``<pre>`` is
|
120
120
|
additionally wrapped inside a ``<table>`` which has one row and two
|
@@ -140,8 +140,6 @@ class HtmlFormatter(Formatter):
|
|
140
140
|
|
141
141
|
(whitespace added to improve clarity).
|
142
142
|
|
143
|
-
Wrapping can be disabled using the `nowrap` option.
|
144
|
-
|
145
143
|
A list of lines can be specified using the `hl_lines` option to make these
|
146
144
|
lines highlighted (as of Pygments 0.11).
|
147
145
|
|
@@ -187,8 +185,8 @@ class HtmlFormatter(Formatter):
|
|
187
185
|
Additional options accepted:
|
188
186
|
|
189
187
|
`nowrap`
|
190
|
-
If set to ``True``, don't
|
191
|
-
|
188
|
+
If set to ``True``, don't add a ``<pre>`` and a ``<div>`` tag
|
189
|
+
around the tokens. This disables most other options (default: ``False``).
|
192
190
|
|
193
191
|
`full`
|
194
192
|
Tells the formatter to output a "full" document, i.e. a complete
|
@@ -349,6 +347,12 @@ class HtmlFormatter(Formatter):
|
|
349
347
|
|
350
348
|
.. versionadded:: 2.4
|
351
349
|
|
350
|
+
`debug_token_types`
|
351
|
+
Add ``title`` attributes to all token ``<span>`` tags that show the
|
352
|
+
name of the token.
|
353
|
+
|
354
|
+
.. versionadded:: 2.10
|
355
|
+
|
352
356
|
|
353
357
|
**Subclassing the HTML formatter**
|
354
358
|
|
@@ -379,7 +383,7 @@ class HtmlFormatter(Formatter):
|
|
379
383
|
|
380
384
|
class CodeHtmlFormatter(HtmlFormatter):
|
381
385
|
|
382
|
-
def wrap(self, source,
|
386
|
+
def wrap(self, source, *, include_div):
|
383
387
|
return self._wrap_code(source)
|
384
388
|
|
385
389
|
def _wrap_code(self, source):
|
@@ -419,6 +423,7 @@ class HtmlFormatter(Formatter):
|
|
419
423
|
self.filename = self._decodeifneeded(options.get('filename', ''))
|
420
424
|
self.wrapcode = get_bool_opt(options, 'wrapcode', False)
|
421
425
|
self.span_element_openers = {}
|
426
|
+
self.debug_token_types = get_bool_opt(options, 'debug_token_types', False)
|
422
427
|
|
423
428
|
if self.tagsfile:
|
424
429
|
if not ctags:
|
@@ -628,7 +633,7 @@ class HtmlFormatter(Formatter):
|
|
628
633
|
# write CSS file only if noclobber_cssfile isn't given as an option.
|
629
634
|
try:
|
630
635
|
if not os.path.exists(cssfilename) or not self.noclobber_cssfile:
|
631
|
-
with open(cssfilename, "w") as cf:
|
636
|
+
with open(cssfilename, "w", encoding="utf-8") as cf:
|
632
637
|
cf.write(CSSFILE_TEMPLATE %
|
633
638
|
{'styledefs': self.get_style_defs('body')})
|
634
639
|
except OSError as err:
|
@@ -660,7 +665,7 @@ class HtmlFormatter(Formatter):
|
|
660
665
|
mw = len(str(lncount + fl - 1))
|
661
666
|
sp = self.linenospecial
|
662
667
|
st = self.linenostep
|
663
|
-
|
668
|
+
anchor_name = self.lineanchors or self.linespans
|
664
669
|
aln = self.anchorlinenos
|
665
670
|
nocls = self.noclasses
|
666
671
|
|
@@ -673,7 +678,7 @@ class HtmlFormatter(Formatter):
|
|
673
678
|
if print_line:
|
674
679
|
line = '%*d' % (mw, i)
|
675
680
|
if aln:
|
676
|
-
line = '<a href="#%s-%d">%s</a>' % (
|
681
|
+
line = '<a href="#%s-%d">%s</a>' % (anchor_name, i, line)
|
677
682
|
else:
|
678
683
|
line = ' ' * mw
|
679
684
|
|
@@ -700,21 +705,22 @@ class HtmlFormatter(Formatter):
|
|
700
705
|
filename_tr = ""
|
701
706
|
if self.filename:
|
702
707
|
filename_tr = (
|
703
|
-
'<tr><th colspan="2" class="filename"
|
704
|
-
'<span class="filename">' + self.filename + '</span
|
708
|
+
'<tr><th colspan="2" class="filename">'
|
709
|
+
'<span class="filename">' + self.filename + '</span>'
|
705
710
|
'</th></tr>')
|
706
711
|
|
707
712
|
# in case you wonder about the seemingly redundant <div> here: since the
|
708
713
|
# content in the other cell also is wrapped in a div, some browsers in
|
709
714
|
# some configurations seem to mess up the formatting...
|
710
|
-
yield 0, (
|
711
|
-
'<table class="%stable">' % self.cssclass + filename_tr +
|
715
|
+
yield 0, (f'<table class="{self.cssclass}table">' + filename_tr +
|
712
716
|
'<tr><td class="linenos"><div class="linenodiv"><pre>' +
|
713
|
-
ls + '</pre></div></td><td class="code">'
|
714
|
-
|
717
|
+
ls + '</pre></div></td><td class="code">')
|
718
|
+
yield 0, '<div>'
|
715
719
|
yield 0, dummyoutfile.getvalue()
|
720
|
+
yield 0, '</div>'
|
716
721
|
yield 0, '</td></tr></table>'
|
717
722
|
|
723
|
+
|
718
724
|
def _wrap_inlinelinenos(self, inner):
|
719
725
|
# need a list of lines since we need the width of a single number :(
|
720
726
|
inner_lines = list(inner)
|
@@ -722,7 +728,7 @@ class HtmlFormatter(Formatter):
|
|
722
728
|
st = self.linenostep
|
723
729
|
num = self.linenostart
|
724
730
|
mw = len(str(len(inner_lines) + num - 1))
|
725
|
-
|
731
|
+
anchor_name = self.lineanchors or self.linespans
|
726
732
|
aln = self.anchorlinenos
|
727
733
|
nocls = self.noclasses
|
728
734
|
|
@@ -752,7 +758,7 @@ class HtmlFormatter(Formatter):
|
|
752
758
|
linenos = line
|
753
759
|
|
754
760
|
if aln:
|
755
|
-
yield 1, ('<a href="#%s-%d">%s</a>' % (
|
761
|
+
yield 1, ('<a href="#%s-%d">%s</a>' % (anchor_name, num, linenos) +
|
756
762
|
inner_line)
|
757
763
|
else:
|
758
764
|
yield 1, linenos + inner_line
|
@@ -765,7 +771,8 @@ class HtmlFormatter(Formatter):
|
|
765
771
|
for t, line in inner:
|
766
772
|
if t:
|
767
773
|
i += 1
|
768
|
-
|
774
|
+
href = "" if self.linenos else ' href="#%s-%d"' % (s, i)
|
775
|
+
yield 1, '<a id="%s-%d" name="%s-%d"%s></a>' % (s, i, s, i, href) + line
|
769
776
|
else:
|
770
777
|
yield 0, line
|
771
778
|
|
@@ -835,12 +842,20 @@ class HtmlFormatter(Formatter):
|
|
835
842
|
try:
|
836
843
|
cspan = self.span_element_openers[ttype]
|
837
844
|
except KeyError:
|
845
|
+
title = ' title="%s"' % '.'.join(ttype) if self.debug_token_types else ''
|
838
846
|
if nocls:
|
839
847
|
css_style = self._get_css_inline_styles(ttype)
|
840
|
-
|
848
|
+
if css_style:
|
849
|
+
css_style = self.class2style[css_style][0]
|
850
|
+
cspan = '<span style="%s"%s>' % (css_style, title)
|
851
|
+
else:
|
852
|
+
cspan = ''
|
841
853
|
else:
|
842
854
|
css_class = self._get_css_classes(ttype)
|
843
|
-
|
855
|
+
if css_class:
|
856
|
+
cspan = '<span class="%s"%s>' % (css_class, title)
|
857
|
+
else:
|
858
|
+
cspan = ''
|
844
859
|
self.span_element_openers[ttype] = cspan
|
845
860
|
|
846
861
|
parts = self._translate_parts(value)
|
@@ -861,10 +876,12 @@ class HtmlFormatter(Formatter):
|
|
861
876
|
# for all but the last line
|
862
877
|
for part in parts[:-1]:
|
863
878
|
if line:
|
864
|
-
|
879
|
+
# Also check for part being non-empty, so we avoid creating
|
880
|
+
# empty <span> tags
|
881
|
+
if lspan != cspan and part:
|
865
882
|
line.extend(((lspan and '</span>'), cspan, part,
|
866
883
|
(cspan and '</span>'), lsep))
|
867
|
-
else: # both are the same
|
884
|
+
else: # both are the same, or the current part was empty
|
868
885
|
line.extend((part, (lspan and '</span>'), lsep))
|
869
886
|
yield 1, ''.join(line)
|
870
887
|
line = []
|
@@ -917,16 +934,20 @@ class HtmlFormatter(Formatter):
|
|
917
934
|
else:
|
918
935
|
yield 1, value
|
919
936
|
|
920
|
-
def wrap(self, source
|
937
|
+
def wrap(self, source):
|
921
938
|
"""
|
922
939
|
Wrap the ``source``, which is a generator yielding
|
923
940
|
individual lines, in custom generators. See docstring
|
924
941
|
for `format`. Can be overridden.
|
925
942
|
"""
|
943
|
+
|
944
|
+
output = source
|
926
945
|
if self.wrapcode:
|
927
|
-
|
928
|
-
|
929
|
-
|
946
|
+
output = self._wrap_code(output)
|
947
|
+
|
948
|
+
output = self._wrap_pre(output)
|
949
|
+
|
950
|
+
return output
|
930
951
|
|
931
952
|
def format_unencoded(self, tokensource, outfile):
|
932
953
|
"""
|
@@ -957,9 +978,10 @@ class HtmlFormatter(Formatter):
|
|
957
978
|
source = self._wrap_lineanchors(source)
|
958
979
|
if self.linespans:
|
959
980
|
source = self._wrap_linespans(source)
|
960
|
-
source = self.wrap(source
|
981
|
+
source = self.wrap(source)
|
961
982
|
if self.linenos == 1:
|
962
983
|
source = self._wrap_tablelinenos(source)
|
984
|
+
source = self._wrap_div(source)
|
963
985
|
if self.full:
|
964
986
|
source = self._wrap_full(source, outfile)
|
965
987
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Formatter for Pixmap output.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
@@ -206,13 +206,17 @@ class FontManager:
|
|
206
206
|
"""
|
207
207
|
Get the character size.
|
208
208
|
"""
|
209
|
-
return self.
|
209
|
+
return self.get_text_size('M')
|
210
210
|
|
211
211
|
def get_text_size(self, text):
|
212
212
|
"""
|
213
|
-
Get the text size(width, height).
|
213
|
+
Get the text size (width, height).
|
214
214
|
"""
|
215
|
-
|
215
|
+
font = self.fonts['NORMAL']
|
216
|
+
if hasattr(font, 'getbbox'): # Pillow >= 9.2.0
|
217
|
+
return font.getbbox(text)[2:4]
|
218
|
+
else:
|
219
|
+
return font.getsize(text)
|
216
220
|
|
217
221
|
def get_font(self, bold, oblique):
|
218
222
|
"""
|
@@ -520,7 +524,7 @@ class ImageFormatter(Formatter):
|
|
520
524
|
text_fg = self._get_text_color(style),
|
521
525
|
text_bg = self._get_text_bg_color(style),
|
522
526
|
)
|
523
|
-
temp_width,
|
527
|
+
temp_width, _ = self.fonts.get_text_size(temp)
|
524
528
|
linelength += temp_width
|
525
529
|
maxlinelength = max(maxlinelength, linelength)
|
526
530
|
charno += len(temp)
|
@@ -4,12 +4,10 @@
|
|
4
4
|
|
5
5
|
Formatter for IRC output
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
11
|
-
import sys
|
12
|
-
|
13
11
|
from pygments.formatter import Formatter
|
14
12
|
from pygments.token import Keyword, Name, Comment, String, Error, \
|
15
13
|
Number, Operator, Generic, Token, Whitespace
|
@@ -130,38 +128,12 @@ class IRCFormatter(Formatter):
|
|
130
128
|
self._lineno = 0
|
131
129
|
|
132
130
|
def _write_lineno(self, outfile):
|
133
|
-
self.
|
134
|
-
|
135
|
-
|
136
|
-
def _format_unencoded_with_lineno(self, tokensource, outfile):
|
137
|
-
self._write_lineno(outfile)
|
138
|
-
|
139
|
-
for ttype, value in tokensource:
|
140
|
-
if value.endswith("\n"):
|
141
|
-
self._write_lineno(outfile)
|
142
|
-
value = value[:-1]
|
143
|
-
color = self.colorscheme.get(ttype)
|
144
|
-
while color is None:
|
145
|
-
ttype = ttype[:-1]
|
146
|
-
color = self.colorscheme.get(ttype)
|
147
|
-
if color:
|
148
|
-
color = color[self.darkbg]
|
149
|
-
spl = value.split('\n')
|
150
|
-
for line in spl[:-1]:
|
151
|
-
self._write_lineno(outfile)
|
152
|
-
if line:
|
153
|
-
outfile.write(ircformat(color, line[:-1]))
|
154
|
-
if spl[-1]:
|
155
|
-
outfile.write(ircformat(color, spl[-1]))
|
156
|
-
else:
|
157
|
-
outfile.write(value)
|
158
|
-
|
159
|
-
outfile.write("\n")
|
131
|
+
if self.linenos:
|
132
|
+
self._lineno += 1
|
133
|
+
outfile.write("%04d: " % self._lineno)
|
160
134
|
|
161
135
|
def format_unencoded(self, tokensource, outfile):
|
162
|
-
|
163
|
-
self._format_unencoded_with_lineno(tokensource, outfile)
|
164
|
-
return
|
136
|
+
self._write_lineno(outfile)
|
165
137
|
|
166
138
|
for ttype, value in tokensource:
|
167
139
|
color = self.colorscheme.get(ttype)
|
@@ -175,6 +147,7 @@ class IRCFormatter(Formatter):
|
|
175
147
|
if line:
|
176
148
|
outfile.write(ircformat(color, line))
|
177
149
|
outfile.write('\n')
|
150
|
+
self._write_lineno(outfile)
|
178
151
|
if spl[-1]:
|
179
152
|
outfile.write(ircformat(color, spl[-1]))
|
180
153
|
else:
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Formatter for LaTeX fancyvrb output.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
@@ -159,6 +159,8 @@ class LatexFormatter(Formatter):
|
|
159
159
|
\PY{k}{pass}
|
160
160
|
\end{Verbatim}
|
161
161
|
|
162
|
+
Wrapping can be disabled using the `nowrap` option.
|
163
|
+
|
162
164
|
The special command used here (``\PY``) and all the other macros it needs
|
163
165
|
are output by the `get_style_defs` method.
|
164
166
|
|
@@ -171,6 +173,11 @@ class LatexFormatter(Formatter):
|
|
171
173
|
|
172
174
|
Additional options accepted:
|
173
175
|
|
176
|
+
`nowrap`
|
177
|
+
If set to ``True``, don't wrap the tokens at all, not even inside a
|
178
|
+
``\begin{Verbatim}`` environment. This disables most other options
|
179
|
+
(default: ``False``).
|
180
|
+
|
174
181
|
`style`
|
175
182
|
The style to use, can be a string or a Style subclass (default:
|
176
183
|
``'default'``).
|
@@ -248,6 +255,7 @@ class LatexFormatter(Formatter):
|
|
248
255
|
|
249
256
|
def __init__(self, **options):
|
250
257
|
Formatter.__init__(self, **options)
|
258
|
+
self.nowrap = get_bool_opt(options, 'nowrap', False)
|
251
259
|
self.docclass = options.get('docclass', 'article')
|
252
260
|
self.preamble = options.get('preamble', '')
|
253
261
|
self.linenos = get_bool_opt(options, 'linenos', False)
|
@@ -334,18 +342,19 @@ class LatexFormatter(Formatter):
|
|
334
342
|
realoutfile = outfile
|
335
343
|
outfile = StringIO()
|
336
344
|
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
345
|
+
if not self.nowrap:
|
346
|
+
outfile.write('\\begin{' + self.envname + '}[commandchars=\\\\\\{\\}')
|
347
|
+
if self.linenos:
|
348
|
+
start, step = self.linenostart, self.linenostep
|
349
|
+
outfile.write(',numbers=left' +
|
350
|
+
(start and ',firstnumber=%d' % start or '') +
|
351
|
+
(step and ',stepnumber=%d' % step or ''))
|
352
|
+
if self.mathescape or self.texcomments or self.escapeinside:
|
353
|
+
outfile.write(',codes={\\catcode`\\$=3\\catcode`\\^=7'
|
354
|
+
'\\catcode`\\_=8\\relax}')
|
355
|
+
if self.verboptions:
|
356
|
+
outfile.write(',' + self.verboptions)
|
357
|
+
outfile.write(']\n')
|
349
358
|
|
350
359
|
for ttype, value in tokensource:
|
351
360
|
if ttype in Token.Comment:
|
@@ -408,7 +417,8 @@ class LatexFormatter(Formatter):
|
|
408
417
|
else:
|
409
418
|
outfile.write(value)
|
410
419
|
|
411
|
-
|
420
|
+
if not self.nowrap:
|
421
|
+
outfile.write('\\end{' + self.envname + '}\n')
|
412
422
|
|
413
423
|
if self.full:
|
414
424
|
encoding = self.encoding or 'utf8'
|
@@ -4,12 +4,10 @@
|
|
4
4
|
|
5
5
|
Formatter for terminal output with ANSI sequences.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
11
|
-
import sys
|
12
|
-
|
13
11
|
from pygments.formatter import Formatter
|
14
12
|
from pygments.token import Keyword, Name, Comment, String, Error, \
|
15
13
|
Number, Operator, Generic, Token, Whitespace
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
Formatter version 1.
|
12
12
|
|
13
|
-
:copyright: Copyright 2006-
|
13
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
14
14
|
:license: BSD, see LICENSE for details.
|
15
15
|
"""
|
16
16
|
|
@@ -23,8 +23,6 @@
|
|
23
23
|
# black-on-while, so colors like "white background" need to be converted
|
24
24
|
# to "white background, black foreground", etc...
|
25
25
|
|
26
|
-
import sys
|
27
|
-
|
28
26
|
from pygments.formatter import Formatter
|
29
27
|
from pygments.console import codes
|
30
28
|
from pygments.style import ansicolors
|
@@ -281,7 +279,7 @@ class Terminal256Formatter(Formatter):
|
|
281
279
|
|
282
280
|
except KeyError:
|
283
281
|
# ottype = ttype
|
284
|
-
ttype = ttype
|
282
|
+
ttype = ttype.parent
|
285
283
|
# outfile.write( '!' + str(ottype) + '->' + str(ttype) + '!' )
|
286
284
|
|
287
285
|
if not_found:
|