From 44dd96fc4fe81a4149b01be2855e9974939a6801 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 18 Jul 2022 11:07:29 +0900 Subject: [PATCH] Imported Upstream version 2.7.4 --- AUTHORS | 3 +- CHANGES | 237 +++++++++-------- LICENSE | 2 +- Makefile | 2 +- PKG-INFO | 4 +- Pygments.egg-info/PKG-INFO | 4 +- Pygments.egg-info/SOURCES.txt | 2 + doc/_static/demo.css | 9 + doc/_static/demo.js | 39 ++- doc/_templates/demo.html | 3 + doc/_themes/pygments14/layout.html | 2 +- .../pygments14/static/pygments14.css_t | 2 +- doc/conf.py | 2 +- doc/docs/integrate.rst | 2 +- doc/faq.rst | 2 +- doc/index.rst | 1 - external/markdown-processor.py | 2 +- external/moin-parser.py | 2 +- external/rst-directive.py | 2 +- pygments/__init__.py | 4 +- pygments/__main__.py | 2 +- pygments/cmdline.py | 4 +- pygments/console.py | 2 +- pygments/filter.py | 2 +- pygments/filters/__init__.py | 2 +- pygments/formatter.py | 2 +- pygments/formatters/__init__.py | 2 +- pygments/formatters/_mapping.py | 2 +- pygments/formatters/bbcode.py | 2 +- pygments/formatters/html.py | 21 +- pygments/formatters/img.py | 2 +- pygments/formatters/irc.py | 2 +- pygments/formatters/latex.py | 2 +- pygments/formatters/other.py | 2 +- pygments/formatters/rtf.py | 2 +- pygments/formatters/svg.py | 2 +- pygments/formatters/terminal.py | 2 +- pygments/formatters/terminal256.py | 2 +- pygments/lexer.py | 12 +- pygments/lexers/__init__.py | 2 +- pygments/lexers/_asy_builtins.py | 2 +- pygments/lexers/_cl_builtins.py | 2 +- pygments/lexers/_cocoa_builtins.py | 2 +- pygments/lexers/_csound_builtins.py | 2 +- pygments/lexers/_lasso_builtins.py | 2 +- pygments/lexers/_lua_builtins.py | 2 +- pygments/lexers/_mql_builtins.py | 2 +- pygments/lexers/_openedge_builtins.py | 2 +- pygments/lexers/_php_builtins.py | 2 +- pygments/lexers/_postgres_builtins.py | 2 +- pygments/lexers/_scilab_builtins.py | 2 +- pygments/lexers/_sourcemod_builtins.py | 2 +- pygments/lexers/_stan_builtins.py | 2 +- pygments/lexers/_stata_builtins.py | 2 +- pygments/lexers/_tsql_builtins.py | 2 +- pygments/lexers/_usd_builtins.py | 2 +- pygments/lexers/_vbscript_builtins.py | 2 +- pygments/lexers/_vim_builtins.py | 2 +- pygments/lexers/actionscript.py | 14 +- pygments/lexers/agile.py | 2 +- pygments/lexers/algebra.py | 2 +- pygments/lexers/ambient.py | 4 +- pygments/lexers/ampl.py | 2 +- pygments/lexers/apl.py | 2 +- pygments/lexers/archetype.py | 4 +- pygments/lexers/arrow.py | 2 +- pygments/lexers/asm.py | 2 +- pygments/lexers/automation.py | 2 +- pygments/lexers/bare.py | 2 +- pygments/lexers/basic.py | 2 +- pygments/lexers/bibtex.py | 2 +- pygments/lexers/boa.py | 8 +- pygments/lexers/business.py | 6 +- pygments/lexers/c_cpp.py | 2 +- pygments/lexers/c_like.py | 2 +- pygments/lexers/capnproto.py | 2 +- pygments/lexers/chapel.py | 6 +- pygments/lexers/clean.py | 2 +- pygments/lexers/compiled.py | 2 +- pygments/lexers/configs.py | 10 +- pygments/lexers/console.py | 2 +- pygments/lexers/crystal.py | 131 ++++------ pygments/lexers/csound.py | 2 +- pygments/lexers/css.py | 17 +- pygments/lexers/d.py | 6 +- pygments/lexers/dalvik.py | 2 +- pygments/lexers/data.py | 2 +- pygments/lexers/devicetree.py | 2 +- pygments/lexers/diff.py | 2 +- pygments/lexers/dotnet.py | 14 +- pygments/lexers/dsls.py | 6 +- pygments/lexers/dylan.py | 2 +- pygments/lexers/ecl.py | 2 +- pygments/lexers/eiffel.py | 2 +- pygments/lexers/elm.py | 2 +- pygments/lexers/email.py | 2 +- pygments/lexers/erlang.py | 2 +- pygments/lexers/esoteric.py | 2 +- pygments/lexers/ezhil.py | 2 +- pygments/lexers/factor.py | 6 +- pygments/lexers/fantom.py | 2 +- pygments/lexers/felix.py | 2 +- pygments/lexers/floscript.py | 2 +- pygments/lexers/forth.py | 2 +- pygments/lexers/fortran.py | 12 +- pygments/lexers/foxpro.py | 2 +- pygments/lexers/freefem.py | 2 +- pygments/lexers/functional.py | 2 +- pygments/lexers/gdscript.py | 2 +- pygments/lexers/go.py | 4 +- pygments/lexers/grammar_notation.py | 2 +- pygments/lexers/graph.py | 2 +- pygments/lexers/graphics.py | 6 +- pygments/lexers/haskell.py | 2 +- pygments/lexers/haxe.py | 6 +- pygments/lexers/hdl.py | 2 +- pygments/lexers/hexdump.py | 2 +- pygments/lexers/html.py | 14 +- pygments/lexers/idl.py | 2 +- pygments/lexers/igor.py | 2 +- pygments/lexers/inferno.py | 2 +- pygments/lexers/installers.py | 2 +- pygments/lexers/int_fiction.py | 2 +- pygments/lexers/iolang.py | 4 +- pygments/lexers/j.py | 2 +- pygments/lexers/javascript.py | 109 ++++---- pygments/lexers/julia.py | 2 +- pygments/lexers/jvm.py | 136 +++++----- pygments/lexers/lisp.py | 14 +- pygments/lexers/make.py | 6 +- pygments/lexers/markup.py | 22 +- pygments/lexers/math.py | 2 +- pygments/lexers/matlab.py | 8 +- pygments/lexers/mime.py | 2 +- pygments/lexers/ml.py | 14 +- pygments/lexers/modeling.py | 2 +- pygments/lexers/modula2.py | 6 +- pygments/lexers/monte.py | 2 +- pygments/lexers/mosel.py | 2 +- pygments/lexers/ncl.py | 2 +- pygments/lexers/nimrod.py | 2 +- pygments/lexers/nit.py | 2 +- pygments/lexers/nix.py | 2 +- pygments/lexers/oberon.py | 2 +- pygments/lexers/objective.py | 6 +- pygments/lexers/ooc.py | 2 +- pygments/lexers/other.py | 2 +- pygments/lexers/parasail.py | 2 +- pygments/lexers/parsers.py | 50 ++-- pygments/lexers/pascal.py | 2 +- pygments/lexers/pawn.py | 2 +- pygments/lexers/perl.py | 2 +- pygments/lexers/php.py | 6 +- pygments/lexers/pointless.py | 2 +- pygments/lexers/pony.py | 2 +- pygments/lexers/praat.py | 2 +- pygments/lexers/prolog.py | 6 +- pygments/lexers/promql.py | 2 +- pygments/lexers/python.py | 2 +- pygments/lexers/qvt.py | 2 +- pygments/lexers/r.py | 2 +- pygments/lexers/rdf.py | 2 +- pygments/lexers/rebol.py | 2 +- pygments/lexers/resource.py | 2 +- pygments/lexers/ride.py | 2 +- pygments/lexers/rnc.py | 2 +- pygments/lexers/roboconf.py | 2 +- pygments/lexers/robotframework.py | 2 +- pygments/lexers/ruby.py | 43 ++-- pygments/lexers/rust.py | 2 +- pygments/lexers/sas.py | 2 +- pygments/lexers/scdoc.py | 2 +- pygments/lexers/scripting.py | 10 +- pygments/lexers/sgf.py | 2 +- pygments/lexers/shell.py | 6 +- pygments/lexers/sieve.py | 2 +- pygments/lexers/slash.py | 2 +- pygments/lexers/smalltalk.py | 2 +- pygments/lexers/smv.py | 2 +- pygments/lexers/snobol.py | 2 +- pygments/lexers/solidity.py | 2 +- pygments/lexers/special.py | 38 +-- pygments/lexers/sql.py | 14 +- pygments/lexers/stata.py | 2 +- pygments/lexers/supercollider.py | 6 +- pygments/lexers/tcl.py | 2 +- pygments/lexers/templates.py | 30 +-- pygments/lexers/teraterm.py | 2 +- pygments/lexers/testing.py | 2 +- pygments/lexers/text.py | 2 +- pygments/lexers/textedit.py | 6 +- pygments/lexers/textfmts.py | 2 +- pygments/lexers/theorem.py | 11 +- pygments/lexers/tnt.py | 2 +- pygments/lexers/trafficscript.py | 2 +- pygments/lexers/typoscript.py | 2 +- pygments/lexers/unicon.py | 2 +- pygments/lexers/urbi.py | 6 +- pygments/lexers/usd.py | 2 +- pygments/lexers/varnish.py | 4 +- pygments/lexers/verification.py | 2 +- pygments/lexers/web.py | 2 +- pygments/lexers/webidl.py | 2 +- pygments/lexers/webmisc.py | 9 +- pygments/lexers/whiley.py | 2 +- pygments/lexers/x10.py | 4 +- pygments/lexers/xorg.py | 2 +- pygments/lexers/yang.py | 2 +- pygments/lexers/zig.py | 2 +- pygments/modeline.py | 2 +- pygments/plugin.py | 2 +- pygments/regexopt.py | 2 +- pygments/scanner.py | 2 +- pygments/sphinxext.py | 2 +- pygments/style.py | 2 +- pygments/styles/__init__.py | 2 +- pygments/styles/abap.py | 2 +- pygments/styles/algol.py | 2 +- pygments/styles/algol_nu.py | 2 +- pygments/styles/arduino.py | 2 +- pygments/styles/autumn.py | 2 +- pygments/styles/borland.py | 2 +- pygments/styles/bw.py | 2 +- pygments/styles/colorful.py | 2 +- pygments/styles/default.py | 2 +- pygments/styles/emacs.py | 2 +- pygments/styles/friendly.py | 2 +- pygments/styles/fruity.py | 2 +- pygments/styles/igor.py | 2 +- pygments/styles/inkpot.py | 2 +- pygments/styles/lovelace.py | 2 +- pygments/styles/manni.py | 2 +- pygments/styles/monokai.py | 2 +- pygments/styles/murphy.py | 2 +- pygments/styles/native.py | 2 +- pygments/styles/paraiso_dark.py | 2 +- pygments/styles/paraiso_light.py | 2 +- pygments/styles/pastie.py | 2 +- pygments/styles/perldoc.py | 2 +- pygments/styles/rainbow_dash.py | 2 +- pygments/styles/rrt.py | 2 +- pygments/styles/sas.py | 2 +- pygments/styles/solarized.py | 2 +- pygments/styles/stata_dark.py | 2 +- pygments/styles/stata_light.py | 2 +- pygments/styles/tango.py | 2 +- pygments/styles/trac.py | 2 +- pygments/styles/vim.py | 2 +- pygments/styles/vs.py | 2 +- pygments/styles/xcode.py | 2 +- pygments/token.py | 2 +- pygments/unistring.py | 2 +- pygments/util.py | 6 +- scripts/check_crlf.py | 2 +- scripts/check_sources.py | 4 +- scripts/debug_lexer.py | 43 +++- scripts/get_vimkw.py | 2 +- setup.py | 2 +- tests/__init__.py | 2 +- tests/examplefiles/example.usd | 29 --- tests/examplefiles/matlab_sample | 2 +- tests/examplefiles/test.cr | 16 +- tests/test_analyze_lexer.py | 55 ++-- tests/test_apache_conf.py | 35 ++- tests/test_asm.py | 2 +- tests/test_basic.py | 2 +- tests/test_basic_api.py | 2 +- tests/test_bibtex.py | 2 +- tests/test_cfm.py | 4 +- tests/test_clexer.py | 2 +- tests/test_cmdline.py | 2 +- tests/test_coffeescript.py | 2 +- tests/test_coq.py | 33 +++ tests/test_crystal.py | 239 +++++++++++++++++- tests/test_csound.py | 2 +- tests/test_examplefiles.py | 45 ++-- tests/test_grammar_notation.py | 2 +- tests/test_haskell.py | 2 +- tests/test_hdl.py | 2 +- tests/test_html_formatter.py | 2 +- tests/test_inherit.py | 2 +- tests/test_ini_lexer.py | 81 ++++++ tests/test_irc_formatter.py | 2 +- tests/test_java.py | 2 +- tests/test_javascript.py | 28 +- tests/test_julia.py | 2 +- tests/test_kotlin.py | 2 +- tests/test_latex_formatter.py | 10 +- tests/test_lexers_other.py | 2 +- tests/test_make.py | 2 +- tests/test_markdown_lexer.py | 138 +++++++--- tests/test_matlab.py | 2 +- tests/test_modeline.py | 2 +- tests/test_mysql.py | 2 +- tests/test_objectiveclexer.py | 2 +- tests/test_perllexer.py | 2 +- tests/test_php.py | 2 +- tests/test_praat.py | 2 +- tests/test_promql.py | 2 +- tests/test_properties.py | 2 +- tests/test_python.py | 2 +- tests/test_qbasiclexer.py | 2 +- tests/test_r.py | 2 +- tests/test_rdf.py | 2 +- tests/test_regexlexer.py | 2 +- tests/test_regexopt.py | 2 +- tests/test_rtf_formatter.py | 2 +- tests/test_ruby.py | 2 +- tests/test_shell.py | 44 ++-- tests/test_smarty.py | 2 +- tests/test_sql.py | 2 +- tests/test_terminal_formatter.py | 2 +- tests/test_textfmts.py | 2 +- tests/test_tnt.py | 2 +- tests/test_token.py | 2 +- tests/test_unistring.py | 2 +- tests/test_using_api.py | 2 +- tests/test_util.py | 2 +- tests/test_whiley.py | 2 +- tests/test_yang.py | 2 +- 320 files changed, 1520 insertions(+), 975 deletions(-) create mode 100644 tests/test_coq.py create mode 100644 tests/test_ini_lexer.py diff --git a/AUTHORS b/AUTHORS index f209a8a..a5c9fb5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -78,6 +78,7 @@ Other contributors, listed alphabetically, are: * Michał Górny -- vim modeline support * Alex Gosse -- TrafficScript lexer * Patrick Gotthardt -- PHP namespaces support +* Hubert Gruniaux -- C and C++ lexer improvements * Olivier Guibe -- Asymptote lexer * Phil Hagelberg -- Fennel lexer * Florian Hahn -- Boogie lexer @@ -233,6 +234,6 @@ Other contributors, listed alphabetically, are: * Alex Zimin -- Nemerle lexer * Rob Zimmerman -- Kal lexer * Vincent Zurczak -- Roboconf lexer -* Hubert Gruniaux -- C and C++ lexer improvements +* 15b3 -- Image Formatter improvements Many thanks for all contributions! diff --git a/CHANGES b/CHANGES index 5e0c868..481ead5 100644 --- a/CHANGES +++ b/CHANGES @@ -11,29 +11,67 @@ Version 2.8.0 ------------- (not released yet) + +Version 2.7.4 +------------- +(released January 12, 2021) + +- Updated lexers: + + - Apache configurations: Improve handling of malformed tags (#1656) + - CSS: Add support for variables (#1633, #1666) + - Crystal (#1650, #1670) + - Coq (#1648) + - Fortran: Add missing keywords (#1635, #1665) + - Ini (#1624) + - JavaScript and variants (#1647 -- missing regex flags, #1651) + - Markdown (#1623, #1617) + - Shell + + - Lex trailing whitespace as part of the prompt (#1645) + - Add missing ``in`` keyword (#1652) + + - SQL - Fix keywords (#1668) + - Typescript: Fix incorrect punctuation handling (#1510, #1511) + +- Fix infinite loop in SML lexer (#1625) +- Fix backtracking string regexes in JavaScript/TypeScript, Modula2 + and many other lexers (#1637) +- Limit recursion with nesting Ruby heredocs (#1638) +- Fix a few inefficient regexes for guessing lexers +- Fix the raw token lexer handling of Unicode (#1616) +- Revert a private API change in the HTML formatter (#1655) -- + please note that private APIs remain subject to change! +- Fix several exponential/cubic-complexity regexes found by + Ben Caller/Doyensec (#1675) +- Fix incorrect MATLAB example (#1582) + +Thanks to Google's OSS-Fuzz project for finding many of these bugs. + + Version 2.7.3 ------------- (released December 6, 2020) - Updated lexers: - * Ada (PR#1581) - * HTML (PR#1615, #1614) - * Java (PR#1594, #1586) - * JavaScript (PR#1605, PR#1589, #1588) - * JSON (PR#1569 -- this is a complete rewrite) - * Lean (PR#1601) - * LLVM (PR#1612) - * Mason (PR#1592) - * MySQL (PR#1555, #1551) - * Rust (PR#1608) - * Turtle (PR#1590, #1553) + * Ada (#1581) + * HTML (#1615, #1614) + * Java (#1594, #1586) + * JavaScript (#1605, #1589, #1588) + * JSON (#1569 -- this is a complete rewrite) + * Lean (#1601) + * LLVM (#1612) + * Mason (#1592) + * MySQL (#1555, #1551) + * Rust (#1608) + * Turtle (#1590, #1553) - Deprecated JsonBareObjectLexer, which is now identical to JsonLexer (#1600) -- The ``ImgFormatter`` now calculates the exact character width, which fixes some issues with overlapping text (#1213, PR#1611) -- Documentation fixes (PR#1609, #1599, #1598) -- Fixed duplicated Juttle language alias (#1604, PR#1606) -- Added support for Kotlin scripts (PR#1587) +- The ``ImgFormatter`` now calculates the exact character width, which fixes some issues with overlapping text (#1213, #1611) +- Documentation fixes (#1609, #1599, #1598) +- Fixed duplicated Juttle language alias (#1604, #1606) +- Added support for Kotlin scripts (#1587) - Removed CSS rule which forced margin to 0 @@ -43,18 +81,18 @@ Version 2.7.2 - Updated lexers: - * Latex (PR#1517, #1516) - * LLVM (PR#1565) - * SPARQL (PR#1559) + * Latex (#1517, #1516) + * LLVM (#1565) + * SPARQL (#1559) -- Fixed Python console/traceback lexer problems with custom exceptions without messages (#1548) +- Fix Python console/traceback lexer problems with custom exceptions without messages (#1548) - Allow loading ttc fonts on Mac/image formatter (#1223) -- Improved ``analyze_text`` across a variety of lexers (PR#1549) -- Removed CSS rule which forced the vertical padding to 0 for line numbers (PR#1583, #1579) -- Fixed ``TNTLexer`` crashing on unexpected EOL (#1568, PR#1570) -- ``regexlint`` can be now run locally as part of ``tox`` tests (PR#1557) -- Fixed typos (PR#1550, #1562) -- Added Python 3.9 as a supported version (PR#1554) +- Improve ``analyze_text`` across a variety of lexers (#1549) +- Remove CSS rule which forced the vertical padding to 0 for line numbers (#1583, #1579) +- Fix ``TNTLexer`` crashing on unexpected EOL (#1568, #1570) +- ``regexlint`` can be now run locally as part of ``tox`` tests (#1557) +- Fix typos (#1550, #1562) +- Add Python 3.9 as a supported version (#1554) Version 2.7.1 @@ -70,59 +108,59 @@ Version 2.7.0 - Added lexers: - * Arrow (PR#1481, PR#1499) - * BARE (PR#1488) - * Devicetree (PR#1434) - * F* (PR#1409) - * GDScript (PR#1457) - * Pointless (PR#1494) - * PromQL (PR#1506) - * PsySH (PR#1438) - * Singularity (PR#1285) - * TiddlyWiki5 (PR#1390) - * TNT (PR#1414) - * YANG (PR#1408, PR#1428) + * Arrow (#1481, #1499) + * BARE (#1488) + * Devicetree (#1434) + * F* (#1409) + * GDScript (#1457) + * Pointless (#1494) + * PromQL (#1506) + * PsySH (#1438) + * Singularity (#1285) + * TiddlyWiki5 (#1390) + * TNT (#1414) + * YANG (#1408, #1428) - Updated lexers: - * APL (PR#1503) - * C++ (PR#1350, which also fixes: #1222, #996, #906, #828, #1162, #1166, + * APL (#1503) + * C++ (#1350, which also fixes: #1222, #996, #906, #828, #1162, #1166, #1396) - * Chapel (PR#1423) + * Chapel (#1423) * CMake (#1491) * CSound (#1509) - * Cython (PR#1507) - * Dart (PR#1449) - * Fennel (PR#1535) - * Fortran (PR#1442) - * GAS (PR#1530) - * HTTP (PR#1432, #1520, PR#1521) - * Inform 6 (PR#1461) - * Javascript (PR#1533) - * JSON (#1065, PR#1528) - * Lean (PR#1415) - * Matlab (PR#1399) - * Markdown (#1492, PR#1495) - * MySQL (#975, #1063, #1453, PR#1527) - * NASM (PR#1465) - * Nim (PR#1426) - * PostgreSQL (PR#1513) - * PowerShell (PR#1398, PR#1497) - * Protobuf (PR#1505) - * Robot (PR#1480) - * SQL (PR#1402) - * SystemVerilog (PR#1436, PR#1452, PR#1454, PR#1460, PR#1462, PR#1463, PR#1464, PR#1471, #1496, PR#1504) - * TeraTerm (PR#1337) + * Cython (#1507) + * Dart (#1449) + * Fennel (#1535) + * Fortran (#1442) + * GAS (#1530) + * HTTP (#1432, #1520, #1521) + * Inform 6 (#1461) + * Javascript (#1533) + * JSON (#1065, #1528) + * Lean (#1415) + * Matlab (#1399) + * Markdown (#1492, #1495) + * MySQL (#975, #1063, #1453, #1527) + * NASM (#1465) + * Nim (#1426) + * PostgreSQL (#1513) + * PowerShell (#1398, #1497) + * Protobuf (#1505) + * Robot (#1480) + * SQL (#1402) + * SystemVerilog (#1436, #1452, #1454, #1460, #1462, #1463, #1464, #1471, #1496, #1504) + * TeraTerm (#1337) * XML (#1502) -- Added a new filter for math symbols (PR#1406) -- The Kconfig lexer will match Kconfig derivative names now (PR#1458) -- Improved HTML formatter output (PR#1500) -- ``.markdown`` is now recognized as an extension for Markdown files (PR#1476) -- Fixed line number colors for Solarized (PR#1477, #1356) -- Improvements to exception handling (PR#1478) -- Improvements to tests (PR#1532, PR#1533, PR#1539) -- Various code cleanups (PR#1536, PR#1537, PR#1538) +- Added a new filter for math symbols (#1406) +- The Kconfig lexer will match Kconfig derivative names now (#1458) +- Improved HTML formatter output (#1500) +- ``.markdown`` is now recognized as an extension for Markdown files (#1476) +- Fixed line number colors for Solarized (#1477, #1356) +- Improvements to exception handling (#1478) +- Improvements to tests (#1532, #1533, #1539) +- Various code cleanups (#1536, #1537, #1538) Version 2.6.1 @@ -141,42 +179,43 @@ Version 2.6 - Added lexers: - * Linux kernel logs (PR#1310) - * LLVM MIR (PR#1361) - * MiniScript (PR#1397) - * Mosel (PR#1287, PR#1326) - * Parsing Expression Grammar (PR#1336) - * ReasonML (PR#1386) - * Ride (PR#1319, PR#1321) - * Sieve (PR#1257) - * USD (PR#1290) - * WebIDL (PR#1309) + * Linux kernel logs (#1310) + * LLVM MIR (#1361) + * MiniScript (#1397) + * Mosel (#1287, #1326) + * Parsing Expression Grammar (#1336) + * ReasonML (#1386) + * Ride (#1319, #1321) + * Sieve (#1257) + * USD (#1290) + * WebIDL (#1309) - Updated lexers: - * Apache2 (PR#1378) - * Chapel (PR#1357) - * CSound (PR#1383) - * D (PR#1375, PR#1362) - * Idris (PR#1360) - * Perl6/Raku lexer (PR#1344) - * Python3 (PR#1382, PR#1385) + * Apache2 (#1378) + * Chapel (#1357) + * CSound (#1383) + * D (#1375, #1362) + * Haskell (#1347, #1177) + * Idris (#1360) + * Perl6/Raku lexer (#1344) + * Python3 (#1382, #1385) * Rust: Updated lexer to cover more builtins (mostly macros) and miscellaneous - new syntax (PR#1320) - * SQL: Add temporal support keywords (PR#1402) + new syntax (#1320) + * SQL: Add temporal support keywords (#1402) - The 256-color/true-color terminal formatters now support the italic attribute - in styles (PR#1288) -- Support HTTP 2/3 header (PR#1308) -- Support missing reason in HTTP header (PR#1322) + in styles (#1288) +- Support HTTP 2/3 header (#1308) +- Support missing reason in HTTP header (#1322) - Boogie/Silver: support line continuations and triggers, move contract keywords - to separate category (PR#1299) -- GAS: support C-style comments (PR#1291) -- Fix names in S lexer (PR#1330, PR#1333) -- Fix numeric literals in Ada (PR#1334) -- Recognize ``.mjs`` files as Javascript (PR#1392) -- Recognize ``.eex`` files as Elixir (PR#1387) -- Fix ``re.MULTILINE`` usage (PR#1388) + to separate category (#1299) +- GAS: support C-style comments (#1291) +- Fix names in S lexer (#1330, #1333) +- Fix numeric literals in Ada (#1334) +- Recognize ``.mjs`` files as Javascript (#1392) +- Recognize ``.eex`` files as Elixir (#1387) +- Fix ``re.MULTILINE`` usage (#1388) - Recognize ``pipenv`` and ``poetry`` dependency & lock files (PR#1376) - Improve font search on Windows (#1247) - Remove unused script block (#1401) diff --git a/LICENSE b/LICENSE index 085810e..e1b1566 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2006-2020 by the respective authors (see AUTHORS file). +Copyright (c) 2006-2021 by the respective authors (see AUTHORS file). All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Makefile b/Makefile index 1f8c383..be3e12a 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # # Combines scripts for common tasks. # -# :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. +# :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. # :license: BSD, see LICENSE for details. # diff --git a/PKG-INFO b/PKG-INFO index 00b28af..0802d45 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: Pygments -Version: 2.7.3 +Version: 2.7.4 Summary: Pygments is a syntax highlighting package written in Python. Home-page: https://pygments.org/ Author: Georg Brandl @@ -22,7 +22,7 @@ Description: * a number of output formats, presently HTML, LaTeX, RTF, SVG, all image formats that PIL supports and ANSI sequences * it is usable as a command-line tool and as a library - :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. Keywords: syntax highlighting diff --git a/Pygments.egg-info/PKG-INFO b/Pygments.egg-info/PKG-INFO index 00b28af..0802d45 100644 --- a/Pygments.egg-info/PKG-INFO +++ b/Pygments.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: Pygments -Version: 2.7.3 +Version: 2.7.4 Summary: Pygments is a syntax highlighting package written in Python. Home-page: https://pygments.org/ Author: Georg Brandl @@ -22,7 +22,7 @@ Description: * a number of output formats, presently HTML, LaTeX, RTF, SVG, all image formats that PIL supports and ANSI sequences * it is usable as a command-line tool and as a library - :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. Keywords: syntax highlighting diff --git a/Pygments.egg-info/SOURCES.txt b/Pygments.egg-info/SOURCES.txt index 166b1b1..7c8029e 100644 --- a/Pygments.egg-info/SOURCES.txt +++ b/Pygments.egg-info/SOURCES.txt @@ -322,6 +322,7 @@ tests/test_cfm.py tests/test_clexer.py tests/test_cmdline.py tests/test_coffeescript.py +tests/test_coq.py tests/test_cpp.py tests/test_crystal.py tests/test_csound.py @@ -337,6 +338,7 @@ tests/test_html_formatter_linenos_elements.py tests/test_html_lexer.py tests/test_idris.py tests/test_inherit.py +tests/test_ini_lexer.py tests/test_irc_formatter.py tests/test_java.py tests/test_javascript.py diff --git a/doc/_static/demo.css b/doc/_static/demo.css index 9344291..90ceee2 100644 --- a/doc/_static/demo.css +++ b/doc/_static/demo.css @@ -18,11 +18,20 @@ min-height: 150px; } +#hlcode { + padding: 10px 0; +} + #hlcode pre { background-color: transparent; border-radius: 0; } +#hlcodedl { + text-align: right; + padding: 0 15px; +} + #loading { position: absolute; top: 0; diff --git a/doc/_static/demo.js b/doc/_static/demo.js index f538492..1fc7a08 100644 --- a/doc/_static/demo.js +++ b/doc/_static/demo.js @@ -3,13 +3,21 @@ languagePluginLoader.then(() => { pyodide.loadPackage('Pygments').then(() => { pyodide.runPython('import pygments.lexers, pygments.formatters.html, pygments.styles'); + let qvars = getQueryVariables(); + var lexerlist = pyodide.runPython('list(pygments.lexers.get_all_lexers())'); var sel = document.getElementById("lang"); for (lex of lexerlist) { + if (lex[1][0] === undefined) { + continue; + } var opt = document.createElement("option"); opt.text = lex[0]; opt.value = lex[1][0]; sel.add(opt); + if (lex[1].indexOf(qvars['lexer']) >= 0) { + opt.selected = true; + } } var stylelist = pyodide.runPython('list(pygments.styles.get_all_styles())'); @@ -25,9 +33,25 @@ languagePluginLoader.then(() => { document.getElementById("hlbtn").disabled = false; document.getElementById("loading").style.display = "none"; + + if (qvars['code'] !== undefined) { + document.getElementById("code").value = qvars['code']; + highlight(); + } }); }); +function getQueryVariables() { + var query = window.location.search.substring(1); + var vars = query.split('&'); + var var_obj = {}; + for (var i = 0; i < vars.length; i++) { + var pair = vars[i].split('='); + var_obj[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); + } + return var_obj; +} + function new_file() { pyodide.globals['fname'] = document.getElementById("file").files[0].name; var alias = pyodide.runPython('pygments.lexers.find_lexer_class_for_filename(fname).aliases[0]'); @@ -66,10 +90,16 @@ function highlight() { file.arrayBuffer().then(function(buf) { pyodide.globals['code_mem'] = buf; pyodide.runPython('code = bytes(code_mem)'); + document.getElementById("copy_btn").style.display = "none"; highlight_now(); }); } else { - pyodide.globals['code'] = document.getElementById("code").value; + var code = document.getElementById("code").value; + pyodide.globals['code'] = code; + var link = document.location.origin + document.location.pathname + + "?lexer=" + encodeURIComponent(alias) + "&code=" + encodeURIComponent(code); + document.getElementById("copy_field").value = link; + document.getElementById("copy_btn").style.display = ""; highlight_now(); } } @@ -81,6 +111,13 @@ function highlight_now() { document.getElementById("hlcodedl").style.display = "block"; } +function copy_link() { + var copy_field = document.getElementById("copy_field"); + copy_field.select(); + copy_field.setSelectionRange(0, 99999); + document.execCommand("copy"); +} + function download_code() { var filename = "highlighted.html"; var hlcode = document.getElementById("hlcode").innerHTML; diff --git a/doc/_templates/demo.html b/doc/_templates/demo.html index 6a60df7..912ab3d 100644 --- a/doc/_templates/demo.html +++ b/doc/_templates/demo.html @@ -48,6 +48,9 @@
{% endblock %} diff --git a/doc/_themes/pygments14/layout.html b/doc/_themes/pygments14/layout.html index 909fbf9..7523e91 100644 --- a/doc/_themes/pygments14/layout.html +++ b/doc/_themes/pygments14/layout.html @@ -82,7 +82,7 @@ {% block footer %}