Skip to content

Commit bb96c35

Browse files
committed
Update to Pygments 2.17.0.
1 parent 1aefc25 commit bb96c35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1783
-483
lines changed

codehighlighter/description.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<identifier value="javahelps.codehighlighter"/>
88

9-
<version value="2.5.2"/>
9+
<version value="2.5.3"/>
1010

1111
<update-information>
1212
<src xlink:href="https://raw.githubusercontent.com/jmzambon/libreoffice-code-highlighter/master/codehighlighter.update.xml" />

codehighlighter/python/pythonpath/pygments/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"""
2727
from io import StringIO, BytesIO
2828

29-
__version__ = '2.16.1'
29+
__version__ = '2.17.0'
3030
__docformat__ = 'restructuredtext'
3131

3232
__all__ = ['lex', 'format', 'highlight']

codehighlighter/python/pythonpath/pygments/formatters/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def get_formatter_for_filename(fn, **options):
131131
if name not in _formatter_cache:
132132
_load_formatters(modname)
133133
return _formatter_cache[name](**options)
134-
for cls in find_plugin_formatters():
134+
for _name, cls in find_plugin_formatters():
135135
for filename in cls.filenames:
136136
if _fn_matches(fn, filename):
137137
return cls(**options)

codehighlighter/python/pythonpath/pygments/formatters/html.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ class ``"special"`` (default: ``0``).
323323
If set to the path of a ctags file, wrap names in anchor tags that
324324
link to their definitions. `lineanchors` should be used, and the
325325
tags file should specify line numbers (see the `-n` option to ctags).
326+
The tags file is assumed to be encoded in UTF-8.
326327
327328
.. versionadded:: 1.6
328329
@@ -908,7 +909,7 @@ def _format_lines(self, tokensource):
908909
def _lookup_ctag(self, token):
909910
entry = ctags.TagEntry()
910911
if self._ctags.find(entry, token.encode(), 0):
911-
return entry['file'], entry['lineNumber']
912+
return entry['file'].decode(), entry['lineNumber']
912913
else:
913914
return None, None
914915

codehighlighter/python/pythonpath/pygments/lexer.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -199,20 +199,9 @@ def analyse_text(text):
199199
it's the same as if the return values was ``0.0``.
200200
"""
201201

202-
def get_tokens(self, text, unfiltered=False):
203-
"""
204-
This method is the basic interface of a lexer. It is called by
205-
the `highlight()` function. It must process the text and return an
206-
iterable of ``(tokentype, value)`` pairs from `text`.
202+
def _preprocess_lexer_input(self, text):
203+
"""Apply preprocessing such as decoding the input, removing BOM and normalizing newlines."""
207204

208-
Normally, you don't need to override this method. The default
209-
implementation processes the options recognized by all lexers
210-
(`stripnl`, `stripall` and so on), and then yields all tokens
211-
from `get_tokens_unprocessed()`, with the ``index`` dropped.
212-
213-
If `unfiltered` is set to `True`, the filtering mechanism is
214-
bypassed even if filters are defined.
215-
"""
216205
if not isinstance(text, str):
217206
if self.encoding == 'guess':
218207
text, _ = guess_decode(text)
@@ -255,6 +244,24 @@ def get_tokens(self, text, unfiltered=False):
255244
if self.ensurenl and not text.endswith('\n'):
256245
text += '\n'
257246

247+
return text
248+
249+
def get_tokens(self, text, unfiltered=False):
250+
"""
251+
This method is the basic interface of a lexer. It is called by
252+
the `highlight()` function. It must process the text and return an
253+
iterable of ``(tokentype, value)`` pairs from `text`.
254+
255+
Normally, you don't need to override this method. The default
256+
implementation processes the options recognized by all lexers
257+
(`stripnl`, `stripall` and so on), and then yields all tokens
258+
from `get_tokens_unprocessed()`, with the ``index`` dropped.
259+
260+
If `unfiltered` is set to `True`, the filtering mechanism is
261+
bypassed even if filters are defined.
262+
"""
263+
text = self._preprocess_lexer_input(text)
264+
258265
def streamer():
259266
for _, t, v in self.get_tokens_unprocessed(text):
260267
yield t, v

codehighlighter/python/pythonpath/pygments/lexers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
COMPAT = {
2323
'Python3Lexer': 'PythonLexer',
2424
'Python3TracebackLexer': 'PythonTracebackLexer',
25+
'LeanLexer': 'Lean3Lexer',
2526
}
2627

2728
__all__ = ['get_lexer_by_name', 'get_lexer_for_filename', 'find_lexer_class',

codehighlighter/python/pythonpath/pygments/lexers/_mapping.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,10 @@
247247
'JsgfLexer': ('pygments.lexers.grammar_notation', 'JSGF', ('jsgf',), ('*.jsgf',), ('application/jsgf', 'application/x-jsgf', 'text/jsgf')),
248248
'JsonBareObjectLexer': ('pygments.lexers.data', 'JSONBareObject', (), (), ()),
249249
'JsonLdLexer': ('pygments.lexers.data', 'JSON-LD', ('jsonld', 'json-ld'), ('*.jsonld',), ('application/ld+json',)),
250-
'JsonLexer': ('pygments.lexers.data', 'JSON', ('json', 'json-object'), ('*.json', 'Pipfile.lock'), ('application/json', 'application/json-object')),
250+
'JsonLexer': ('pygments.lexers.data', 'JSON', ('json', 'json-object'), ('*.json', '*.jsonl', '*.ndjson', 'Pipfile.lock'), ('application/json', 'application/json-object', 'application/x-ndjson', 'application/jsonl', 'application/json-seq')),
251251
'JsonnetLexer': ('pygments.lexers.jsonnet', 'Jsonnet', ('jsonnet',), ('*.jsonnet', '*.libsonnet'), ()),
252252
'JspLexer': ('pygments.lexers.templates', 'Java Server Page', ('jsp',), ('*.jsp',), ('application/x-jsp',)),
253+
'JsxLexer': ('pygments.lexers.jsx', 'JSX', ('jsx', 'react'), ('*.jsx', '*.react'), ('text/jsx', 'text/typescript-jsx')),
253254
'JuliaConsoleLexer': ('pygments.lexers.julia', 'Julia console', ('jlcon', 'julia-repl'), (), ()),
254255
'JuliaLexer': ('pygments.lexers.julia', 'Julia', ('julia', 'jl'), ('*.jl',), ('text/x-julia', 'application/x-julia')),
255256
'JuttleLexer': ('pygments.lexers.javascript', 'Juttle', ('juttle',), ('*.juttle',), ('application/juttle', 'application/x-juttle', 'text/x-juttle', 'text/juttle')),
@@ -260,13 +261,16 @@
260261
'KokaLexer': ('pygments.lexers.haskell', 'Koka', ('koka',), ('*.kk', '*.kki'), ('text/x-koka',)),
261262
'KotlinLexer': ('pygments.lexers.jvm', 'Kotlin', ('kotlin',), ('*.kt', '*.kts'), ('text/x-kotlin',)),
262263
'KuinLexer': ('pygments.lexers.kuin', 'Kuin', ('kuin',), ('*.kn',), ()),
264+
'KustoLexer': ('pygments.lexers.kusto', 'Kusto', ('kql', 'kusto'), ('*.kql', '*.kusto', '.csl'), ()),
263265
'LSLLexer': ('pygments.lexers.scripting', 'LSL', ('lsl',), ('*.lsl',), ('text/x-lsl',)),
264266
'LassoCssLexer': ('pygments.lexers.templates', 'CSS+Lasso', ('css+lasso',), (), ('text/css+lasso',)),
265267
'LassoHtmlLexer': ('pygments.lexers.templates', 'HTML+Lasso', ('html+lasso',), (), ('text/html+lasso', 'application/x-httpd-lasso', 'application/x-httpd-lasso[89]')),
266268
'LassoJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Lasso', ('javascript+lasso', 'js+lasso'), (), ('application/x-javascript+lasso', 'text/x-javascript+lasso', 'text/javascript+lasso')),
267269
'LassoLexer': ('pygments.lexers.javascript', 'Lasso', ('lasso', 'lassoscript'), ('*.lasso', '*.lasso[89]'), ('text/x-lasso',)),
268270
'LassoXmlLexer': ('pygments.lexers.templates', 'XML+Lasso', ('xml+lasso',), (), ('application/xml+lasso',)),
269-
'LeanLexer': ('pygments.lexers.theorem', 'Lean', ('lean',), ('*.lean',), ('text/x-lean',)),
271+
'LdaprcLexer': ('pygments.lexers.ldap', 'LDAP configuration file', ('ldapconf', 'ldaprc'), ('.ldaprc', 'ldaprc', 'ldap.conf'), ('text/x-ldapconf',)),
272+
'LdifLexer': ('pygments.lexers.ldap', 'LDIF', ('ldif',), ('*.ldif',), ('text/x-ldif',)),
273+
'Lean3Lexer': ('pygments.lexers.lean', 'Lean', ('lean', 'lean3'), ('*.lean',), ('text/x-lean', 'text/x-lean3')),
270274
'LessCssLexer': ('pygments.lexers.css', 'LessCss', ('less',), ('*.less',), ('text/x-less-css',)),
271275
'LighttpdConfLexer': ('pygments.lexers.configs', 'Lighttpd configuration file', ('lighttpd', 'lighty'), ('lighttpd.conf',), ('text/x-lighttpd-conf',)),
272276
'LilyPondLexer': ('pygments.lexers.lilypond', 'LilyPond', ('lilypond',), ('*.ly',), ()),
@@ -388,6 +392,7 @@
388392
'PromQLLexer': ('pygments.lexers.promql', 'PromQL', ('promql',), ('*.promql',), ()),
389393
'PropertiesLexer': ('pygments.lexers.configs', 'Properties', ('properties', 'jproperties'), ('*.properties',), ('text/x-java-properties',)),
390394
'ProtoBufLexer': ('pygments.lexers.dsls', 'Protocol Buffer', ('protobuf', 'proto'), ('*.proto',), ()),
395+
'PrqlLexer': ('pygments.lexers.prql', 'PRQL', ('prql',), ('*.prql',), ('application/prql', 'application/x-prql')),
391396
'PsyshConsoleLexer': ('pygments.lexers.php', 'PsySH console session for PHP', ('psysh',), (), ()),
392397
'PtxLexer': ('pygments.lexers.ptx', 'PTX', ('ptx',), ('*.ptx',), ('text/x-ptx',)),
393398
'PugLexer': ('pygments.lexers.html', 'Pug', ('pug', 'jade'), ('*.pug', '*.jade'), ('text/x-pug', 'text/x-jade')),
@@ -396,7 +401,7 @@
396401
'Python2Lexer': ('pygments.lexers.python', 'Python 2.x', ('python2', 'py2'), (), ('text/x-python2', 'application/x-python2')),
397402
'Python2TracebackLexer': ('pygments.lexers.python', 'Python 2.x Traceback', ('py2tb',), ('*.py2tb',), ('text/x-python2-traceback',)),
398403
'PythonConsoleLexer': ('pygments.lexers.python', 'Python console session', ('pycon',), (), ('text/x-python-doctest',)),
399-
'PythonLexer': ('pygments.lexers.python', 'Python', ('python', 'py', 'sage', 'python3', 'py3'), ('*.py', '*.pyw', '*.pyi', '*.jy', '*.sage', '*.sc', 'SConstruct', 'SConscript', '*.bzl', 'BUCK', 'BUILD', 'BUILD.bazel', 'WORKSPACE', '*.tac'), ('text/x-python', 'application/x-python', 'text/x-python3', 'application/x-python3')),
404+
'PythonLexer': ('pygments.lexers.python', 'Python', ('python', 'py', 'sage', 'python3', 'py3', 'bazel', 'starlark'), ('*.py', '*.pyw', '*.pyi', '*.jy', '*.sage', '*.sc', 'SConstruct', 'SConscript', '*.bzl', 'BUCK', 'BUILD', 'BUILD.bazel', 'WORKSPACE', '*.tac'), ('text/x-python', 'application/x-python', 'text/x-python3', 'application/x-python3')),
400405
'PythonTracebackLexer': ('pygments.lexers.python', 'Python Traceback', ('pytb', 'py3tb'), ('*.pytb', '*.py3tb'), ('text/x-python-traceback', 'text/x-python3-traceback')),
401406
'PythonUL4Lexer': ('pygments.lexers.ul4', 'Python+UL4', ('py+ul4',), ('*.pyul4',), ()),
402407
'QBasicLexer': ('pygments.lexers.basic', 'QBasic', ('qbasic', 'basic'), ('*.BAS', '*.bas'), ('text/basic',)),
@@ -488,7 +493,7 @@
488493
'SystemdLexer': ('pygments.lexers.configs', 'Systemd', ('systemd',), ('*.service', '*.socket', '*.device', '*.mount', '*.automount', '*.swap', '*.target', '*.path', '*.timer', '*.slice', '*.scope'), ()),
489494
'TAPLexer': ('pygments.lexers.testing', 'TAP', ('tap',), ('*.tap',), ()),
490495
'TNTLexer': ('pygments.lexers.tnt', 'Typographic Number Theory', ('tnt',), ('*.tnt',), ()),
491-
'TOMLLexer': ('pygments.lexers.configs', 'TOML', ('toml',), ('*.toml', 'Pipfile', 'poetry.lock'), ()),
496+
'TOMLLexer': ('pygments.lexers.configs', 'TOML', ('toml',), ('*.toml', 'Pipfile', 'poetry.lock'), ('application/toml',)),
492497
'Tads3Lexer': ('pygments.lexers.int_fiction', 'TADS 3', ('tads3',), ('*.t',), ()),
493498
'TalLexer': ('pygments.lexers.tal', 'Tal', ('tal', 'uxntal'), ('*.tal',), ('text/x-uxntal',)),
494499
'TasmLexer': ('pygments.lexers.asm', 'TASM', ('tasm',), ('*.asm', '*.ASM', '*.tasm'), ('text/x-tasm',)),
@@ -540,6 +545,9 @@
540545
'VerilogLexer': ('pygments.lexers.hdl', 'verilog', ('verilog', 'v'), ('*.v',), ('text/x-verilog',)),
541546
'VhdlLexer': ('pygments.lexers.hdl', 'vhdl', ('vhdl',), ('*.vhdl', '*.vhd'), ('text/x-vhdl',)),
542547
'VimLexer': ('pygments.lexers.textedit', 'VimL', ('vim',), ('*.vim', '.vimrc', '.exrc', '.gvimrc', '_vimrc', '_exrc', '_gvimrc', 'vimrc', 'gvimrc'), ('text/x-vim',)),
548+
'VisualPrologGrammarLexer': ('pygments.lexers.vip', 'Visual Prolog Grammar', ('visualprologgrammar',), ('*.vipgrm',), ()),
549+
'VisualPrologLexer': ('pygments.lexers.vip', 'Visual Prolog', ('visualprolog',), ('*.pro', '*.cl', '*.i', '*.pack', '*.ph'), ()),
550+
'VyperLexer': ('pygments.lexers.vyper', 'Vyper', ('vyper',), ('*.vy',), ()),
543551
'WDiffLexer': ('pygments.lexers.diff', 'WDiff', ('wdiff',), ('*.wdiff',), ()),
544552
'WatLexer': ('pygments.lexers.webassembly', 'WebAssembly', ('wast', 'wat'), ('*.wat', '*.wast'), ()),
545553
'WebIDLLexer': ('pygments.lexers.webidl', 'Web IDL', ('webidl',), ('*.webidl',), ()),

codehighlighter/python/pythonpath/pygments/lexers/algebra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class GAPLexer(RegexLexer):
2525
.. versionadded:: 2.0
2626
"""
2727
name = 'GAP'
28-
url = 'http://www.gap-system.org'
28+
url = 'https://www.gap-system.org'
2929
aliases = ['gap']
3030
filenames = ['*.g', '*.gd', '*.gi', '*.gap']
3131

0 commit comments

Comments
 (0)