Commit graph

1114 commits

Author SHA1 Message Date
Kunal Mehta af6654e5f9 Port to BoxedCommand
All of the interactions with `pygmentize` have been refactored into a
new class, conviently called Pygmentize. It is responsible for getting

* pygments version (cached in APCu for 1 hour)
* generated CSS (cached in WAN by version for 1 week)
* lexer list (cached in APCu by version for 1 day)

and actually highlighting stuff! Most code paths differentiate whether
we're using a bundled version of pygments or one that has been
explicitly configured. If using the bundled one, we take shortcuts since
we already know the lexer list, have the CSS generated, etc.

ResourceLoaderPygmentsModule is added to switch between loading
generated CSS from the bundled file or Shellboxing out to get it from
pygments.

Bug: T289227
Change-Id: I2e82e5aa2a71604b87ffb4936204201d06678341
2021-09-10 11:47:28 -07:00
Kunal Mehta c8bd606cab Remove dead Shell::isDisabled() check
With "ability-shell" set in extension.json's requirements as of
commit b5a904e2ec this extension will refuse to load if shelling
out is disabled.

Change-Id: Ie8f446fbb33e585ffcc7d0adda1894a5497f2dad
2021-09-02 21:42:13 +00:00
Kunal Mehta b4f53c7ad1 Update Pygments to 2.10.0
New lexers include ansys, apdl, asc, gcode, gsql, jslt, julia-repl,
kuin, meson, nestedtext, nodejsrepl, nt, omg-idl, output, pem, procfile,
pwsh, smithy, teal, thingsdb, ti, wast, wat.

Also "golang" is now an accepted alias for go.

The output lexer is a generic lexer that just makes everything look like
output, see <https://github.com/pygments/pygments/issues/1835>.

Full upstream changelogs:
* https://github.com/pygments/pygments/releases/tag/2.10.0
* https://github.com/pygments/pygments/releases/tag/2.9.0
* https://github.com/pygments/pygments/releases/tag/2.8.1

Bug: T280117
Change-Id: I162dff1e3f3eb6f01e87dc09509b508f52aff46c
2021-08-27 13:34:05 -07:00
libraryupgrader 2e6487bb26 build: Updating path-parse to 1.0.7
* https://npmjs.com/advisories/1773 (CVE-2021-23343)

Change-Id: I0a42bcad63d6b9999461f6175e14676fe9f8bb11
2021-08-12 11:49:46 +00:00
Translation updater bot 5399b2b093 Localisation updates from https://translatewiki.net.
Change-Id: Ia070ba7d03c91f1095d3038b3933138f4c4011af
2021-08-11 08:19:36 +02:00
Translation updater bot d2df466fca Localisation updates from https://translatewiki.net.
Change-Id: I84e9fd319f49b5b5cae0ee97d250ce9a9687afc2
2021-08-06 08:13:57 +02:00
libraryupgrader d6176eb862 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* glob-parent: 5.1.0 → 5.1.2
  * https://npmjs.com/advisories/1751 (CVE-2020-28469)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)

Change-Id: I63d2cc4c790d9b7d89187b72fed8ed11e89712a2
2021-07-24 02:37:26 +00:00
Translation updater bot c2344332cd Localisation updates from https://translatewiki.net.
Change-Id: If0f0c0201bb8ba89d8837bc63563bc45c6428026
2021-06-24 08:27:19 +02:00
Translation updater bot 95d2619de3 Localisation updates from https://translatewiki.net.
Change-Id: I91c9e768d23301de715be277cc083f2f2b469c98
2021-06-04 08:37:25 +02:00
Translation updater bot 413216a1ee Localisation updates from https://translatewiki.net.
Change-Id: I9cee809f1f0d4d0d1dc8a78d905b1274a77b00f1
2021-06-02 14:35:57 +02:00
Translation updater bot d3267c48de Localisation updates from https://translatewiki.net.
Change-Id: I0d56a058cf17d611bf2cf2fad1a25db4d950bb2c
2021-05-27 14:07:37 +02:00
Translation updater bot d93a5e383b Localisation updates from https://translatewiki.net.
Change-Id: I45d06d4d01839e79b308d280b3c1875e4d4c6d5b
2021-05-27 12:06:23 +02:00
libraryupgrader ffe27db508 build: Updating browserslist to 4.16.6
* https://npmjs.com/advisories/1747 (CVE-2021-23364)

Change-Id: I57c9ad14a8681ff4803c3a6a7788cf6aca0e508e
2021-05-26 05:05:44 +00:00
Translation updater bot 819b2a7322 Localisation updates from https://translatewiki.net.
Change-Id: Iccac06e8808aaf92329900b00a9f3a4068ed8a0a
2021-05-25 08:54:16 +02:00
Translation updater bot 78641cb785 Localisation updates from https://translatewiki.net.
Change-Id: I14b1a0b5001a9f0d977b06e031f40912d01f8f33
2021-05-24 09:55:31 +02:00
jenkins-bot 8facfc8945 Merge "build: Use HTTPS for all dependencies" 2021-05-21 05:37:39 +00:00
Alexander Vorwerk 47a18809ef Avoid using ContentHandler::getContentText()
ContentHandler::getContentText() is deprecated and should be
replaced with Content::getText() for TextContent instances.

Change-Id: I8767a925148c31b3a64761f1173a2a85bd28dfe0
2021-05-20 01:01:43 +00:00
Kunal Mehta 109323d1da build: Use HTTPS for all dependencies
Change-Id: I644519bf82495d92e8f4f70d011ec785afbcb5ba
2021-05-19 09:24:09 -07:00
Translation updater bot 59c86c4ef5 Localisation updates from https://translatewiki.net.
Change-Id: I573e8be6ea3652e87fcaa11c19d9f1f94bd73b93
2021-05-17 08:43:46 +02:00
libraryupgrader c6e7317bd6 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

npm:
* grunt: 1.3.0 → 1.4.0
* lodash: 4.17.19 → 4.17.21
  * https://npmjs.com/advisories/1673 (CVE-2021-23337)
* hosted-git-info: 3.0.7 → 3.0.8
  * https://npmjs.com/advisories/1677 (CVE-2021-23362)
* postcss: 7.0.35 → 8.2.15
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* websocket-extensions: 0.1.3 → 0.1.4
  * https://npmjs.com/advisories/1710 (CVE-2020-7662)

Change-Id: Ibb7da231b399652d6ad6857cac0e4831e7cfa12b
2021-05-14 04:34:12 +00:00
jenkins-bot 9497613160 Merge "Localisation updates from https://translatewiki.net." 2021-04-26 07:16:19 +00:00
Translation updater bot 4398ee85dd Localisation updates from https://translatewiki.net.
Change-Id: I65000f003e474ec7add4b87b167e0dade77a6046
2021-04-26 09:10:56 +02:00
Translation updater bot 0885282871 Localisation updates from https://translatewiki.net.
Change-Id: I929984659820be9d0fb9546c1d803139509ae207
2021-04-26 08:57:56 +02:00
Translation updater bot 94eabf374b Localisation updates from https://translatewiki.net.
Change-Id: I02514453de24f3003fb9b29e27f597ce62442178
2021-04-20 08:48:24 +02:00
libraryupgrader dc2c27f9fa build: Updating eslint-config-wikimedia to 0.20.0
Change-Id: I875ad34c50f6e745701eeb0724ee6995c17f2a10
2021-04-14 08:20:46 +00:00
Translation updater bot 37379a2e32 Localisation updates from https://translatewiki.net.
Change-Id: I190c8feba34963ca2700ce07d979bba8dd25f79f
2021-03-30 08:33:50 +02:00
libraryupgrader 6e82ac0823 build: Updating eslint-config-wikimedia to 0.19.0
Additional changes:
* eslint: Renamed `wikimedia/client` profile to `client-es5` (T277085).

Change-Id: I17aa369edd49580ffd392ea6095851a46a8520ea
2021-03-14 17:31:23 +00:00
Translation updater bot 195ac0deae Localisation updates from https://translatewiki.net.
Change-Id: Iec080c7b501693d4154e5c26acdd9d99f1a7e1db
2021-03-12 08:46:58 +01:00
libraryupgrader e0399a6d52 build: Updating eslint-config-wikimedia to 0.18.2
Additional changes:
* Dropped .php5 and .inc files from .phpcs.xml (T200956).

Change-Id: If3a049b74080e386eaffafd601276dcf2fa77289
2021-03-08 02:28:40 +00:00
Translation updater bot 36d8bbff0a Localisation updates from https://translatewiki.net.
Change-Id: I26dca0e02a530d75068893c77ada3ddf3337d179
2021-03-01 08:53:35 +01:00
C. Scott Ananian 0e26a6b3bf Replace use of Parser::$mStripState, deprecated in 1.35
The replacement, Parser::getStripState(), was added to MediaWiki in
1.34.  This extension already requires MediaWiki >= 1.34.

Bug: T275160
Change-Id: I7806068e1cd6e4da66adfe7bb75095d4bfb5d6bc
2021-02-19 17:08:41 -05:00
Timo Tijhof 7d9c268ffd pygments.linenumbers: Avoid deep jQuery loops on unrelated interactions
Follows-up 42c97fa (I82ed4ade), 63c5943a9 (Ic71346196).

This commit makes no functional changes, but it reduces overhead
from the SyntaxHighlight code when interacting with other features,
such as elaborate modals or other hashchange-heavy code paths that
a gadget might produce.

It uses vanilla DOM instead of jQuery where possible, and adds an
early return rather than fairly deep continuation no-ops.

Change-Id: I2264f6f398193802f05c738bad4c294da007fb27
2021-02-19 03:43:24 +00:00
Prod c9892df300 Update pygments to 2.8.0
Changes:
  <https://github.com/pygments/pygments/blob/2.8.0/CHANGES#L10-L150>

The 2.8.0 release contains fixes to existing lexers, as well as the
following new lexers:
  amdgpu, cddl, futhark, graphviz/dot, markdown

Bug: T274741
Change-Id: I84c32591a06aac5e1afe46dab1f80bb53d981bb3
2021-02-18 16:12:33 +00:00
Timo Tijhof fa20f69cf4 SyntaxHighlightVisualEditorModule: Use Context::encodeJson() instead
Also fixes the Phan warning about Xml::encodeJsCall/FormatJson
needing booleaen where int inDebugMode() is passed.

Change-Id: Id8de16ab683948eae096b43462118ea837f53038
2021-02-18 05:07:32 +00:00
jenkins-bot 123f8677fc Merge "Move default CSS/JS model mapping out of extension.json" 2021-02-12 15:01:44 +00:00
Kunal Mehta 9bdf728fc1 Move default CSS/JS model mapping out of extension.json
These are for MediaWiki core models, so it seems reasonable to specify
them in the PHP source.

Change-Id: Iab6f9969d2bf72122b2661e139aa21a3475a92a8
2021-02-10 23:54:21 -08:00
Translation updater bot 3846eca370 Localisation updates from https://translatewiki.net.
Change-Id: I0919e0cb253bd11c98e2bece0850d24f688a55dc
2021-02-11 08:40:14 +01:00
Translation updater bot 8e1a5f0edd Localisation updates from https://translatewiki.net.
Change-Id: I2650cb0ab73e6bdc5e7868426a51715c7f40d6a5
2021-02-08 08:45:14 +01:00
Translation updater bot adb912bb3a Localisation updates from https://translatewiki.net.
Change-Id: Ia6c67aa649a6df170a388646fb5ec12fb4ef4120
2021-02-01 08:48:50 +01:00
libraryupgrader c7600c3f40 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 34.0.0 → 35.0.0
* mediawiki/minus-x: 1.1.0 → 1.1.1

npm:
* eslint-config-wikimedia: 0.17.0 → 0.18.1

Additional changes:
* Added the "composer phan" command to conveniently run phan.

Change-Id: Ie7649408030682fccc0c0f0251359246bc06a986
2021-01-30 14:48:22 +00:00
Translation updater bot 4faed53640 Localisation updates from https://translatewiki.net.
Change-Id: I2a69442ac8f1923a3f17861336365af8bc3b46c8
2021-01-27 08:35:29 +01:00
jenkins-bot fc0ded34e1 Merge "Avoid console warning when hash is empty" 2021-01-25 22:54:36 +00:00
Ed Sanders 42c97fa448 Avoid console warning when hash is empty
Bug: T272844
Change-Id: I82ed4ade24ed9e61e654cc7ea1ce19c7607086e1
2021-01-25 22:30:48 +00:00
Ed Sanders 173491fa6f VE: Fix highlight of block syntax next to floats
Bug: T272864
Change-Id: Ifb8a36bb0f7fee93711c07ebc4efa8c0da244469
2021-01-25 15:13:31 +00:00
Ed Sanders 1a15a8832c Move position:relative to inner wrapper
The outer wrapper is 100% width, so making it position:relative
causes it to stack above floated elements.

Bug: T272853
Change-Id: I20a73b5086ebb03673f0435e27ca93432dcd000c
2021-01-25 14:43:18 +00:00
Ed Sanders e793626d52 Line number selection: Remove user-select:none
These rules were being kept for cached content, but were
actually breaking Firefox by triggering a multi-part selection.

Bug: T271614
Change-Id: I83fb4aab88fe1f34bc59d1da18ae8a6a4838a831
2021-01-19 20:32:39 +00:00
Translation updater bot 1de7fc4d94 Localisation updates from https://translatewiki.net.
Change-Id: I180c83f9de3cf14adabcb0fa485abb58b535aba6
2021-01-18 08:39:54 +01:00
jenkins-bot 49043547f2 Merge "Line numbers use mw-content-ltr/rtl direction" 2021-01-15 21:39:51 +00:00
jenkins-bot 8824036ea9 Merge "Remove unused directionality styles" 2021-01-15 21:39:34 +00:00
jenkins-bot 003c86028e Merge "Add mw-content-ltr/rtl classes to inline snippets" 2021-01-15 21:31:33 +00:00