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
|
Lexers for non-HTML markup languages.
|
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
|
|
@@ -19,25 +19,26 @@ from pygments.lexers.data import JsonLexer
|
|
19
19
|
from pygments.lexer import RegexLexer, DelegatingLexer, include, bygroups, \
|
20
20
|
using, this, do_insertions, default, words
|
21
21
|
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
22
|
-
Number, Punctuation, Generic, Other, Whitespace
|
22
|
+
Number, Punctuation, Generic, Other, Whitespace, Literal
|
23
23
|
from pygments.util import get_bool_opt, ClassNotFound
|
24
24
|
|
25
25
|
__all__ = ['BBCodeLexer', 'MoinWikiLexer', 'RstLexer', 'TexLexer', 'GroffLexer',
|
26
26
|
'MozPreprocHashLexer', 'MozPreprocPercentLexer',
|
27
27
|
'MozPreprocXulLexer', 'MozPreprocJavascriptLexer',
|
28
|
-
'MozPreprocCssLexer', 'MarkdownLexer', '
|
28
|
+
'MozPreprocCssLexer', 'MarkdownLexer', 'OrgLexer', 'TiddlyWiki5Lexer',
|
29
|
+
'WikitextLexer']
|
29
30
|
|
30
31
|
|
31
32
|
class BBCodeLexer(RegexLexer):
|
32
33
|
"""
|
33
34
|
A lexer that highlights BBCode(-like) syntax.
|
34
|
-
|
35
|
-
.. versionadded:: 0.6
|
36
35
|
"""
|
37
36
|
|
38
37
|
name = 'BBCode'
|
39
38
|
aliases = ['bbcode']
|
40
39
|
mimetypes = ['text/x-bbcode']
|
40
|
+
url = 'https://www.bbcode.org/'
|
41
|
+
version_added = '0.6'
|
41
42
|
|
42
43
|
tokens = {
|
43
44
|
'root': [
|
@@ -64,14 +65,15 @@ class BBCodeLexer(RegexLexer):
|
|
64
65
|
class MoinWikiLexer(RegexLexer):
|
65
66
|
"""
|
66
67
|
For MoinMoin (and Trac) Wiki markup.
|
67
|
-
|
68
|
-
.. versionadded:: 0.7
|
69
68
|
"""
|
70
69
|
|
71
70
|
name = 'MoinMoin/Trac Wiki markup'
|
72
71
|
aliases = ['trac-wiki', 'moin']
|
73
72
|
filenames = []
|
74
73
|
mimetypes = ['text/x-trac-wiki']
|
74
|
+
url = 'https://moinmo.in'
|
75
|
+
version_added = '0.7'
|
76
|
+
|
75
77
|
flags = re.MULTILINE | re.IGNORECASE
|
76
78
|
|
77
79
|
tokens = {
|
@@ -110,8 +112,6 @@ class RstLexer(RegexLexer):
|
|
110
112
|
"""
|
111
113
|
For reStructuredText markup.
|
112
114
|
|
113
|
-
.. versionadded:: 0.7
|
114
|
-
|
115
115
|
Additional options accepted:
|
116
116
|
|
117
117
|
`handlecodeblocks`
|
@@ -127,6 +127,7 @@ class RstLexer(RegexLexer):
|
|
127
127
|
aliases = ['restructuredtext', 'rst', 'rest']
|
128
128
|
filenames = ['*.rst', '*.rest']
|
129
129
|
mimetypes = ["text/x-rst", "text/prs.fallenstein.rst"]
|
130
|
+
version_added = '0.7'
|
130
131
|
flags = re.MULTILINE
|
131
132
|
|
132
133
|
def _handle_sourcecode(self, match):
|
@@ -172,9 +173,7 @@ class RstLexer(RegexLexer):
|
|
172
173
|
# from docutils.parsers.rst.states
|
173
174
|
closers = '\'")]}>\u2019\u201d\xbb!?'
|
174
175
|
unicode_delimiters = '\u2010\u2011\u2012\u2013\u2014\u00a0'
|
175
|
-
end_string_suffix = (
|
176
|
-
% (re.escape(unicode_delimiters),
|
177
|
-
re.escape(closers)))
|
176
|
+
end_string_suffix = (rf'((?=$)|(?=[-/:.,; \n\x00{re.escape(unicode_delimiters)}{re.escape(closers)}]))')
|
178
177
|
|
179
178
|
tokens = {
|
180
179
|
'root': [
|
@@ -222,7 +221,7 @@ class RstLexer(RegexLexer):
|
|
222
221
|
bygroups(Punctuation, Text, Name.Tag, Text, Operator.Word,
|
223
222
|
Punctuation, Text, using(this, state='inline'))),
|
224
223
|
# Comments
|
225
|
-
(r'^ *\.\..*(\n( +.*\n|\n)+)?', Comment
|
224
|
+
(r'^ *\.\..*(\n( +.*\n|\n)+)?', Comment),
|
226
225
|
# Field list marker
|
227
226
|
(r'^( *)(:(?:\\\\|\\:|[^:\n])+:(?=\s))([ \t]*)',
|
228
227
|
bygroups(Text, Name.Class, Text)),
|
@@ -283,6 +282,8 @@ class TexLexer(RegexLexer):
|
|
283
282
|
aliases = ['tex', 'latex']
|
284
283
|
filenames = ['*.tex', '*.aux', '*.toc']
|
285
284
|
mimetypes = ['text/x-tex', 'text/x-latex']
|
285
|
+
url = 'https://tug.org'
|
286
|
+
version_added = ''
|
286
287
|
|
287
288
|
tokens = {
|
288
289
|
'general': [
|
@@ -295,13 +296,13 @@ class TexLexer(RegexLexer):
|
|
295
296
|
(r'\\\(', String, 'inlinemath'),
|
296
297
|
(r'\$\$', String.Backtick, 'displaymath'),
|
297
298
|
(r'\$', String, 'inlinemath'),
|
298
|
-
(r'\\([a-zA-Z]
|
299
|
+
(r'\\([a-zA-Z@_:]+|\S?)', Keyword, 'command'),
|
299
300
|
(r'\\$', Keyword),
|
300
301
|
include('general'),
|
301
302
|
(r'[^\\$%&_^{}]+', Text),
|
302
303
|
],
|
303
304
|
'math': [
|
304
|
-
(r'\\([a-zA-Z]
|
305
|
+
(r'\\([a-zA-Z]+|\S?)', Name.Variable),
|
305
306
|
include('general'),
|
306
307
|
(r'[0-9]+', Number),
|
307
308
|
(r'[-=!+*/()\[\]]', Operator),
|
@@ -336,14 +337,14 @@ class GroffLexer(RegexLexer):
|
|
336
337
|
"""
|
337
338
|
Lexer for the (g)roff typesetting language, supporting groff
|
338
339
|
extensions. Mainly useful for highlighting manpage sources.
|
339
|
-
|
340
|
-
.. versionadded:: 0.6
|
341
340
|
"""
|
342
341
|
|
343
342
|
name = 'Groff'
|
344
343
|
aliases = ['groff', 'nroff', 'man']
|
345
344
|
filenames = ['*.[1-9]', '*.man', '*.1p', '*.3pm']
|
346
345
|
mimetypes = ['application/x-troff', 'text/troff']
|
346
|
+
url = 'https://www.gnu.org/software/groff'
|
347
|
+
version_added = '0.6'
|
347
348
|
|
348
349
|
tokens = {
|
349
350
|
'root': [
|
@@ -393,13 +394,13 @@ class MozPreprocHashLexer(RegexLexer):
|
|
393
394
|
Lexer for Mozilla Preprocessor files (with '#' as the marker).
|
394
395
|
|
395
396
|
Other data is left untouched.
|
396
|
-
|
397
|
-
.. versionadded:: 2.0
|
398
397
|
"""
|
399
398
|
name = 'mozhashpreproc'
|
400
399
|
aliases = [name]
|
401
400
|
filenames = []
|
402
401
|
mimetypes = []
|
402
|
+
url = 'https://firefox-source-docs.mozilla.org/build/buildsystem/preprocessor.html'
|
403
|
+
version_added = '2.0'
|
403
404
|
|
404
405
|
tokens = {
|
405
406
|
'root': [
|
@@ -434,13 +435,13 @@ class MozPreprocPercentLexer(MozPreprocHashLexer):
|
|
434
435
|
Lexer for Mozilla Preprocessor files (with '%' as the marker).
|
435
436
|
|
436
437
|
Other data is left untouched.
|
437
|
-
|
438
|
-
.. versionadded:: 2.0
|
439
438
|
"""
|
440
439
|
name = 'mozpercentpreproc'
|
441
440
|
aliases = [name]
|
442
441
|
filenames = []
|
443
442
|
mimetypes = []
|
443
|
+
url = 'https://firefox-source-docs.mozilla.org/build/buildsystem/preprocessor.html'
|
444
|
+
version_added = '2.0'
|
444
445
|
|
445
446
|
tokens = {
|
446
447
|
'root': [
|
@@ -454,13 +455,13 @@ class MozPreprocXulLexer(DelegatingLexer):
|
|
454
455
|
"""
|
455
456
|
Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
|
456
457
|
`XmlLexer`.
|
457
|
-
|
458
|
-
.. versionadded:: 2.0
|
459
458
|
"""
|
460
459
|
name = "XUL+mozpreproc"
|
461
460
|
aliases = ['xul+mozpreproc']
|
462
461
|
filenames = ['*.xul.in']
|
463
462
|
mimetypes = []
|
463
|
+
url = 'https://firefox-source-docs.mozilla.org/build/buildsystem/preprocessor.html'
|
464
|
+
version_added = '2.0'
|
464
465
|
|
465
466
|
def __init__(self, **options):
|
466
467
|
super().__init__(XmlLexer, MozPreprocHashLexer, **options)
|
@@ -470,13 +471,13 @@ class MozPreprocJavascriptLexer(DelegatingLexer):
|
|
470
471
|
"""
|
471
472
|
Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
|
472
473
|
`JavascriptLexer`.
|
473
|
-
|
474
|
-
.. versionadded:: 2.0
|
475
474
|
"""
|
476
475
|
name = "Javascript+mozpreproc"
|
477
476
|
aliases = ['javascript+mozpreproc']
|
478
477
|
filenames = ['*.js.in']
|
479
478
|
mimetypes = []
|
479
|
+
url = 'https://firefox-source-docs.mozilla.org/build/buildsystem/preprocessor.html'
|
480
|
+
version_added = '2.0'
|
480
481
|
|
481
482
|
def __init__(self, **options):
|
482
483
|
super().__init__(JavascriptLexer, MozPreprocHashLexer, **options)
|
@@ -486,13 +487,13 @@ class MozPreprocCssLexer(DelegatingLexer):
|
|
486
487
|
"""
|
487
488
|
Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
|
488
489
|
`CssLexer`.
|
489
|
-
|
490
|
-
.. versionadded:: 2.0
|
491
490
|
"""
|
492
491
|
name = "CSS+mozpreproc"
|
493
492
|
aliases = ['css+mozpreproc']
|
494
493
|
filenames = ['*.css.in']
|
495
494
|
mimetypes = []
|
495
|
+
url = 'https://firefox-source-docs.mozilla.org/build/buildsystem/preprocessor.html'
|
496
|
+
version_added = '2.0'
|
496
497
|
|
497
498
|
def __init__(self, **options):
|
498
499
|
super().__init__(CssLexer, MozPreprocPercentLexer, **options)
|
@@ -501,43 +502,41 @@ class MozPreprocCssLexer(DelegatingLexer):
|
|
501
502
|
class MarkdownLexer(RegexLexer):
|
502
503
|
"""
|
503
504
|
For Markdown markup.
|
504
|
-
|
505
|
-
.. versionadded:: 2.2
|
506
505
|
"""
|
507
506
|
name = 'Markdown'
|
508
507
|
url = 'https://daringfireball.net/projects/markdown/'
|
509
508
|
aliases = ['markdown', 'md']
|
510
509
|
filenames = ['*.md', '*.markdown']
|
511
510
|
mimetypes = ["text/x-markdown"]
|
511
|
+
version_added = '2.2'
|
512
512
|
flags = re.MULTILINE
|
513
513
|
|
514
514
|
def _handle_codeblock(self, match):
|
515
|
-
"""
|
516
|
-
match args: 1:backticks, 2:lang_name, 3:newline, 4:code, 5:backticks
|
517
|
-
"""
|
518
515
|
from pygments.lexers import get_lexer_by_name
|
519
516
|
|
520
|
-
|
521
|
-
yield match.start(
|
522
|
-
|
523
|
-
|
517
|
+
yield match.start('initial'), String.Backtick, match.group('initial')
|
518
|
+
yield match.start('lang'), String.Backtick, match.group('lang')
|
519
|
+
if match.group('afterlang') is not None:
|
520
|
+
yield match.start('whitespace'), Whitespace, match.group('whitespace')
|
521
|
+
yield match.start('extra'), Text, match.group('extra')
|
522
|
+
yield match.start('newline'), Whitespace, match.group('newline')
|
524
523
|
|
525
524
|
# lookup lexer if wanted and existing
|
526
525
|
lexer = None
|
527
526
|
if self.handlecodeblocks:
|
528
527
|
try:
|
529
|
-
lexer = get_lexer_by_name(
|
528
|
+
lexer = get_lexer_by_name(match.group('lang').strip())
|
530
529
|
except ClassNotFound:
|
531
530
|
pass
|
532
|
-
code = match.group(
|
533
|
-
|
531
|
+
code = match.group('code')
|
534
532
|
# no lexer for this language. handle it like it was a code block
|
535
533
|
if lexer is None:
|
536
|
-
yield match.start(
|
534
|
+
yield match.start('code'), String, code
|
537
535
|
else:
|
536
|
+
# FIXME: aren't the offsets wrong?
|
538
537
|
yield from do_insertions([], lexer.get_tokens_unprocessed(code))
|
539
538
|
|
540
|
-
yield match.start(
|
539
|
+
yield match.start('terminator'), String.Backtick, match.group('terminator')
|
541
540
|
|
542
541
|
tokens = {
|
543
542
|
'root': [
|
@@ -563,7 +562,19 @@ class MarkdownLexer(RegexLexer):
|
|
563
562
|
# code block fenced by 3 backticks
|
564
563
|
(r'^(\s*```\n[\w\W]*?^\s*```$\n)', String.Backtick),
|
565
564
|
# code block with language
|
566
|
-
|
565
|
+
# Some tools include extra stuff after the language name, just
|
566
|
+
# highlight that as text. For example: https://docs.enola.dev/use/execmd
|
567
|
+
(r'''(?x)
|
568
|
+
^(?P<initial>\s*```)
|
569
|
+
(?P<lang>[\w\-]+)
|
570
|
+
(?P<afterlang>
|
571
|
+
(?P<whitespace>[^\S\n]+)
|
572
|
+
(?P<extra>.*))?
|
573
|
+
(?P<newline>\n)
|
574
|
+
(?P<code>(.|\n)*?)
|
575
|
+
(?P<terminator>^\s*```$\n)
|
576
|
+
''',
|
577
|
+
_handle_codeblock),
|
567
578
|
|
568
579
|
include('inline'),
|
569
580
|
],
|
@@ -607,18 +618,125 @@ class MarkdownLexer(RegexLexer):
|
|
607
618
|
self.handlecodeblocks = get_bool_opt(options, 'handlecodeblocks', True)
|
608
619
|
RegexLexer.__init__(self, **options)
|
609
620
|
|
621
|
+
class OrgLexer(RegexLexer):
|
622
|
+
"""
|
623
|
+
For Org Mode markup.
|
624
|
+
"""
|
625
|
+
name = 'Org Mode'
|
626
|
+
url = 'https://orgmode.org'
|
627
|
+
aliases = ['org', 'orgmode', 'org-mode']
|
628
|
+
filenames = ['*.org']
|
629
|
+
mimetypes = ["text/org"]
|
630
|
+
version_added = '2.18'
|
631
|
+
|
632
|
+
def _inline(start, end):
|
633
|
+
return rf'(?<!\w){start}(.|\n(?!\n))+?{end}(?!\w)'
|
634
|
+
|
635
|
+
tokens = {
|
636
|
+
'root': [
|
637
|
+
(r'^# .*', Comment.Single),
|
638
|
+
|
639
|
+
# Headings
|
640
|
+
(r'^(\* )(COMMENT)( .*)',
|
641
|
+
bygroups(Generic.Heading, Comment.Preproc, Generic.Heading)),
|
642
|
+
(r'^(\*\*+ )(COMMENT)( .*)',
|
643
|
+
bygroups(Generic.Subheading, Comment.Preproc, Generic.Subheading)),
|
644
|
+
(r'^(\* )(DONE)( .*)',
|
645
|
+
bygroups(Generic.Heading, Generic.Deleted, Generic.Heading)),
|
646
|
+
(r'^(\*\*+ )(DONE)( .*)',
|
647
|
+
bygroups(Generic.Subheading, Generic.Deleted, Generic.Subheading)),
|
648
|
+
(r'^(\* )(TODO)( .*)',
|
649
|
+
bygroups(Generic.Heading, Generic.Error, Generic.Heading)),
|
650
|
+
(r'^(\*\*+ )(TODO)( .*)',
|
651
|
+
bygroups(Generic.Subheading, Generic.Error, Generic.Subheading)),
|
652
|
+
|
653
|
+
(r'^(\* .+?)( :[a-zA-Z0-9_@:]+:)?$', bygroups(Generic.Heading, Generic.Emph)),
|
654
|
+
(r'^(\*\*+ .+?)( :[a-zA-Z0-9_@:]+:)?$', bygroups(Generic.Subheading, Generic.Emph)),
|
655
|
+
|
656
|
+
# Unordered lists items, including TODO items and description items
|
657
|
+
(r'^(?:( *)([+-] )|( +)(\* ))(\[[ X-]\])?(.+ ::)?',
|
658
|
+
bygroups(Whitespace, Keyword, Whitespace, Keyword, Generic.Prompt, Name.Label)),
|
659
|
+
|
660
|
+
# Ordered list items
|
661
|
+
(r'^( *)([0-9]+[.)])( \[@[0-9]+\])?', bygroups(Whitespace, Keyword, Generic.Emph)),
|
662
|
+
|
663
|
+
# Dynamic blocks
|
664
|
+
(r'(?i)^( *#\+begin: *)((?:.|\n)*?)(^ *#\+end: *$)',
|
665
|
+
bygroups(Operator.Word, using(this), Operator.Word)),
|
666
|
+
|
667
|
+
# Comment blocks
|
668
|
+
(r'(?i)^( *#\+begin_comment *\n)((?:.|\n)*?)(^ *#\+end_comment *$)',
|
669
|
+
bygroups(Operator.Word, Comment.Multiline, Operator.Word)),
|
670
|
+
|
671
|
+
# Source code blocks
|
672
|
+
# TODO: language-dependent syntax highlighting (see Markdown lexer)
|
673
|
+
(r'(?i)^( *#\+begin_src .*)((?:.|\n)*?)(^ *#\+end_src *$)',
|
674
|
+
bygroups(Operator.Word, Text, Operator.Word)),
|
675
|
+
|
676
|
+
# Other blocks
|
677
|
+
(r'(?i)^( *#\+begin_\w+)( *\n)((?:.|\n)*?)(^ *#\+end_\w+)( *$)',
|
678
|
+
bygroups(Operator.Word, Whitespace, Text, Operator.Word, Whitespace)),
|
679
|
+
|
680
|
+
# Keywords
|
681
|
+
(r'^(#\+\w+:)(.*)$', bygroups(Name.Namespace, Text)),
|
682
|
+
|
683
|
+
# Properties and drawers
|
684
|
+
(r'(?i)^( *:\w+: *\n)((?:.|\n)*?)(^ *:end: *$)',
|
685
|
+
bygroups(Name.Decorator, Comment.Special, Name.Decorator)),
|
686
|
+
|
687
|
+
# Line break operator
|
688
|
+
(r'\\\\$', Operator),
|
689
|
+
|
690
|
+
# Deadline, Scheduled, CLOSED
|
691
|
+
(r'(?i)^( *(?:DEADLINE|SCHEDULED): )(<.+?> *)$',
|
692
|
+
bygroups(Generic.Error, Literal.Date)),
|
693
|
+
(r'(?i)^( *CLOSED: )(\[.+?\] *)$',
|
694
|
+
bygroups(Generic.Deleted, Literal.Date)),
|
695
|
+
|
696
|
+
# Bold
|
697
|
+
(_inline(r'\*', r'\*+'), Generic.Strong),
|
698
|
+
# Italic
|
699
|
+
(_inline(r'/', r'/'), Generic.Emph),
|
700
|
+
# Verbatim
|
701
|
+
(_inline(r'=', r'='), String), # TODO token
|
702
|
+
# Code
|
703
|
+
(_inline(r'~', r'~'), String),
|
704
|
+
# Strikethrough
|
705
|
+
(_inline(r'\+', r'\+'), Generic.Deleted),
|
706
|
+
# Underline
|
707
|
+
(_inline(r'_', r'_+'), Generic.EmphStrong),
|
708
|
+
|
709
|
+
# Dates
|
710
|
+
(r'<.+?>', Literal.Date),
|
711
|
+
# Macros
|
712
|
+
(r'\{\{\{.+?\}\}\}', Comment.Preproc),
|
713
|
+
# Footnotes
|
714
|
+
(r'(?<!\[)\[fn:.+?\]', Name.Tag),
|
715
|
+
# Links
|
716
|
+
(r'(?s)(\[\[)(.*?)(\]\[)(.*?)(\]\])',
|
717
|
+
bygroups(Punctuation, Name.Attribute, Punctuation, Name.Tag, Punctuation)),
|
718
|
+
(r'(?s)(\[\[)(.+?)(\]\])', bygroups(Punctuation, Name.Attribute, Punctuation)),
|
719
|
+
(r'(<<)(.+?)(>>)', bygroups(Punctuation, Name.Attribute, Punctuation)),
|
720
|
+
|
721
|
+
# Tables
|
722
|
+
(r'^( *)(\|[ -].*?[ -]\|)$', bygroups(Whitespace, String)),
|
723
|
+
|
724
|
+
# Any other text
|
725
|
+
(r'[^#*+\-0-9:\\/=~_<{\[|\n]+', Text),
|
726
|
+
(r'[#*+\-0-9:\\/=~_<{\[|\n]', Text),
|
727
|
+
],
|
728
|
+
}
|
610
729
|
|
611
730
|
class TiddlyWiki5Lexer(RegexLexer):
|
612
731
|
"""
|
613
732
|
For TiddlyWiki5 markup.
|
614
|
-
|
615
|
-
.. versionadded:: 2.7
|
616
733
|
"""
|
617
734
|
name = 'tiddler'
|
618
735
|
url = 'https://tiddlywiki.com/#TiddlerFiles'
|
619
736
|
aliases = ['tid']
|
620
737
|
filenames = ['*.tid']
|
621
738
|
mimetypes = ["text/vnd.tiddlywiki"]
|
739
|
+
version_added = '2.7'
|
622
740
|
flags = re.MULTILINE
|
623
741
|
|
624
742
|
def _handle_codeblock(self, match):
|
@@ -775,19 +893,18 @@ class WikitextLexer(RegexLexer):
|
|
775
893
|
installations, so we only highlight common syntaxes (built-in or from
|
776
894
|
popular extensions), and also assume templates produce no unbalanced
|
777
895
|
syntaxes.
|
778
|
-
|
779
|
-
.. versionadded:: 2.15
|
780
896
|
"""
|
781
897
|
name = 'Wikitext'
|
782
898
|
url = 'https://www.mediawiki.org/wiki/Wikitext'
|
783
899
|
aliases = ['wikitext', 'mediawiki']
|
784
900
|
filenames = []
|
785
901
|
mimetypes = ['text/x-wiki']
|
902
|
+
version_added = '2.15'
|
786
903
|
flags = re.MULTILINE
|
787
904
|
|
788
905
|
def nowiki_tag_rules(tag_name):
|
789
906
|
return [
|
790
|
-
(
|
907
|
+
(rf'(?i)(</)({tag_name})(\s*)(>)', bygroups(Punctuation,
|
791
908
|
Name.Tag, Whitespace, Punctuation), '#pop'),
|
792
909
|
include('entity'),
|
793
910
|
include('text'),
|
@@ -795,15 +912,15 @@ class WikitextLexer(RegexLexer):
|
|
795
912
|
|
796
913
|
def plaintext_tag_rules(tag_name):
|
797
914
|
return [
|
798
|
-
(
|
915
|
+
(rf'(?si)(.*?)(</)({tag_name})(\s*)(>)', bygroups(Text,
|
799
916
|
Punctuation, Name.Tag, Whitespace, Punctuation), '#pop'),
|
800
917
|
]
|
801
918
|
|
802
|
-
def delegate_tag_rules(tag_name, lexer):
|
919
|
+
def delegate_tag_rules(tag_name, lexer, **lexer_kwargs):
|
803
920
|
return [
|
804
|
-
(
|
921
|
+
(rf'(?i)(</)({tag_name})(\s*)(>)', bygroups(Punctuation,
|
805
922
|
Name.Tag, Whitespace, Punctuation), '#pop'),
|
806
|
-
(
|
923
|
+
(rf'(?si).+?(?=</{tag_name}\s*>)', using(lexer, **lexer_kwargs)),
|
807
924
|
]
|
808
925
|
|
809
926
|
def text_rules(token):
|
@@ -919,7 +1036,9 @@ class WikitextLexer(RegexLexer):
|
|
919
1036
|
variant_langs = {
|
920
1037
|
# ZhConverter.php
|
921
1038
|
'zh', 'zh-hans', 'zh-hant', 'zh-cn', 'zh-hk', 'zh-mo', 'zh-my', 'zh-sg', 'zh-tw',
|
922
|
-
#
|
1039
|
+
# WuuConverter.php
|
1040
|
+
'wuu', 'wuu-hans', 'wuu-hant',
|
1041
|
+
# UzConverter.php
|
923
1042
|
'uz', 'uz-latn', 'uz-cyrl',
|
924
1043
|
# TlyConverter.php
|
925
1044
|
'tly', 'tly-cyrl',
|
@@ -933,8 +1052,6 @@ class WikitextLexer(RegexLexer):
|
|
933
1052
|
'sh-latn', 'sh-cyrl',
|
934
1053
|
# KuConverter.php
|
935
1054
|
'ku', 'ku-arab', 'ku-latn',
|
936
|
-
# KkConverter.php
|
937
|
-
'kk', 'kk-cyrl', 'kk-latn', 'kk-arab', 'kk-kz', 'kk-tr', 'kk-cn',
|
938
1055
|
# IuConverter.php
|
939
1056
|
'iu', 'ike-cans', 'ike-latn',
|
940
1057
|
# GanConverter.php
|
@@ -1007,7 +1124,7 @@ class WikitextLexer(RegexLexer):
|
|
1007
1124
|
(r'(?i)\b(?:{}){}{}*'.format('|'.join(protocols),
|
1008
1125
|
link_address, link_char_class), Name.Label),
|
1009
1126
|
# Magic links
|
1010
|
-
(
|
1127
|
+
(rf'\b(?:RFC|PMID){nbsp_char}+[0-9]+\b',
|
1011
1128
|
Name.Function.Magic),
|
1012
1129
|
(r"""(?x)
|
1013
1130
|
\bISBN {nbsp_char}
|
@@ -1022,7 +1139,7 @@ class WikitextLexer(RegexLexer):
|
|
1022
1139
|
'redirect-inner': [
|
1023
1140
|
(r'(\]\])(\s*?\n)', bygroups(Punctuation, Whitespace), '#pop'),
|
1024
1141
|
(r'(\#)([^#]*?)', bygroups(Punctuation, Name.Label)),
|
1025
|
-
(
|
1142
|
+
(rf'(?i)[{title_char}]+', Name.Tag),
|
1026
1143
|
],
|
1027
1144
|
'list': [
|
1028
1145
|
# Description lists
|
@@ -1039,7 +1156,7 @@ class WikitextLexer(RegexLexer):
|
|
1039
1156
|
include('entity'),
|
1040
1157
|
# Bold & italic
|
1041
1158
|
(r"('')(''')(?!')", bygroups(Generic.Emph,
|
1042
|
-
Generic.
|
1159
|
+
Generic.EmphStrong), 'inline-italic-bold'),
|
1043
1160
|
(r"'''(?!')", Generic.Strong, 'inline-bold'),
|
1044
1161
|
(r"''(?!')", Generic.Emph, 'inline-italic'),
|
1045
1162
|
# Comments & parameters & templates
|
@@ -1049,11 +1166,11 @@ class WikitextLexer(RegexLexer):
|
|
1049
1166
|
r"""(?xi)
|
1050
1167
|
(\[\[)
|
1051
1168
|
(File|Image) (:)
|
1052
|
-
([{}]*)
|
1169
|
+
((?: [{}] | \{{{{2,3}}[^{{}}]*?\}}{{2,3}} | <!--[\s\S]*?--> )*)
|
1053
1170
|
(?: (\#) ([{}]*?) )?
|
1054
1171
|
""".format(title_char, f'{title_char}#'),
|
1055
1172
|
bygroups(Punctuation, Name.Namespace, Punctuation,
|
1056
|
-
|
1173
|
+
using(this, state=['wikilink-name']), Punctuation, Name.Label),
|
1057
1174
|
'medialink-inner'
|
1058
1175
|
),
|
1059
1176
|
# Wikilinks
|
@@ -1061,25 +1178,25 @@ class WikitextLexer(RegexLexer):
|
|
1061
1178
|
r"""(?xi)
|
1062
1179
|
(\[\[)(?!{}) # Should not contain URLs
|
1063
1180
|
(?: ([{}]*) (:))?
|
1064
|
-
([{}]*?)
|
1181
|
+
((?: [{}] | \{{{{2,3}}[^{{}}]*?\}}{{2,3}} | <!--[\s\S]*?--> )*?)
|
1065
1182
|
(?: (\#) ([{}]*?) )?
|
1066
1183
|
(\]\])
|
1067
1184
|
""".format('|'.join(protocols), title_char.replace('/', ''),
|
1068
|
-
|
1185
|
+
title_char, f'{title_char}#'),
|
1069
1186
|
bygroups(Punctuation, Name.Namespace, Punctuation,
|
1070
|
-
|
1187
|
+
using(this, state=['wikilink-name']), Punctuation, Name.Label, Punctuation)
|
1071
1188
|
),
|
1072
1189
|
(
|
1073
1190
|
r"""(?xi)
|
1074
1191
|
(\[\[)(?!{})
|
1075
1192
|
(?: ([{}]*) (:))?
|
1076
|
-
([{}]*?)
|
1193
|
+
((?: [{}] | \{{{{2,3}}[^{{}}]*?\}}{{2,3}} | <!--[\s\S]*?--> )*?)
|
1077
1194
|
(?: (\#) ([{}]*?) )?
|
1078
1195
|
(\|)
|
1079
1196
|
""".format('|'.join(protocols), title_char.replace('/', ''),
|
1080
|
-
|
1197
|
+
title_char, f'{title_char}#'),
|
1081
1198
|
bygroups(Punctuation, Name.Namespace, Punctuation,
|
1082
|
-
|
1199
|
+
using(this, state=['wikilink-name']), Punctuation, Name.Label, Punctuation),
|
1083
1200
|
'wikilink-inner'
|
1084
1201
|
),
|
1085
1202
|
# External links
|
@@ -1177,16 +1294,43 @@ class WikitextLexer(RegexLexer):
|
|
1177
1294
|
# LanguageConverter markups
|
1178
1295
|
(
|
1179
1296
|
r"""(?xi)
|
1180
|
-
(-\{{) #
|
1181
|
-
(
|
1182
|
-
(?:
|
1183
|
-
|
1297
|
+
(-\{{) # Use {{ to escape format()
|
1298
|
+
([^|]) (\|)
|
1299
|
+
(?:
|
1300
|
+
(?: ([^;]*?) (=>))?
|
1301
|
+
(\s* (?:{variants}) \s*) (:)
|
1302
|
+
)?
|
1184
1303
|
""".format(variants='|'.join(variant_langs)),
|
1185
1304
|
bygroups(Punctuation, Keyword, Punctuation,
|
1186
|
-
|
1305
|
+
using(this, state=['root', 'lc-raw']),
|
1306
|
+
Operator, Name.Label, Punctuation),
|
1187
1307
|
'lc-inner'
|
1188
1308
|
),
|
1189
|
-
|
1309
|
+
# LanguageConverter markups: composite conversion grammar
|
1310
|
+
(
|
1311
|
+
r"""(?xi)
|
1312
|
+
(-\{)
|
1313
|
+
([a-z\s;-]*?) (\|)
|
1314
|
+
""",
|
1315
|
+
bygroups(Punctuation,
|
1316
|
+
using(this, state=['root', 'lc-flag']),
|
1317
|
+
Punctuation),
|
1318
|
+
'lc-raw'
|
1319
|
+
),
|
1320
|
+
# LanguageConverter markups: fallbacks
|
1321
|
+
(
|
1322
|
+
r"""(?xi)
|
1323
|
+
(-\{{) (?!\{{) # Use {{ to escape format()
|
1324
|
+
(?: (\s* (?:{variants}) \s*) (:))?
|
1325
|
+
""".format(variants='|'.join(variant_langs)),
|
1326
|
+
bygroups(Punctuation, Name.Label, Punctuation),
|
1327
|
+
'lc-inner'
|
1328
|
+
),
|
1329
|
+
],
|
1330
|
+
'wikilink-name': [
|
1331
|
+
include('replaceable'),
|
1332
|
+
(r'[^{<]+', Name.Tag),
|
1333
|
+
(r'(?s).', Name.Tag),
|
1190
1334
|
],
|
1191
1335
|
'wikilink-inner': [
|
1192
1336
|
# Quit in case of another wikilink
|
@@ -1212,7 +1356,7 @@ class WikitextLexer(RegexLexer):
|
|
1212
1356
|
include('quote-common'),
|
1213
1357
|
(r"('')(''')(?!')", bygroups(Generic.Emph,
|
1214
1358
|
Generic.Strong), ('#pop', 'inline-bold')),
|
1215
|
-
(r"'''(?!')", Generic.
|
1359
|
+
(r"'''(?!')", Generic.EmphStrong, ('#pop', 'inline-italic-bold')),
|
1216
1360
|
(r"''(?!')", Generic.Emph, '#pop'),
|
1217
1361
|
include('inline'),
|
1218
1362
|
include('text-italic'),
|
@@ -1222,35 +1366,41 @@ class WikitextLexer(RegexLexer):
|
|
1222
1366
|
(r"(''')('')(?!')", bygroups(
|
1223
1367
|
Generic.Strong, Generic.Emph), ('#pop', 'inline-italic')),
|
1224
1368
|
(r"'''(?!')", Generic.Strong, '#pop'),
|
1225
|
-
(r"''(?!')", Generic.
|
1369
|
+
(r"''(?!')", Generic.EmphStrong, ('#pop', 'inline-bold-italic')),
|
1226
1370
|
include('inline'),
|
1227
1371
|
include('text-bold'),
|
1228
1372
|
],
|
1229
1373
|
'inline-bold-italic': [
|
1230
1374
|
include('quote-common'),
|
1231
|
-
(r"('')(''')(?!')", bygroups(Generic.
|
1375
|
+
(r"('')(''')(?!')", bygroups(Generic.EmphStrong,
|
1232
1376
|
Generic.Strong), '#pop'),
|
1233
|
-
(r"'''(?!')", Generic.
|
1234
|
-
(r"''(?!')", Generic.
|
1377
|
+
(r"'''(?!')", Generic.EmphStrong, ('#pop', 'inline-italic')),
|
1378
|
+
(r"''(?!')", Generic.EmphStrong, ('#pop', 'inline-bold')),
|
1235
1379
|
include('inline'),
|
1236
|
-
include('text-italic'),
|
1380
|
+
include('text-bold-italic'),
|
1237
1381
|
],
|
1238
1382
|
'inline-italic-bold': [
|
1239
1383
|
include('quote-common'),
|
1240
1384
|
(r"(''')('')(?!')", bygroups(
|
1241
|
-
Generic.
|
1242
|
-
(r"'''(?!')", Generic.
|
1243
|
-
(r"''(?!')", Generic.
|
1244
|
-
include('
|
1385
|
+
Generic.EmphStrong, Generic.Emph), '#pop'),
|
1386
|
+
(r"'''(?!')", Generic.EmphStrong, ('#pop', 'inline-italic')),
|
1387
|
+
(r"''(?!')", Generic.EmphStrong, ('#pop', 'inline-bold')),
|
1388
|
+
include('inline'),
|
1389
|
+
include('text-bold-italic'),
|
1390
|
+
],
|
1391
|
+
'lc-flag': [
|
1392
|
+
(r'\s+', Whitespace),
|
1393
|
+
(r';', Punctuation),
|
1394
|
+
*text_rules(Keyword),
|
1245
1395
|
],
|
1246
1396
|
'lc-inner': [
|
1247
1397
|
(
|
1248
1398
|
r"""(?xi)
|
1249
1399
|
(;)
|
1250
|
-
(?: (
|
1400
|
+
(?: ([^;]*?) (=>))?
|
1251
1401
|
(\s* (?:{variants}) \s*) (:)
|
1252
1402
|
""".format(variants='|'.join(variant_langs)),
|
1253
|
-
bygroups(Punctuation,
|
1403
|
+
bygroups(Punctuation, using(this, state=['root', 'lc-raw']),
|
1254
1404
|
Operator, Name.Label, Punctuation)
|
1255
1405
|
),
|
1256
1406
|
(r';?\s*?\}-', Punctuation, '#pop'),
|
@@ -1276,9 +1426,9 @@ class WikitextLexer(RegexLexer):
|
|
1276
1426
|
'parameter-inner',
|
1277
1427
|
),
|
1278
1428
|
# Magic variables
|
1279
|
-
(r'(?i)(\{\{)(\s*)(
|
1429
|
+
(r'(?i)(\{{\{{)(\s*)({})(\s*)(\}}\}})'.format('|'.join(magic_vars_i)),
|
1280
1430
|
bygroups(Punctuation, Whitespace, Name.Function, Whitespace, Punctuation)),
|
1281
|
-
(r'(\{\{)(\s*)(
|
1431
|
+
(r'(\{{\{{)(\s*)({})(\s*)(\}}\}})'.format('|'.join(magic_vars)),
|
1282
1432
|
bygroups(Punctuation, Whitespace, Name.Function, Whitespace, Punctuation)),
|
1283
1433
|
# Parser functions & templates
|
1284
1434
|
(r'\{\{', Punctuation, 'template-begin-space'),
|
@@ -1304,17 +1454,17 @@ class WikitextLexer(RegexLexer):
|
|
1304
1454
|
(r'\s+', Whitespace),
|
1305
1455
|
# Parser functions
|
1306
1456
|
(
|
1307
|
-
r'(?i)(\#[
|
1457
|
+
r'(?i)(\#[{}]*?|{})(:)'.format(title_char,
|
1308
1458
|
'|'.join(parser_functions_i)),
|
1309
1459
|
bygroups(Name.Function, Punctuation), ('#pop', 'template-inner')
|
1310
1460
|
),
|
1311
1461
|
(
|
1312
|
-
r'(
|
1462
|
+
r'({})(:)'.format('|'.join(parser_functions)),
|
1313
1463
|
bygroups(Name.Function, Punctuation), ('#pop', 'template-inner')
|
1314
1464
|
),
|
1315
1465
|
# Templates
|
1316
1466
|
(
|
1317
|
-
|
1467
|
+
rf'(?i)([{title_char}]*?)(:)',
|
1318
1468
|
bygroups(Name.Namespace, Punctuation), ('#pop', 'template-name')
|
1319
1469
|
),
|
1320
1470
|
default(('#pop', 'template-name'),),
|
@@ -1493,11 +1643,12 @@ class WikitextLexer(RegexLexer):
|
|
1493
1643
|
'tag-gallery': plaintext_tag_rules('gallery'),
|
1494
1644
|
'tag-graph': plaintext_tag_rules('graph'),
|
1495
1645
|
'tag-rss': plaintext_tag_rules('rss'),
|
1496
|
-
'tag-math': delegate_tag_rules('math', TexLexer),
|
1497
|
-
'tag-chem': delegate_tag_rules('chem', TexLexer),
|
1498
|
-
'tag-ce': delegate_tag_rules('ce', TexLexer),
|
1646
|
+
'tag-math': delegate_tag_rules('math', TexLexer, state='math'),
|
1647
|
+
'tag-chem': delegate_tag_rules('chem', TexLexer, state='math'),
|
1648
|
+
'tag-ce': delegate_tag_rules('ce', TexLexer, state='math'),
|
1499
1649
|
'tag-templatedata': delegate_tag_rules('templatedata', JsonLexer),
|
1500
1650
|
'text-italic': text_rules(Generic.Emph),
|
1501
1651
|
'text-bold': text_rules(Generic.Strong),
|
1652
|
+
'text-bold-italic': text_rules(Generic.EmphStrong),
|
1502
1653
|
'text': text_rules(Text),
|
1503
1654
|
}
|