Commit graph

1260 commits

Author SHA1 Message Date
Daimona Eaytoy 52ac696e25 Replace deprecated MWException
Bug: T328220
Change-Id: Iaf4a9bb4aafc741395d5ccc5a42c6a72b5d42b99
2023-06-08 11:14:08 +00:00
jenkins-bot 81f673bc6d Merge "Pygmentize: Treat Shellbox network loss like non-zero exit code" 2023-06-06 23:55:12 +00:00
Ed Sanders 274cc4ab77 Always use the strict equality flag when using in_array
Change-Id: Iedd51f31db2bc4e5257d211719f8bdcf1abb09dd
2023-06-06 13:35:40 +01:00
Timo Tijhof 682fe922f9 Pygmentize: Treat Shellbox network loss like non-zero exit code
Prior to the shellbox migration, if during the parsing of a page,
pygmentize failed (i.e. non-zero exit from its local shell command,
pretty much the only way a php shell exec could fail), then
SyntaxHighlight would fallback to outputting a preformatted plain
`<pre>`.

The logic still exists in the code, and is still triggered for cases
where the command reached shellbox and its result was "successfully"
communicated to MediaWiki (HTTP 200), with the boxed result reporting
the non-zero exit code on the shellbox server.

However, the more likely scenario in the new setup is that the command
times out or never reaches the server in the first place, in which
case we don't get any shell exit code. Instead, we get a Shellbox
exception since the result is unknowable.

Instead of fatalling the entire pageview with a PHP exception and
HTTP 500 from MW, use the same graceful fallback.

Bug: T292663
Change-Id: Icaa8c34ff97ad8a99d044beab529ef943071269c
2023-06-03 14:25:50 +01:00
libraryupgrader ca0ed556a9 build: Updating npm dependencies
* grunt-banana-checker: 0.10.0 → 0.11.0
* stylelint-config-wikimedia: 0.14.0 → 0.15.0

Change-Id: Ifcc811fadf80d1865a55e8f70e0429673ae72b98
2023-06-02 03:55:33 +00:00
Translation updater bot c0ca0d343b Localisation updates from https://translatewiki.net.
Change-Id: I4075423bb207961d43839c811238bd15534e761f
2023-05-23 08:23:06 +02:00
Tim Starling 54b02b02e1 Migrate ResourceLoaderSyntaxHighlightVisualEditorModule to a virtual file callback
Depends-On: I97d61b5793159cea365740e0563f7b733e0f16de
Bug: T47514
Change-Id: I10fceeee808e4d08f7ed63afb13b4d87129365c7
2023-05-08 17:15:48 +10:00
libraryupgrader 13c7d46076 build: Updating eslint-config-wikimedia to 0.25.0
Change-Id: I9d27d063d5f8983127929b117248b489056c8c97
2023-05-05 18:05:47 +00:00
libraryupgrader f0d5eca0ed build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.12.0 → 0.12.1

npm:
* grunt-eslint: 24.0.0 → 24.0.1

Change-Id: I21b929710f0eada0f2ed5c6ae793bbe35f6f93df
2023-04-29 12:09:08 +00:00
Bryan Davis 9f9c13bb7c Update Pygments to 2.15.0
Bump embedded Pygments version from 2.11.2 to 2.15.0. Changes
<https://github.com/pygments/pygments/compare/2.11.2...2.15.0>.

Pygments 2.15.0 includes support for MediaWiki's wikitext for the first time
ever (T29828).

New lexers: art, arturo, be, berry, carbon, comal, comal80, cplint,
css+ul4, dax, fc, fif, fift, func, gap-console, gap-repl, hcl, html+ul4,
jmespath, jp, js+ul4, jsonnet, k, linuxconfig, lobas, macaulay2, mcf,
mcfunction, mcschema, mediawiki, mips, oobas, phix, portugol,
postgres-explain, py+ul4, q, qlik, qlikscript, qliksense, qlikview,
snbt, sobas, sql+jinja, tal, tlb, ul4, unixconfig, uxntal, wsgl,
wikitext, wowtoc, wren, x++, xml+ul4, xpp

Bug: T334433
Change-Id: I80576c0782b8b6d4b5bfd0596f72d81c4f9346a8
2023-04-10 21:33:05 +00:00
Meno25 85f0eea957 Minor update for README
* Use https instead of http

Change-Id: I56bdd89e0d3dfb11c5e51b62b7999c9c82474da3
2023-04-10 11:41:21 +00:00
Umherirrender 00595fd798 stylelint: Enable selector-pseudo-element-colon-notation
Via stylelint --fix

Change-Id: I544aaa852df15c2b3088c65115f812e75c93f994
2023-03-30 01:00:39 +02:00
Translation updater bot de3ac99e0d Localisation updates from https://translatewiki.net.
Change-Id: I49f94652526f995f82c0cd6a7429b04ad05ec94d
2023-03-22 09:16:33 +01:00
libraryupgrader 6a0c7826b0 build: Updating npm dependencies
* eslint-config-wikimedia: 0.22.1 → 0.24.0
* grunt: 1.5.3 → 1.6.1
* stylelint-config-wikimedia: 0.13.1 → 0.14.0
  The following rules are failing and were disabled:
  * selector-pseudo-element-colon-notation

Change-Id: Ia16224c8a403ef78a6cce4d6b7d06775c2dc908d
2023-03-16 07:49:25 +00:00
Translation updater bot 443e6bcf68 Localisation updates from https://translatewiki.net.
Change-Id: I6ae3ab1d323a889702d0d3363eb6a76c8b990730
2023-03-15 08:50:39 +01:00
libraryupgrader f02a3a2821 build: Updating mediawiki/mediawiki-codesniffer to 41.0.0
Change-Id: If734e97b623b72d9dc63f6b1e054467c91ca82f2
2023-03-12 11:40:26 +00:00
Ed Sanders e39f530bfb Document the linelinks attribute and load JS when used
Change-Id: Iaf6e2ef58e85ac92e5fcf9dd3449baae927feb9c
2023-03-09 12:48:55 +00:00
Translation updater bot 510e00d19b Localisation updates from https://translatewiki.net.
Change-Id: I0739dc40be8dbfbdd33c6858e8698ccbc6f264f4
2023-02-27 08:28:20 +01:00
C. Scott Ananian 2f4f3c962f parserTests.txt: Add nohtml option to accomodate test runner change
This makes the parserTests compatible with change
I61a67a0e6928463e3872be9a42ff6992c6754662 in core.

Change-Id: I5c22f456a3ae5ea25b59c4246d68965099c465cc
2023-02-09 23:36:00 -05:00
Translation updater bot 02c514fd14 Localisation updates from https://translatewiki.net.
Change-Id: I78c21ef61a3fde83ed2d26c49566a54eea8ee24c
2023-01-03 08:21:36 +01:00
Translation updater bot 91f7fc1b9b Localisation updates from https://translatewiki.net.
Change-Id: I479501f404c825d80ba8a7f74c723e43cd73bc10
2022-12-23 09:08:21 +01:00
Translation updater bot 881fc7d083 Localisation updates from https://translatewiki.net.
Change-Id: I50094fa10bbc38f7440b092c7934223bd0e95c0f
2022-12-21 09:18:07 +01:00
jenkins-bot 14cb8415da Merge "fetchLexers: Pass '--json' to Pygmentize" 2022-12-21 01:00:30 +00:00
Ori Livneh 508e926b5d fetchLexers: Pass '--json' to Pygmentize
Use the '--json' flag to get Pygments to output its list of supported
lexers in a machine-readable format. Support for this flag was added (at
our request) to Pygments and included in the 2.11 release[1].

Tested by running updateLexerList.php and confirming empty diff.

  [1]: https://github.com/pygments/pygments/issues/1437

Change-Id: I0f1d7fceca9034e6034bafa6a8dd312b99d379d1
2022-12-20 23:18:55 +00:00
jenkins-bot 4fead6c331 Merge "Fix lexer list parsing on Windows" 2022-12-20 22:40:50 +00:00
libraryupgrader f90b6bd647 build: Updating qs to 6.11.0
* https://github.com/advisories/GHSA-hrpp-h998-j3pp

Change-Id: I2b126cc32af89269b2ac5da8de13448f29db5cb1
2022-12-07 03:45:02 +00:00
jenkins-bot 362ca84426 Merge "Make the code size limit for highlighting configurable" 2022-11-26 12:54:41 +00:00
Translation updater bot 891e291741 Localisation updates from https://translatewiki.net.
Change-Id: I324ccdcd5b9ffb17b75f0c46e98e6a09c738d13c
2022-11-24 08:18:18 +01:00
Ryan Schmidt 2ae82c7fb7 Fix lexer list parsing on Windows
When using a non-bundled Pygments (which is required on Windows, as the
bundled version is an ELF binary), we call into the Pygments executable
to generate the list of supported languages (lexers). This list seems to
occasionally include carraige returns, causing some languages to not be
processed correctly. Trim those CRs out so the language list is
accurate.

Change-Id: If8b1f145dd10e2c4707d6d32927e85d1d2459f15
2022-11-20 22:46:55 -07:00
libraryupgrader 27ca45e8cb build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 39.0.0 → 40.0.1

npm:
* stylelint-config-wikimedia: 0.13.0 → 0.13.1

Change-Id: Ifd15d37271ad474c948e9187b7b6bccc1f336489
2022-11-16 23:22:01 +00:00
libraryupgrader b4e5ef0a41 build: Updating grunt-stylelint to 0.18.0
Change-Id: I4c52e2c0121f617c04e32a04b3e7bec785606e8f
2022-11-13 09:48:07 +00:00
jenkins-bot 1351b2e427 Merge "Count only real highlighting as expensive parser tag hooks" 2022-11-11 09:18:52 +00:00
Translation updater bot 9ccc4102d2 Localisation updates from https://translatewiki.net.
Change-Id: I5202cfa8a0d62cfd7abab552f59afaeda1134118
2022-11-08 08:21:36 +01:00
Translation updater bot 04fdbe067a Localisation updates from https://translatewiki.net.
Change-Id: I76f62f6250ed602b845ea8a1c1ca6df5aed1acb0
2022-11-07 08:35:53 +01:00
Translation updater bot 52771e543a Localisation updates from https://translatewiki.net.
Change-Id: I9532f479758354b1b62a9e4a1034db9ffaa2aab3
2022-11-04 09:04:03 +01:00
alex4401 90ee9a9774
Make the code size limit for highlighting configurable
Replacing the HIGHLIGHT_MAX_LINES and HIGHLIGHT_MAX_BYTES constants with $wgSyntaxHighlightMaxLines and $wgSyntaxHighlightMaxBytes respectively, so sysadmins can adjust the limits to their needs if performance is not of their concern.

Bug: T322293
Bug: T104109
Change-Id: I80768d3cb45ac01c004fc812832878c83ca4ecdb
2022-11-03 12:04:35 +01:00
Ryan Schmidt d7a6038211 Fix pygments on Windows
Python on Windows requires the SystemRoot environment variable in order
to initialize its internal RNG, so make sure that is passed along to the
subprocess.

Bug: T300223
Change-Id: I170ce627a3f00c023f4b1f11613f4fe2cb17bd31
2022-11-02 19:02:59 -07:00
Reedy d94fec0141 Remove global class alias
Change-Id: I334a6ce9040385b11f30bb5d25e45bb124e0acce
2022-10-31 23:07:39 +00:00
thiemowmde 0b13847937 Avoid dirty diffs when editing code blocks with line numbers
Steps to reproduce:
* Make a wikitext page with <syntaxhighlight line="sure">…</…>.
* Edit with VisualEditor and make an unrelated change to the content.
* Save.
* Before the attribute was always replaced with line="1".
* With this patch the old value stays untouched.

Change-Id: I433a206905c1a0a1bc06ef8b4037f6db9d935810
2022-10-26 12:59:32 +00:00
libraryupgrader fb95fb983b build: Updating minimatch to 3.0.8
* https://github.com/advisories/GHSA-f8q6-p94x-37v3

Change-Id: I30f052b224f9a1c9c5845ba5f4f0e2d46eeab4cb
2022-10-21 20:13:08 +00:00
Translation updater bot 8f94c63f80 Localisation updates from https://translatewiki.net.
Change-Id: Ib3ddbc394df160c618cc9ca48cbe127f7eb6667e
2022-10-19 08:20:55 +02:00
Translation updater bot 75c8d150ce Localisation updates from https://translatewiki.net.
Change-Id: Ie5fed80fdf36c5c6aede62864da8e3fb41a022d3
2022-10-10 10:21:22 +02:00
Umherirrender fe6415836d Count only real highlighting as expensive parser tag hooks
Skip the expensive check,
for example when no highlighting is wanted because there is no lexer

Also all validation of the tag is now processed and
invalid tags also not counted.

Bug: T316858
Change-Id: Ifad9a9a14fae92463c345fb12defb41f14c2e1f3
2022-10-09 18:22:02 +02:00
libraryupgrader 6ca610c484 build: Updating mediawiki/mediawiki-phan-config to 0.12.0
Change-Id: Ibd65a9af17ac74a26b2ca065d5b155d8d5151645
2022-10-09 10:57:27 +00:00
libraryupgrader 07738f210c build: Updating grunt-banana-checker to 0.10.0
Change-Id: I7c9cf57a5f67924475132634f432eb778c2fad4e
2022-10-07 07:27:43 +00:00
Translation updater bot 7fd19917f7 Localisation updates from https://translatewiki.net.
Change-Id: Iebc92fed690999cf7c6e75fcc30075ba96f3a10a
2022-09-28 08:22:55 +02:00
Translation updater bot c45bcfbac6 Localisation updates from https://translatewiki.net.
Change-Id: Ic1ac1ebe512784246be76f348bc6251c1bcbfc3d
2022-09-26 08:16:27 +02:00
Umherirrender 0cb5db91b8 Track syntaxhighlighting as expensive parser tag hook
The shell out to get styled text is expensive.
Call Parser::incrementExpensiveFunctionCount to limit the highlighted
text snippet on a page and not reaching a timeout.

This would count each tag and not deduplicate the text snippet to count
only once or if pygmentize needs to call or is in the cache.
This also not affect Parsoid, not sure if the concept of expensive
parser function exists there

Bug: T316858
Change-Id: I8afe61e9be4a34e5f0725a9b65ef43c345e1be5f
2022-09-07 21:41:17 +02:00
Translation updater bot bcaee9864f Localisation updates from https://translatewiki.net.
Change-Id: I2afb257722b289a6faac10f8d60ad05ea032722d
2022-09-05 10:12:00 +02:00
Ed Sanders f2613d589c Line number highlight: Use getTargetFromFragment
Bug: T315872
Depends-On: I605a24c708e60ccffde9dce524485f61fd5c7b06
Change-Id: I48c1aaf56ccea232dca7cb52f24a29a421b94d86
2022-08-31 13:10:18 +00:00