pygments.rb 2.4.0 → 3.0.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 +8 -8
- data/.github/workflows/release.yml +5 -5
- data/.gitignore +2 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.adoc +12 -0
- data/README.adoc +2 -2
- data/lib/pygments/popen.rb +2 -2
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +3 -3
- data/vendor/pygments-main/bin/pygmentize +1 -1
- data/vendor/pygments-main/pygments/__init__.py +2 -2
- data/vendor/pygments-main/pygments/__main__.py +1 -1
- data/vendor/pygments-main/pygments/cmdline.py +12 -12
- data/vendor/pygments-main/pygments/console.py +5 -5
- data/vendor/pygments-main/pygments/filter.py +2 -3
- data/vendor/pygments-main/pygments/filters/__init__.py +4 -4
- data/vendor/pygments-main/pygments/formatter.py +6 -1
- data/vendor/pygments-main/pygments/formatters/__init__.py +7 -8
- data/vendor/pygments-main/pygments/formatters/_mapping.py +0 -0
- data/vendor/pygments-main/pygments/formatters/bbcode.py +2 -2
- data/vendor/pygments-main/pygments/formatters/groff.py +3 -3
- data/vendor/pygments-main/pygments/formatters/html.py +38 -40
- data/vendor/pygments-main/pygments/formatters/img.py +51 -11
- data/vendor/pygments-main/pygments/formatters/irc.py +1 -1
- data/vendor/pygments-main/pygments/formatters/latex.py +24 -27
- data/vendor/pygments-main/pygments/formatters/other.py +3 -4
- data/vendor/pygments-main/pygments/formatters/pangomarkup.py +2 -2
- data/vendor/pygments-main/pygments/formatters/rtf.py +228 -25
- data/vendor/pygments-main/pygments/formatters/svg.py +17 -20
- data/vendor/pygments-main/pygments/formatters/terminal.py +1 -1
- data/vendor/pygments-main/pygments/formatters/terminal256.py +1 -1
- data/vendor/pygments-main/pygments/lexer.py +51 -33
- data/vendor/pygments-main/pygments/lexers/__init__.py +12 -12
- data/vendor/pygments-main/pygments/lexers/_ada_builtins.py +1 -1
- 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 +1 -1
- data/vendor/pygments-main/pygments/lexers/_css_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_julia_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_lasso_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_lilypond_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_lua_builtins.py +5 -5
- data/vendor/pygments-main/pygments/lexers/_luau_builtins.py +62 -0
- data/vendor/pygments-main/pygments/lexers/_mapping.py +41 -11
- data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_mysql_builtins.py +3 -3
- data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_php_builtins.py +3 -3
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +5 -5
- data/vendor/pygments-main/pygments/lexers/_qlik_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_scheme_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +4 -4
- data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +3 -3
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +1 -1
- 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 +6 -8
- data/vendor/pygments-main/pygments/lexers/ada.py +3 -3
- data/vendor/pygments-main/pygments/lexers/agile.py +3 -1
- data/vendor/pygments-main/pygments/lexers/algebra.py +9 -13
- data/vendor/pygments-main/pygments/lexers/ambient.py +2 -3
- data/vendor/pygments-main/pygments/lexers/amdgpu.py +3 -3
- data/vendor/pygments-main/pygments/lexers/ampl.py +2 -3
- data/vendor/pygments-main/pygments/lexers/apdlexer.py +4 -3
- data/vendor/pygments-main/pygments/lexers/apl.py +2 -3
- data/vendor/pygments-main/pygments/lexers/archetype.py +8 -12
- data/vendor/pygments-main/pygments/lexers/arrow.py +2 -3
- data/vendor/pygments-main/pygments/lexers/arturo.py +2 -3
- data/vendor/pygments-main/pygments/lexers/asc.py +4 -4
- data/vendor/pygments-main/pygments/lexers/asm.py +28 -15
- data/vendor/pygments-main/pygments/lexers/asn1.py +178 -0
- data/vendor/pygments-main/pygments/lexers/automation.py +6 -8
- data/vendor/pygments-main/pygments/lexers/bare.py +2 -3
- data/vendor/pygments-main/pygments/lexers/basic.py +48 -57
- data/vendor/pygments-main/pygments/lexers/bdd.py +3 -4
- data/vendor/pygments-main/pygments/lexers/berry.py +4 -4
- data/vendor/pygments-main/pygments/lexers/bibtex.py +5 -5
- data/vendor/pygments-main/pygments/lexers/blueprint.py +173 -0
- data/vendor/pygments-main/pygments/lexers/boa.py +4 -4
- data/vendor/pygments-main/pygments/lexers/bqn.py +109 -0
- data/vendor/pygments-main/pygments/lexers/business.py +21 -22
- data/vendor/pygments-main/pygments/lexers/c_cpp.py +9 -4
- data/vendor/pygments-main/pygments/lexers/c_like.py +99 -27
- data/vendor/pygments-main/pygments/lexers/capnproto.py +2 -3
- data/vendor/pygments-main/pygments/lexers/carbon.py +10 -11
- data/vendor/pygments-main/pygments/lexers/cddl.py +8 -9
- data/vendor/pygments-main/pygments/lexers/chapel.py +2 -3
- data/vendor/pygments-main/pygments/lexers/clean.py +2 -1
- data/vendor/pygments-main/pygments/lexers/comal.py +2 -1
- data/vendor/pygments-main/pygments/lexers/compiled.py +2 -1
- data/vendor/pygments-main/pygments/lexers/configs.py +342 -108
- data/vendor/pygments-main/pygments/lexers/console.py +5 -5
- data/vendor/pygments-main/pygments/lexers/cplint.py +2 -3
- data/vendor/pygments-main/pygments/lexers/crystal.py +4 -5
- data/vendor/pygments-main/pygments/lexers/csound.py +6 -8
- data/vendor/pygments-main/pygments/lexers/css.py +5 -5
- data/vendor/pygments-main/pygments/lexers/d.py +4 -3
- data/vendor/pygments-main/pygments/lexers/dalvik.py +2 -3
- data/vendor/pygments-main/pygments/lexers/data.py +8 -12
- data/vendor/pygments-main/pygments/lexers/dax.py +2 -3
- data/vendor/pygments-main/pygments/lexers/devicetree.py +2 -3
- data/vendor/pygments-main/pygments/lexers/diff.py +7 -6
- data/vendor/pygments-main/pygments/lexers/dns.py +109 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +19 -14
- data/vendor/pygments-main/pygments/lexers/dsls.py +24 -35
- data/vendor/pygments-main/pygments/lexers/dylan.py +8 -16
- data/vendor/pygments-main/pygments/lexers/ecl.py +2 -3
- data/vendor/pygments-main/pygments/lexers/eiffel.py +3 -4
- data/vendor/pygments-main/pygments/lexers/elm.py +3 -4
- data/vendor/pygments-main/pygments/lexers/elpi.py +28 -21
- data/vendor/pygments-main/pygments/lexers/email.py +3 -3
- data/vendor/pygments-main/pygments/lexers/erlang.py +22 -24
- data/vendor/pygments-main/pygments/lexers/esoteric.py +11 -12
- data/vendor/pygments-main/pygments/lexers/ezhil.py +2 -3
- data/vendor/pygments-main/pygments/lexers/factor.py +2 -3
- data/vendor/pygments-main/pygments/lexers/fantom.py +3 -3
- data/vendor/pygments-main/pygments/lexers/felix.py +9 -10
- data/vendor/pygments-main/pygments/lexers/fift.py +2 -1
- data/vendor/pygments-main/pygments/lexers/floscript.py +2 -3
- data/vendor/pygments-main/pygments/lexers/forth.py +2 -3
- data/vendor/pygments-main/pygments/lexers/fortran.py +6 -7
- data/vendor/pygments-main/pygments/lexers/foxpro.py +3 -3
- data/vendor/pygments-main/pygments/lexers/freefem.py +2 -3
- data/vendor/pygments-main/pygments/lexers/func.py +3 -1
- data/vendor/pygments-main/pygments/lexers/functional.py +2 -1
- data/vendor/pygments-main/pygments/lexers/futhark.py +6 -7
- data/vendor/pygments-main/pygments/lexers/gcodelexer.py +3 -3
- data/vendor/pygments-main/pygments/lexers/gdscript.py +2 -1
- data/vendor/pygments-main/pygments/lexers/go.py +3 -4
- data/vendor/pygments-main/pygments/lexers/grammar_notation.py +6 -9
- data/vendor/pygments-main/pygments/lexers/graph.py +12 -9
- data/vendor/pygments-main/pygments/lexers/graphics.py +13 -17
- data/vendor/pygments-main/pygments/lexers/graphql.py +176 -0
- data/vendor/pygments-main/pygments/lexers/graphviz.py +2 -3
- data/vendor/pygments-main/pygments/lexers/gsql.py +2 -3
- data/vendor/pygments-main/pygments/lexers/haskell.py +27 -32
- data/vendor/pygments-main/pygments/lexers/haxe.py +3 -5
- data/vendor/pygments-main/pygments/lexers/hdl.py +8 -7
- data/vendor/pygments-main/pygments/lexers/hexdump.py +3 -3
- data/vendor/pygments-main/pygments/lexers/html.py +34 -13
- data/vendor/pygments-main/pygments/lexers/idl.py +2 -3
- data/vendor/pygments-main/pygments/lexers/igor.py +305 -290
- data/vendor/pygments-main/pygments/lexers/inferno.py +2 -3
- data/vendor/pygments-main/pygments/lexers/installers.py +7 -9
- data/vendor/pygments-main/pygments/lexers/int_fiction.py +150 -162
- data/vendor/pygments-main/pygments/lexers/iolang.py +2 -3
- data/vendor/pygments-main/pygments/lexers/j.py +2 -3
- data/vendor/pygments-main/pygments/lexers/javascript.py +18 -19
- data/vendor/pygments-main/pygments/lexers/jmespath.py +2 -1
- data/vendor/pygments-main/pygments/lexers/jslt.py +2 -3
- data/vendor/pygments-main/pygments/lexers/jsonnet.py +4 -3
- data/vendor/pygments-main/pygments/lexers/jsx.py +75 -0
- data/vendor/pygments-main/pygments/lexers/julia.py +4 -5
- data/vendor/pygments-main/pygments/lexers/jvm.py +98 -116
- data/vendor/pygments-main/pygments/lexers/kuin.py +2 -3
- data/vendor/pygments-main/pygments/lexers/kusto.py +93 -0
- data/vendor/pygments-main/pygments/lexers/ldap.py +155 -0
- data/vendor/pygments-main/pygments/lexers/lean.py +241 -0
- data/vendor/pygments-main/pygments/lexers/lilypond.py +2 -3
- data/vendor/pygments-main/pygments/lexers/lisp.py +373 -65
- data/vendor/pygments-main/pygments/lexers/macaulay2.py +53 -4
- data/vendor/pygments-main/pygments/lexers/make.py +7 -5
- data/vendor/pygments-main/pygments/lexers/markup.py +242 -91
- data/vendor/pygments-main/pygments/lexers/math.py +2 -1
- data/vendor/pygments-main/pygments/lexers/matlab.py +10 -12
- data/vendor/pygments-main/pygments/lexers/maxima.py +2 -3
- data/vendor/pygments-main/pygments/lexers/meson.py +2 -3
- data/vendor/pygments-main/pygments/lexers/mime.py +4 -4
- data/vendor/pygments-main/pygments/lexers/minecraft.py +24 -27
- data/vendor/pygments-main/pygments/lexers/mips.py +3 -1
- data/vendor/pygments-main/pygments/lexers/ml.py +59 -61
- data/vendor/pygments-main/pygments/lexers/modeling.py +19 -22
- data/vendor/pygments-main/pygments/lexers/modula2.py +2 -3
- data/vendor/pygments-main/pygments/lexers/mojo.py +704 -0
- data/vendor/pygments-main/pygments/lexers/monte.py +2 -3
- data/vendor/pygments-main/pygments/lexers/mosel.py +3 -3
- data/vendor/pygments-main/pygments/lexers/ncl.py +4 -3
- data/vendor/pygments-main/pygments/lexers/nimrod.py +7 -8
- data/vendor/pygments-main/pygments/lexers/nit.py +2 -3
- data/vendor/pygments-main/pygments/lexers/nix.py +40 -31
- data/vendor/pygments-main/pygments/lexers/oberon.py +3 -3
- data/vendor/pygments-main/pygments/lexers/objective.py +14 -6
- data/vendor/pygments-main/pygments/lexers/ooc.py +2 -3
- data/vendor/pygments-main/pygments/lexers/openscad.py +96 -0
- data/vendor/pygments-main/pygments/lexers/other.py +2 -1
- data/vendor/pygments-main/pygments/lexers/parasail.py +2 -3
- data/vendor/pygments-main/pygments/lexers/parsers.py +41 -44
- data/vendor/pygments-main/pygments/lexers/pascal.py +6 -3
- data/vendor/pygments-main/pygments/lexers/pawn.py +5 -5
- data/vendor/pygments-main/pygments/lexers/perl.py +3 -3
- data/vendor/pygments-main/pygments/lexers/phix.py +2 -3
- data/vendor/pygments-main/pygments/lexers/php.py +4 -5
- data/vendor/pygments-main/pygments/lexers/pointless.py +2 -3
- data/vendor/pygments-main/pygments/lexers/pony.py +3 -3
- data/vendor/pygments-main/pygments/lexers/praat.py +2 -3
- data/vendor/pygments-main/pygments/lexers/procfile.py +2 -3
- data/vendor/pygments-main/pygments/lexers/prolog.py +23 -9
- data/vendor/pygments-main/pygments/lexers/promql.py +2 -1
- data/vendor/pygments-main/pygments/lexers/prql.py +251 -0
- data/vendor/pygments-main/pygments/lexers/ptx.py +119 -0
- data/vendor/pygments-main/pygments/lexers/python.py +24 -24
- data/vendor/pygments-main/pygments/lexers/q.py +5 -6
- data/vendor/pygments-main/pygments/lexers/qlik.py +3 -3
- data/vendor/pygments-main/pygments/lexers/qvt.py +5 -3
- data/vendor/pygments-main/pygments/lexers/r.py +8 -6
- data/vendor/pygments-main/pygments/lexers/rdf.py +19 -13
- data/vendor/pygments-main/pygments/lexers/rebol.py +7 -7
- data/vendor/pygments-main/pygments/lexers/resource.py +5 -6
- data/vendor/pygments-main/pygments/lexers/ride.py +4 -5
- data/vendor/pygments-main/pygments/lexers/rita.py +2 -3
- data/vendor/pygments-main/pygments/lexers/rnc.py +2 -3
- data/vendor/pygments-main/pygments/lexers/roboconf.py +5 -5
- data/vendor/pygments-main/pygments/lexers/robotframework.py +2 -3
- data/vendor/pygments-main/pygments/lexers/ruby.py +8 -13
- data/vendor/pygments-main/pygments/lexers/rust.py +9 -10
- data/vendor/pygments-main/pygments/lexers/sas.py +3 -3
- data/vendor/pygments-main/pygments/lexers/savi.py +131 -130
- data/vendor/pygments-main/pygments/lexers/scdoc.py +13 -7
- data/vendor/pygments-main/pygments/lexers/scripting.py +354 -42
- data/vendor/pygments-main/pygments/lexers/sgf.py +2 -3
- data/vendor/pygments-main/pygments/lexers/shell.py +107 -129
- data/vendor/pygments-main/pygments/lexers/sieve.py +3 -3
- data/vendor/pygments-main/pygments/lexers/slash.py +4 -5
- data/vendor/pygments-main/pygments/lexers/smalltalk.py +3 -5
- data/vendor/pygments-main/pygments/lexers/smithy.py +2 -3
- data/vendor/pygments-main/pygments/lexers/smv.py +3 -3
- data/vendor/pygments-main/pygments/lexers/snobol.py +3 -3
- data/vendor/pygments-main/pygments/lexers/solidity.py +3 -3
- data/vendor/pygments-main/pygments/lexers/soong.py +78 -0
- data/vendor/pygments-main/pygments/lexers/sophia.py +3 -4
- data/vendor/pygments-main/pygments/lexers/special.py +8 -3
- data/vendor/pygments-main/pygments/lexers/spice.py +15 -16
- data/vendor/pygments-main/pygments/lexers/sql.py +24 -18
- data/vendor/pygments-main/pygments/lexers/srcinfo.py +3 -3
- data/vendor/pygments-main/pygments/lexers/stata.py +2 -3
- data/vendor/pygments-main/pygments/lexers/supercollider.py +2 -3
- data/vendor/pygments-main/pygments/lexers/tact.py +303 -0
- data/vendor/pygments-main/pygments/lexers/tal.py +13 -10
- data/vendor/pygments-main/pygments/lexers/tcl.py +2 -3
- data/vendor/pygments-main/pygments/lexers/teal.py +2 -3
- data/vendor/pygments-main/pygments/lexers/templates.py +131 -72
- data/vendor/pygments-main/pygments/lexers/teraterm.py +2 -3
- data/vendor/pygments-main/pygments/lexers/testing.py +4 -5
- data/vendor/pygments-main/pygments/lexers/text.py +2 -1
- data/vendor/pygments-main/pygments/lexers/textedit.py +9 -6
- data/vendor/pygments-main/pygments/lexers/textfmts.py +20 -15
- data/vendor/pygments-main/pygments/lexers/theorem.py +41 -115
- data/vendor/pygments-main/pygments/lexers/thingsdb.py +50 -26
- data/vendor/pygments-main/pygments/lexers/tlb.py +3 -1
- data/vendor/pygments-main/pygments/lexers/tls.py +54 -0
- data/vendor/pygments-main/pygments/lexers/tnt.py +2 -3
- data/vendor/pygments-main/pygments/lexers/trafficscript.py +3 -3
- data/vendor/pygments-main/pygments/lexers/typoscript.py +6 -7
- data/vendor/pygments-main/pygments/lexers/typst.py +104 -0
- data/vendor/pygments-main/pygments/lexers/ul4.py +47 -5
- data/vendor/pygments-main/pygments/lexers/unicon.py +9 -7
- data/vendor/pygments-main/pygments/lexers/urbi.py +3 -3
- data/vendor/pygments-main/pygments/lexers/usd.py +6 -11
- data/vendor/pygments-main/pygments/lexers/varnish.py +5 -5
- data/vendor/pygments-main/pygments/lexers/verification.py +4 -5
- data/vendor/pygments-main/pygments/lexers/verifpal.py +65 -0
- data/vendor/pygments-main/pygments/lexers/vip.py +150 -0
- data/vendor/pygments-main/pygments/lexers/vyper.py +140 -0
- data/vendor/pygments-main/pygments/lexers/web.py +2 -1
- data/vendor/pygments-main/pygments/lexers/webassembly.py +2 -3
- data/vendor/pygments-main/pygments/lexers/webidl.py +2 -3
- data/vendor/pygments-main/pygments/lexers/webmisc.py +11 -15
- data/vendor/pygments-main/pygments/lexers/wgsl.py +6 -7
- data/vendor/pygments-main/pygments/lexers/whiley.py +2 -3
- data/vendor/pygments-main/pygments/lexers/wowtoc.py +3 -3
- data/vendor/pygments-main/pygments/lexers/wren.py +3 -4
- data/vendor/pygments-main/pygments/lexers/x10.py +6 -7
- data/vendor/pygments-main/pygments/lexers/xorg.py +2 -1
- data/vendor/pygments-main/pygments/lexers/yang.py +2 -3
- data/vendor/pygments-main/pygments/lexers/yara.py +69 -0
- data/vendor/pygments-main/pygments/lexers/zig.py +2 -1
- data/vendor/pygments-main/pygments/modeline.py +4 -4
- data/vendor/pygments-main/pygments/plugin.py +3 -19
- data/vendor/pygments-main/pygments/regexopt.py +1 -1
- data/vendor/pygments-main/pygments/scanner.py +1 -1
- data/vendor/pygments-main/pygments/sphinxext.py +38 -8
- data/vendor/pygments-main/pygments/style.py +8 -2
- data/vendor/pygments-main/pygments/styles/__init__.py +17 -59
- data/vendor/pygments-main/pygments/styles/_mapping.py +54 -0
- data/vendor/pygments-main/pygments/styles/abap.py +5 -1
- data/vendor/pygments-main/pygments/styles/algol.py +5 -1
- data/vendor/pygments-main/pygments/styles/algol_nu.py +5 -1
- data/vendor/pygments-main/pygments/styles/arduino.py +76 -72
- data/vendor/pygments-main/pygments/styles/autumn.py +6 -1
- data/vendor/pygments-main/pygments/styles/borland.py +6 -1
- data/vendor/pygments-main/pygments/styles/bw.py +6 -1
- data/vendor/pygments-main/pygments/styles/coffee.py +80 -0
- data/vendor/pygments-main/pygments/styles/colorful.py +6 -1
- data/vendor/pygments-main/pygments/styles/default.py +6 -1
- data/vendor/pygments-main/pygments/styles/dracula.py +68 -80
- data/vendor/pygments-main/pygments/styles/emacs.py +6 -1
- data/vendor/pygments-main/pygments/styles/friendly.py +6 -1
- data/vendor/pygments-main/pygments/styles/friendly_grayscale.py +6 -1
- data/vendor/pygments-main/pygments/styles/fruity.py +7 -1
- data/vendor/pygments-main/pygments/styles/gh_dark.py +7 -1
- data/vendor/pygments-main/pygments/styles/gruvbox.py +10 -1
- data/vendor/pygments-main/pygments/styles/igor.py +6 -1
- data/vendor/pygments-main/pygments/styles/inkpot.py +7 -2
- data/vendor/pygments-main/pygments/styles/lightbulb.py +110 -0
- data/vendor/pygments-main/pygments/styles/lilypond.py +8 -2
- data/vendor/pygments-main/pygments/styles/lovelace.py +16 -10
- data/vendor/pygments-main/pygments/styles/manni.py +7 -2
- data/vendor/pygments-main/pygments/styles/material.py +21 -14
- data/vendor/pygments-main/pygments/styles/monokai.py +16 -10
- data/vendor/pygments-main/pygments/styles/murphy.py +7 -2
- data/vendor/pygments-main/pygments/styles/native.py +10 -5
- data/vendor/pygments-main/pygments/styles/nord.py +9 -3
- data/vendor/pygments-main/pygments/styles/onedark.py +6 -2
- data/vendor/pygments-main/pygments/styles/paraiso_dark.py +7 -2
- data/vendor/pygments-main/pygments/styles/paraiso_light.py +7 -2
- data/vendor/pygments-main/pygments/styles/pastie.py +7 -1
- data/vendor/pygments-main/pygments/styles/perldoc.py +7 -1
- data/vendor/pygments-main/pygments/styles/rainbow_dash.py +26 -19
- data/vendor/pygments-main/pygments/styles/rrt.py +8 -2
- data/vendor/pygments-main/pygments/styles/sas.py +6 -1
- data/vendor/pygments-main/pygments/styles/solarized.py +9 -1
- data/vendor/pygments-main/pygments/styles/staroffice.py +6 -1
- data/vendor/pygments-main/pygments/styles/stata_dark.py +6 -2
- data/vendor/pygments-main/pygments/styles/stata_light.py +6 -1
- data/vendor/pygments-main/pygments/styles/tango.py +7 -3
- data/vendor/pygments-main/pygments/styles/trac.py +7 -1
- data/vendor/pygments-main/pygments/styles/vim.py +7 -1
- data/vendor/pygments-main/pygments/styles/vs.py +7 -2
- data/vendor/pygments-main/pygments/styles/xcode.py +6 -1
- data/vendor/pygments-main/pygments/styles/zenburn.py +6 -1
- data/vendor/pygments-main/pygments/token.py +2 -1
- data/vendor/pygments-main/pygments/unistring.py +5 -5
- data/vendor/pygments-main/pygments/util.py +13 -19
- data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/METADATA +14 -13
- data/vendor/pygments-main/pygments-2.18.0.dist-info/RECORD +663 -0
- data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/WHEEL +1 -2
- data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info/licenses}/AUTHORS +13 -0
- metadata +41 -17
- data/vendor/pygments-main/Pygments-2.15.1.dist-info/RECORD +0 -614
- data/vendor/pygments-main/Pygments-2.15.1.dist-info/top_level.txt +0 -1
- /data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/INSTALLER +0 -0
- /data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/REQUESTED +0 -0
- /data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/entry_points.txt +0 -0
- /data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info/licenses}/LICENSE +0 -0
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Formatter for HTML output.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2024 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-2024 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-2024 by the Pygments team.
|
77
77
|
Licensed under the BSD license, see LICENSE for details.
|
78
78
|
-->
|
79
79
|
<html>
|
@@ -323,6 +323,7 @@ class HtmlFormatter(Formatter):
|
|
323
323
|
If set to the path of a ctags file, wrap names in anchor tags that
|
324
324
|
link to their definitions. `lineanchors` should be used, and the
|
325
325
|
tags file should specify line numbers (see the `-n` option to ctags).
|
326
|
+
The tags file is assumed to be encoded in UTF-8.
|
326
327
|
|
327
328
|
.. versionadded:: 1.6
|
328
329
|
|
@@ -487,7 +488,7 @@ class HtmlFormatter(Formatter):
|
|
487
488
|
name = self._get_css_class(ttype)
|
488
489
|
style = ''
|
489
490
|
if ndef['color']:
|
490
|
-
style += 'color:
|
491
|
+
style += 'color: {}; '.format(webify(ndef['color']))
|
491
492
|
if ndef['bold']:
|
492
493
|
style += 'font-weight: bold; '
|
493
494
|
if ndef['italic']:
|
@@ -495,9 +496,9 @@ class HtmlFormatter(Formatter):
|
|
495
496
|
if ndef['underline']:
|
496
497
|
style += 'text-decoration: underline; '
|
497
498
|
if ndef['bgcolor']:
|
498
|
-
style += 'background-color:
|
499
|
+
style += 'background-color: {}; '.format(webify(ndef['bgcolor']))
|
499
500
|
if ndef['border']:
|
500
|
-
style += 'border: 1px solid
|
501
|
+
style += 'border: 1px solid {}; '.format(webify(ndef['border']))
|
501
502
|
if style:
|
502
503
|
t2c[ttype] = name
|
503
504
|
# save len(ttype) to enable ordering the styles by
|
@@ -529,7 +530,7 @@ class HtmlFormatter(Formatter):
|
|
529
530
|
styles.sort()
|
530
531
|
|
531
532
|
lines = [
|
532
|
-
'
|
533
|
+
f'{prefix(cls)} {{ {style} }} /* {repr(ttype)[6:]} */'
|
533
534
|
for (level, ttype, cls, style) in styles
|
534
535
|
]
|
535
536
|
|
@@ -547,24 +548,24 @@ class HtmlFormatter(Formatter):
|
|
547
548
|
if Text in self.ttype2class:
|
548
549
|
text_style = ' ' + self.class2style[self.ttype2class[Text]][0]
|
549
550
|
lines.insert(
|
550
|
-
0, '
|
551
|
+
0, '{}{{ background: {};{} }}'.format(
|
551
552
|
prefix(''), bg_color, text_style
|
552
553
|
)
|
553
554
|
)
|
554
555
|
if hl_color is not None:
|
555
556
|
lines.insert(
|
556
|
-
0, '
|
557
|
+
0, '{} {{ background-color: {} }}'.format(prefix('hll'), hl_color)
|
557
558
|
)
|
558
559
|
|
559
560
|
return lines
|
560
561
|
|
561
562
|
def get_linenos_style_defs(self):
|
562
563
|
lines = [
|
563
|
-
'pre {
|
564
|
-
'td.linenos .normal {
|
565
|
-
'span.linenos {
|
566
|
-
'td.linenos .special {
|
567
|
-
'span.linenos.special {
|
564
|
+
f'pre {{ {self._pre_style} }}',
|
565
|
+
f'td.linenos .normal {{ {self._linenos_style} }}',
|
566
|
+
f'span.linenos {{ {self._linenos_style} }}',
|
567
|
+
f'td.linenos .special {{ {self._linenos_special_style} }}',
|
568
|
+
f'span.linenos.special {{ {self._linenos_special_style} }}',
|
568
569
|
]
|
569
570
|
|
570
571
|
return lines
|
@@ -593,17 +594,15 @@ class HtmlFormatter(Formatter):
|
|
593
594
|
|
594
595
|
@property
|
595
596
|
def _linenos_style(self):
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
)
|
597
|
+
color = self.style.line_number_color
|
598
|
+
background_color = self.style.line_number_background_color
|
599
|
+
return f'color: {color}; background-color: {background_color}; padding-left: 5px; padding-right: 5px;'
|
600
600
|
|
601
601
|
@property
|
602
602
|
def _linenos_special_style(self):
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
)
|
603
|
+
color = self.style.line_number_special_color
|
604
|
+
background_color = self.style.line_number_special_background_color
|
605
|
+
return f'color: {color}; background-color: {background_color}; padding-left: 5px; padding-right: 5px;'
|
607
606
|
|
608
607
|
def _decodeifneeded(self, value):
|
609
608
|
if isinstance(value, bytes):
|
@@ -684,9 +683,9 @@ class HtmlFormatter(Formatter):
|
|
684
683
|
|
685
684
|
if nocls:
|
686
685
|
if special_line:
|
687
|
-
style = ' style="
|
686
|
+
style = f' style="{self._linenos_special_style}"'
|
688
687
|
else:
|
689
|
-
style = ' style="
|
688
|
+
style = f' style="{self._linenos_style}"'
|
690
689
|
else:
|
691
690
|
if special_line:
|
692
691
|
style = ' class="special"'
|
@@ -694,7 +693,7 @@ class HtmlFormatter(Formatter):
|
|
694
693
|
style = ' class="normal"'
|
695
694
|
|
696
695
|
if style:
|
697
|
-
line = '<span
|
696
|
+
line = f'<span{style}>{line}</span>'
|
698
697
|
|
699
698
|
lines.append(line)
|
700
699
|
|
@@ -743,9 +742,9 @@ class HtmlFormatter(Formatter):
|
|
743
742
|
|
744
743
|
if nocls:
|
745
744
|
if special_line:
|
746
|
-
style = ' style="
|
745
|
+
style = f' style="{self._linenos_special_style}"'
|
747
746
|
else:
|
748
|
-
style = ' style="
|
747
|
+
style = f' style="{self._linenos_style}"'
|
749
748
|
else:
|
750
749
|
if special_line:
|
751
750
|
style = ' class="linenos special"'
|
@@ -753,7 +752,7 @@ class HtmlFormatter(Formatter):
|
|
753
752
|
style = ' class="linenos"'
|
754
753
|
|
755
754
|
if style:
|
756
|
-
linenos = '<span
|
755
|
+
linenos = f'<span{style}>{line}</span>'
|
757
756
|
else:
|
758
757
|
linenos = line
|
759
758
|
|
@@ -790,13 +789,13 @@ class HtmlFormatter(Formatter):
|
|
790
789
|
style = []
|
791
790
|
if (self.noclasses and not self.nobackground and
|
792
791
|
self.style.background_color is not None):
|
793
|
-
style.append('background:
|
792
|
+
style.append(f'background: {self.style.background_color}')
|
794
793
|
if self.cssstyles:
|
795
794
|
style.append(self.cssstyles)
|
796
795
|
style = '; '.join(style)
|
797
796
|
|
798
|
-
yield 0, ('<div' + (self.cssclass and ' class="
|
799
|
-
(style and (' style="
|
797
|
+
yield 0, ('<div' + (self.cssclass and f' class="{self.cssclass}"') +
|
798
|
+
(style and (f' style="{style}"')) + '>')
|
800
799
|
yield from inner
|
801
800
|
yield 0, '</div>\n'
|
802
801
|
|
@@ -813,7 +812,7 @@ class HtmlFormatter(Formatter):
|
|
813
812
|
|
814
813
|
# the empty span here is to keep leading empty lines from being
|
815
814
|
# ignored by HTML parsers
|
816
|
-
yield 0, ('<pre' + (style and ' style="
|
815
|
+
yield 0, ('<pre' + (style and f' style="{style}"') + '><span></span>')
|
817
816
|
yield from inner
|
818
817
|
yield 0, '</pre>'
|
819
818
|
|
@@ -842,18 +841,18 @@ class HtmlFormatter(Formatter):
|
|
842
841
|
try:
|
843
842
|
cspan = self.span_element_openers[ttype]
|
844
843
|
except KeyError:
|
845
|
-
title = ' title="
|
844
|
+
title = ' title="{}"'.format('.'.join(ttype)) if self.debug_token_types else ''
|
846
845
|
if nocls:
|
847
846
|
css_style = self._get_css_inline_styles(ttype)
|
848
847
|
if css_style:
|
849
848
|
css_style = self.class2style[css_style][0]
|
850
|
-
cspan = '<span style="
|
849
|
+
cspan = f'<span style="{css_style}"{title}>'
|
851
850
|
else:
|
852
851
|
cspan = ''
|
853
852
|
else:
|
854
853
|
css_class = self._get_css_classes(ttype)
|
855
854
|
if css_class:
|
856
|
-
cspan = '<span class="
|
855
|
+
cspan = f'<span class="{css_class}"{title}>'
|
857
856
|
else:
|
858
857
|
cspan = ''
|
859
858
|
self.span_element_openers[ttype] = cspan
|
@@ -908,7 +907,7 @@ class HtmlFormatter(Formatter):
|
|
908
907
|
def _lookup_ctag(self, token):
|
909
908
|
entry = ctags.TagEntry()
|
910
909
|
if self._ctags.find(entry, token.encode(), 0):
|
911
|
-
return entry['file'], entry['lineNumber']
|
910
|
+
return entry['file'].decode(), entry['lineNumber']
|
912
911
|
else:
|
913
912
|
return None, None
|
914
913
|
|
@@ -926,11 +925,10 @@ class HtmlFormatter(Formatter):
|
|
926
925
|
if self.noclasses:
|
927
926
|
style = ''
|
928
927
|
if self.style.highlight_color is not None:
|
929
|
-
style = (' style="background-color:
|
930
|
-
|
931
|
-
yield 1, '<span%s>%s</span>' % (style, value)
|
928
|
+
style = (f' style="background-color: {self.style.highlight_color}"')
|
929
|
+
yield 1, f'<span{style}>{value}</span>'
|
932
930
|
else:
|
933
|
-
yield 1, '<span class="hll"
|
931
|
+
yield 1, f'<span class="hll">{value}</span>'
|
934
932
|
else:
|
935
933
|
yield 1, value
|
936
934
|
|
@@ -4,10 +4,9 @@
|
|
4
4
|
|
5
5
|
Formatter for Pixmap output.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
|
-
|
11
10
|
import os
|
12
11
|
import sys
|
13
12
|
|
@@ -68,6 +67,15 @@ class FontManager:
|
|
68
67
|
self.font_size = font_size
|
69
68
|
self.fonts = {}
|
70
69
|
self.encoding = None
|
70
|
+
self.variable = False
|
71
|
+
if hasattr(font_name, 'read') or os.path.isfile(font_name):
|
72
|
+
font = ImageFont.truetype(font_name, self.font_size)
|
73
|
+
self.variable = True
|
74
|
+
for style in STYLES:
|
75
|
+
self.fonts[style] = font
|
76
|
+
|
77
|
+
return
|
78
|
+
|
71
79
|
if sys.platform.startswith('win'):
|
72
80
|
if not font_name:
|
73
81
|
self.font_name = DEFAULT_FONT_NAME_WIN
|
@@ -82,7 +90,7 @@ class FontManager:
|
|
82
90
|
self._create_nix()
|
83
91
|
|
84
92
|
def _get_nix_font_path(self, name, style):
|
85
|
-
proc = subprocess.Popen(['fc-list', "
|
93
|
+
proc = subprocess.Popen(['fc-list', f"{name}:style={style}", 'file'],
|
86
94
|
stdout=subprocess.PIPE, stderr=None)
|
87
95
|
stdout, _ = proc.communicate()
|
88
96
|
if proc.returncode == 0:
|
@@ -102,8 +110,7 @@ class FontManager:
|
|
102
110
|
self.fonts['NORMAL'] = ImageFont.truetype(path, self.font_size)
|
103
111
|
break
|
104
112
|
else:
|
105
|
-
raise FontNotFound('No usable fonts named: "
|
106
|
-
self.font_name)
|
113
|
+
raise FontNotFound(f'No usable fonts named: "{self.font_name}"')
|
107
114
|
for style in ('ITALIC', 'BOLD', 'BOLDITALIC'):
|
108
115
|
for stylename in STYLES[style]:
|
109
116
|
path = self._get_nix_font_path(self.font_name, stylename)
|
@@ -134,8 +141,7 @@ class FontManager:
|
|
134
141
|
self.fonts['NORMAL'] = ImageFont.truetype(path, self.font_size)
|
135
142
|
break
|
136
143
|
else:
|
137
|
-
raise FontNotFound('No usable fonts named: "
|
138
|
-
self.font_name)
|
144
|
+
raise FontNotFound(f'No usable fonts named: "{self.font_name}"')
|
139
145
|
for style in ('ITALIC', 'BOLD', 'BOLDITALIC'):
|
140
146
|
for stylename in STYLES[style]:
|
141
147
|
path = self._get_mac_font_path(font_map, self.font_name, stylename)
|
@@ -152,15 +158,14 @@ class FontManager:
|
|
152
158
|
for suffix in ('', ' (TrueType)'):
|
153
159
|
for style in styles:
|
154
160
|
try:
|
155
|
-
valname = '
|
161
|
+
valname = '{}{}{}'.format(basename, style and ' '+style, suffix)
|
156
162
|
val, _ = _winreg.QueryValueEx(key, valname)
|
157
163
|
return val
|
158
164
|
except OSError:
|
159
165
|
continue
|
160
166
|
else:
|
161
167
|
if fail:
|
162
|
-
raise FontNotFound('Font
|
163
|
-
(basename, styles[0]))
|
168
|
+
raise FontNotFound(f'Font {basename} ({styles[0]}) not found in registry')
|
164
169
|
return None
|
165
170
|
|
166
171
|
def _create_win(self):
|
@@ -223,14 +228,43 @@ class FontManager:
|
|
223
228
|
Get the font based on bold and italic flags.
|
224
229
|
"""
|
225
230
|
if bold and oblique:
|
231
|
+
if self.variable:
|
232
|
+
return self.get_style('BOLDITALIC')
|
233
|
+
|
226
234
|
return self.fonts['BOLDITALIC']
|
227
235
|
elif bold:
|
236
|
+
if self.variable:
|
237
|
+
return self.get_style('BOLD')
|
238
|
+
|
228
239
|
return self.fonts['BOLD']
|
229
240
|
elif oblique:
|
241
|
+
if self.variable:
|
242
|
+
return self.get_style('ITALIC')
|
243
|
+
|
230
244
|
return self.fonts['ITALIC']
|
231
245
|
else:
|
246
|
+
if self.variable:
|
247
|
+
return self.get_style('NORMAL')
|
248
|
+
|
232
249
|
return self.fonts['NORMAL']
|
233
250
|
|
251
|
+
def get_style(self, style):
|
252
|
+
"""
|
253
|
+
Get the specified style of the font if it is a variable font.
|
254
|
+
If not found, return the normal font.
|
255
|
+
"""
|
256
|
+
font = self.fonts[style]
|
257
|
+
for style_name in STYLES[style]:
|
258
|
+
try:
|
259
|
+
font.set_variation_by_name(style_name)
|
260
|
+
return font
|
261
|
+
except ValueError:
|
262
|
+
pass
|
263
|
+
except OSError:
|
264
|
+
return font
|
265
|
+
|
266
|
+
return font
|
267
|
+
|
234
268
|
|
235
269
|
class ImageFormatter(Formatter):
|
236
270
|
"""
|
@@ -258,6 +292,8 @@ class ImageFormatter(Formatter):
|
|
258
292
|
The font name to be used as the base font from which others, such as
|
259
293
|
bold and italic fonts will be generated. This really should be a
|
260
294
|
monospace font to look sane.
|
295
|
+
If a filename or a file-like object is specified, the user must
|
296
|
+
provide different styles of the font.
|
261
297
|
|
262
298
|
Default: "Courier New" on Windows, "Menlo" on Mac OS, and
|
263
299
|
"DejaVu Sans Mono" on \\*nix
|
@@ -594,7 +630,11 @@ class ImageFormatter(Formatter):
|
|
594
630
|
fill=self.hl_color)
|
595
631
|
for pos, value, font, text_fg, text_bg in self.drawables:
|
596
632
|
if text_bg:
|
597
|
-
|
633
|
+
# see deprecations https://pillow.readthedocs.io/en/stable/releasenotes/9.2.0.html#font-size-and-offset-methods
|
634
|
+
if hasattr(draw, 'textsize'):
|
635
|
+
text_size = draw.textsize(text=value, font=font)
|
636
|
+
else:
|
637
|
+
text_size = font.getbbox(value)[2:]
|
598
638
|
draw.rectangle([pos[0], pos[1], pos[0] + text_size[0], pos[1] + text_size[1]], fill=text_bg)
|
599
639
|
draw.text(pos, value, font=font, fill=text_fg)
|
600
640
|
im.save(outfile, self.image_format.upper())
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Formatter for LaTeX fancyvrb output.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
@@ -23,21 +23,21 @@ def escape_tex(text, commandprefix):
|
|
23
23
|
return text.replace('\\', '\x00'). \
|
24
24
|
replace('{', '\x01'). \
|
25
25
|
replace('}', '\x02'). \
|
26
|
-
replace('\x00',
|
27
|
-
replace('\x01',
|
28
|
-
replace('\x02',
|
29
|
-
replace('^',
|
30
|
-
replace('_',
|
31
|
-
replace('&',
|
32
|
-
replace('<',
|
33
|
-
replace('>',
|
34
|
-
replace('#',
|
35
|
-
replace('%',
|
36
|
-
replace('$',
|
37
|
-
replace('-',
|
38
|
-
replace("'",
|
39
|
-
replace('"',
|
40
|
-
replace('~',
|
26
|
+
replace('\x00', rf'\{commandprefix}Zbs{{}}'). \
|
27
|
+
replace('\x01', rf'\{commandprefix}Zob{{}}'). \
|
28
|
+
replace('\x02', rf'\{commandprefix}Zcb{{}}'). \
|
29
|
+
replace('^', rf'\{commandprefix}Zca{{}}'). \
|
30
|
+
replace('_', rf'\{commandprefix}Zus{{}}'). \
|
31
|
+
replace('&', rf'\{commandprefix}Zam{{}}'). \
|
32
|
+
replace('<', rf'\{commandprefix}Zlt{{}}'). \
|
33
|
+
replace('>', rf'\{commandprefix}Zgt{{}}'). \
|
34
|
+
replace('#', rf'\{commandprefix}Zsh{{}}'). \
|
35
|
+
replace('%', rf'\{commandprefix}Zpc{{}}'). \
|
36
|
+
replace('$', rf'\{commandprefix}Zdl{{}}'). \
|
37
|
+
replace('-', rf'\{commandprefix}Zhy{{}}'). \
|
38
|
+
replace("'", rf'\{commandprefix}Zsq{{}}'). \
|
39
|
+
replace('"', rf'\{commandprefix}Zdq{{}}'). \
|
40
|
+
replace('~', rf'\{commandprefix}Zti{{}}')
|
41
41
|
|
42
42
|
|
43
43
|
DOC_TEMPLATE = r'''
|
@@ -304,17 +304,14 @@ class LatexFormatter(Formatter):
|
|
304
304
|
if ndef['mono']:
|
305
305
|
cmndef += r'\let\$$@ff=\textsf'
|
306
306
|
if ndef['color']:
|
307
|
-
cmndef += (r'\def\$$@tc##1{\textcolor[rgb]{
|
308
|
-
rgbcolor(ndef['color']))
|
307
|
+
cmndef += (r'\def\$$@tc##1{{\textcolor[rgb]{{{}}}{{##1}}}}'.format(rgbcolor(ndef['color'])))
|
309
308
|
if ndef['border']:
|
310
|
-
cmndef += (r'\def\$$@bc##1{{\setlength{\fboxsep}{\string -\fboxrule}'
|
311
|
-
r'\fcolorbox[rgb]{
|
312
|
-
(rgbcolor(ndef['border']),
|
309
|
+
cmndef += (r'\def\$$@bc##1{{{{\setlength{{\fboxsep}}{{\string -\fboxrule}}'
|
310
|
+
r'\fcolorbox[rgb]{{{}}}{{{}}}{{\strut ##1}}}}}}'.format(rgbcolor(ndef['border']),
|
313
311
|
rgbcolor(ndef['bgcolor'])))
|
314
312
|
elif ndef['bgcolor']:
|
315
|
-
cmndef += (r'\def\$$@bc##1{{\setlength{\fboxsep}{0pt}'
|
316
|
-
r'\colorbox[rgb]{
|
317
|
-
rgbcolor(ndef['bgcolor']))
|
313
|
+
cmndef += (r'\def\$$@bc##1{{{{\setlength{{\fboxsep}}{{0pt}}'
|
314
|
+
r'\colorbox[rgb]{{{}}}{{\strut ##1}}}}}}'.format(rgbcolor(ndef['bgcolor'])))
|
318
315
|
if cmndef == '':
|
319
316
|
continue
|
320
317
|
cmndef = cmndef.replace('$$', cp)
|
@@ -329,7 +326,7 @@ class LatexFormatter(Formatter):
|
|
329
326
|
cp = self.commandprefix
|
330
327
|
styles = []
|
331
328
|
for name, definition in self.cmd2def.items():
|
332
|
-
styles.append(
|
329
|
+
styles.append(rf'\@namedef{{{cp}@tok@{name}}}{{{definition}}}')
|
333
330
|
return STYLE_TEMPLATE % {'cp': self.commandprefix,
|
334
331
|
'styles': '\n'.join(styles)}
|
335
332
|
|
@@ -410,10 +407,10 @@ class LatexFormatter(Formatter):
|
|
410
407
|
spl = value.split('\n')
|
411
408
|
for line in spl[:-1]:
|
412
409
|
if line:
|
413
|
-
outfile.write("
|
410
|
+
outfile.write(f"\\{cp}{{{styleval}}}{{{line}}}")
|
414
411
|
outfile.write('\n')
|
415
412
|
if spl[-1]:
|
416
|
-
outfile.write("
|
413
|
+
outfile.write(f"\\{cp}{{{styleval}}}{{{spl[-1]}}}")
|
417
414
|
else:
|
418
415
|
outfile.write(value)
|
419
416
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Other formatters: NullFormatter, RawTokenFormatter.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
@@ -74,8 +74,7 @@ class RawTokenFormatter(Formatter):
|
|
74
74
|
try:
|
75
75
|
colorize(self.error_color, '')
|
76
76
|
except KeyError:
|
77
|
-
raise ValueError("Invalid color
|
78
|
-
self.error_color)
|
77
|
+
raise ValueError(f"Invalid color {self.error_color!r} specified")
|
79
78
|
|
80
79
|
def format(self, tokensource, outfile):
|
81
80
|
try:
|
@@ -147,7 +146,7 @@ class TestcaseFormatter(Formatter):
|
|
147
146
|
outbuf = []
|
148
147
|
for ttype, value in tokensource:
|
149
148
|
rawbuf.append(value)
|
150
|
-
outbuf.append('
|
149
|
+
outbuf.append(f'{indentation}({ttype}, {value!r}),\n')
|
151
150
|
|
152
151
|
before = TESTCASE_BEFORE % (''.join(rawbuf),)
|
153
152
|
during = ''.join(outbuf)
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Formatter for Pango markup output.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
@@ -45,7 +45,7 @@ class PangoMarkupFormatter(Formatter):
|
|
45
45
|
start = ''
|
46
46
|
end = ''
|
47
47
|
if style['color']:
|
48
|
-
start += '<span fgcolor="
|
48
|
+
start += '<span fgcolor="#{}">'.format(style['color'])
|
49
49
|
end = '</span>' + end
|
50
50
|
if style['bold']:
|
51
51
|
start += '<b>'
|