Commit graph

1263 commits

Author SHA1 Message Date
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
Translation updater bot f5053f56f1 Localisation updates from https://translatewiki.net.
Change-Id: Iebfb51ffb0cbf9749837225634d4e269c2d7e016
2022-08-26 08:23:26 +02:00
Sébastien Beyou b08c0a7cb9 Fix the case of empty <syntaxhighlight /> tags
Bug: T315740
Change-Id: I685806d4e8992a54f17d29a9187807bb30e31ef8
2022-08-21 13:46:17 +02:00
Translation updater bot 05bc73fd1f Localisation updates from https://translatewiki.net.
Change-Id: Iab6c41a639a826900e1ff7098c9269ca1e72401d
2022-08-12 08:44:05 +02:00
Subramanya Sastry 0eef7add67 Add Parsoid support for syntaxhighlight
* Added Parsoid config, and refactored code slightly to
  add native Parsoid handlers for parser tags exposed
  by this extension.
* Enabled parsoid mode testing on the test file.
* Added html/parsoid sections on a few tests.
* Marked rest of tests as wt2html and wt2wt only since
  html2wt and html2html will fail without a html/parsoid section
  and there is no real benefit to adding them to all tests.
* Added a couple tests to the known failures list:
  - One is because of T299103.
  - The other is because Parsoid always emits attributes in the
    form <tag .. foo="bar"..> instead of just <tag ... foo ..>
    Since Parsoid needs to accept this format that is present on
    wikis, I added a html/parsoid section for this test and
    added the failures to the known failures list.

Bug: T272939
Change-Id: Ie30aa6b082d4fc43c73296ff2ed6cb8c3873f48f
2022-08-08 20:07:46 -04:00
Bryan Davis 3bee59df01 fix: Mark Pygmentize::fetchVersion as public, but @internal
Follow up to ae07430. The method needs to be public so that
WANObjectCache can call it from a callback, but we don't expect any
external callers.

Follows-Up: I424926d071e1cfd454a0c2d45a83693f41bdea55
Change-Id: Ia96d3132782435c693d2eaa77fd551fe9590b113
2022-07-15 19:13:52 -06:00
Timo Tijhof ae074306e8 Pygmentize: Cache pygments-version in memc (in addition to APCU)
* Add rationale for each cache key's strategy being in Memc vs APCU.

* Extend pygmentize-lexers from 1 day to 1 week. It rarely changes
  and already varies by version. Few things survive the day, but
  there's not a reason to explicitly expire it sooner I think.

* Add a layer of Memc to the pygments-version APCU cache given that
  it has a short expiry and thus relatively high miss rate.

  The main rationale for this is noise in mwdebug logs since this
  is currently the only thing we log by default in Logstash with prod
  severity (exec INFO) during every pageview (after a php-fpm restart
  which clears APCU). By adding Memc here we lose less of the cache
  churn by reviving it via Memcached, and we keep the sense of there
  being nothing in the logs "by default" at prod severity after restart,
  e.g. don't get used to any fatigue.

  Unlike the other cache keys and hooks, getVersion is the only
  thing that gets called widely regardless of whether syntaxhighlight
  is in use on the given page.

Change-Id: I424926d071e1cfd454a0c2d45a83693f41bdea55
2022-07-12 05:56:16 +00:00
Translation updater bot 7ae1ea95e5 Localisation updates from https://translatewiki.net.
Change-Id: Ica91f96c656e8699d062201f73de849aea83f0c1
2022-06-22 08:14:02 +02:00
Translation updater bot 0a5040998c Localisation updates from https://translatewiki.net.
Change-Id: I41a1389b2618e74ec47a0de3b10cf8169861d610
2022-06-13 08:29:10 +02:00
Translation updater bot e61a097832 Localisation updates from https://translatewiki.net.
Change-Id: Id13018695fc92030ac14afd342c9cdaf943a6796
2022-05-30 09:24:18 +02:00
libraryupgrader 39292cc8a9 build: Updating grunt to 1.5.3
Change-Id: Ifb4f99a1f3fd3f8df17d5a69fec5a6650ce585bb
2022-05-27 03:43:14 +00:00
Tim Starling 956aa8ecd7 Use new ResourceLoader namespace
Extensions using Phan need to be updated simultaneously with core due
to T308443.

Bug: T308718
Depends-On: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
Change-Id: Ie1356c582baf9a66b868f7349cc71c26f8f1ead3
2022-05-27 03:42:55 +00:00
libraryupgrader bf510e677d build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 38.0.0 → 39.0.0
* mediawiki/mediawiki-phan-config: 0.11.0 → 0.11.1
* php-parallel-lint/php-console-highlighter: 0.5.0 → 1.0.0
* php-parallel-lint/php-parallel-lint: 1.3.1 → 1.3.2

npm:
* grunt: 1.4.1 → 1.5.2
* stylelint-config-wikimedia: 0.12.2 → 0.13.0
* async: 3.2.0 → 3.2.3
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25

Additional changes:
* Set `name` in package.json.

Change-Id: I59c4f54b9c57facc14b5c28e5b58666cffadb6d9
2022-05-21 15:34:29 +00:00
Translation updater bot 62dec7ecd0 Localisation updates from https://translatewiki.net.
Change-Id: Ic059bd6848d01274729177fdb679a569200f2a15
2022-05-16 08:25:22 +02:00
jenkins-bot 607afd5b48 Merge "Namespace rest of the extension" 2022-03-25 16:35:13 +00:00
Ed Sanders 0345688a4f build: Update devDependencies
Change-Id: Id4d2eaaa8a5faa567e7f978eb21921b9644c7500
2022-03-20 15:05:03 +00:00
Reedy 39b4f0c7c1 Namespace rest of the extension
Global alias of SyntaxHighlight left behind for migration

Change-Id: I35b2caa42ac91454abe359949e360d1601748121
2022-03-18 01:42:11 +00:00
Translation updater bot ded00be15b Localisation updates from https://translatewiki.net.
Change-Id: I42a4f5ef3f3c2c2ccb911ef160d326b622928d01
2022-03-15 08:25:49 +01:00
Translation updater bot 0a9c91fb39 Localisation updates from https://translatewiki.net.
Change-Id: I3a51ac398262191d7fa7403951de7d3b15704abc
2022-03-14 08:14:46 +01:00
Translation updater bot 2425bd0b26 Localisation updates from https://translatewiki.net.
Change-Id: Iac163bb7174c6665e0af41f89987e175b8d8ec2e
2022-03-11 08:33:15 +01:00
Translation updater bot 1ae9ab51ce Localisation updates from https://translatewiki.net.
Change-Id: Id7cfbadf64563bc52968dd4e58bba4ca1914b061
2022-02-28 14:29:29 +01:00
Translation updater bot 12d544ed07 Localisation updates from https://translatewiki.net.
Change-Id: Ie2b9582b964c9133c26148fd0f67791b4b6d08bf
2022-02-25 09:45:52 +01:00
Translation updater bot ee08e3d7f8 Localisation updates from https://translatewiki.net.
Change-Id: I882e645cc1b2172c3f8924f19f159d65f8b5b2e5
2022-02-16 08:13:32 +01:00
Translation updater bot 0a2f128e33 Localisation updates from https://translatewiki.net.
Change-Id: Iedea634dbb3641c0752632b073e1e73f9e0afae9
2022-02-11 08:42:21 +01:00
Translation updater bot 6b6001c5f9 Localisation updates from https://translatewiki.net.
Change-Id: Iacf4ee294ce7f3b977fba5fab7f54d7b76dacb73
2022-02-01 08:27:33 +01:00
Translation updater bot f48d370935 Localisation updates from https://translatewiki.net.
Change-Id: Ifb851275b8261ecac761277e8c2d2171e8bc24c6
2022-01-19 08:24:27 +01:00
Ori Livneh a4273571da Update Pygments to 2.11.2
New lexers: BDD, Elpi, LilyPond, Maxima, Rita, Savi, Sed, Sophia, Spice, .SRCINFO.

Full upstream changelogs:

* https://github.com/pygments/pygments/releases/tag/2.11.0
* https://github.com/pygments/pygments/releases/tag/2.11.1
* https://github.com/pygments/pygments/releases/tag/2.11.2

Bug: T298399
Change-Id: I1177cb8a5c697852856b676c857939e73acb3f6c
2022-01-17 23:51:19 +00:00
Translation updater bot b473a940a6 Localisation updates from https://translatewiki.net.
Change-Id: Ieb87bacabc7a0cfd384d706b2f3121b2cc160833
2022-01-17 08:13:04 +01:00
C. Scott Ananian e0cece9bc6 Passing a string to ParserOutput::addModules()/addModuleStyles() is deprecated
Bug: T296123
Change-Id: If14866f76703aa62d33e197bb18a5eacde7a55c0
2022-01-11 17:01:22 -05:00
Translation updater bot fa5151d287 Localisation updates from https://translatewiki.net.
Change-Id: I575438492515a6531e399e83409d848da2bb2d6b
2021-12-06 08:20:17 +01:00
Translation updater bot 656194431c Localisation updates from https://translatewiki.net.
Change-Id: I105cd2e3774e8d5a009d76483a7d3e4e04199518
2021-11-03 08:21:19 +01:00
Translation updater bot de4cf4b8d7 Localisation updates from https://translatewiki.net.
Change-Id: I585a576a8153596ba75de95d7b6fe7d5596c7683
2021-11-02 08:07:34 +01:00
libraryupgrader 85efa47b3b build: Updating mediawiki/mediawiki-codesniffer to 38.0.0
Change-Id: I9debc456a0c7508da4679d67659fbc0ebddce885
2021-10-24 13:45:35 +00:00
Derk-Jan Hartman 34c936a8d3 Include generated styles before Mediawiki overrides
The order of style inclusion matters, some of our overrides were no
longer in effect.

Follow-up to: I2e82e5aa2a71604b87ffb4936204201d06678341
Bug: T292736
Change-Id: If202c26d2c29994cb3680eb76a86bb7efacc3ff9
2021-10-10 22:30:13 +02:00
libraryupgrader a88fc2af71 build: Updating ansi-regex to 5.0.1
* https://npmjs.com/advisories/1002401 (CVE-2021-3807)

Additional changes:
* composer.json: Updated phpcs command in composer test (T280592).
* composer.json: Added phpcs command to scripts (T280592).

Change-Id: I70d872844d7594b57f20774692217efe61eeb172
2021-10-08 13:51:51 +00:00
Ed Sanders e2a95de1ce Move var delcarations inline
Change-Id: I4546e0bd18845fa21b7aaca2b50d11e16e637229
2021-10-07 14:34:55 +01:00
Translation updater bot bb70daaf44 Localisation updates from https://translatewiki.net.
Change-Id: I638d9c49384b126c6e0934435e63fd882c86234b
2021-10-07 09:03:30 +02:00
jenkins-bot 5274a69824 Merge "Bump required MediaWiki version to 1.36" 2021-10-05 14:54:57 +00:00
Func 81e24e26df Bump required MediaWiki version to 1.36
After change I2e82e5aa, this extension no longer supports 1.35
and earlier.

Change-Id: I51c318f77a03f0f72611f039e139b4869b80f8ba
2021-10-05 14:51:20 +00:00
Translation updater bot 4bb283858b Localisation updates from https://translatewiki.net.
Change-Id: Icebdafe9e750dd4bb3f117ecb9c0e7ac96c48abc
2021-10-01 09:30:21 +02:00
Subramanya Sastry 360ec88ec1 Get rid of +tidy, +untidy references from parser tests
Bug: T198214
Change-Id: I4b3346b167d13a1e4361ba78a44f6922e1828b55
2021-09-30 13:45:21 -05:00
Translation updater bot 3fe68d4f0e Localisation updates from https://translatewiki.net.
Change-Id: I2fc45ac84b88156566318ef6000ee1d37772772a
2021-09-23 12:28:02 +02:00
jenkins-bot a5be55b248 Merge "Expose Pygments version on Special:Version" 2021-09-10 19:28:13 +00:00
jenkins-bot de87bfcee0 Merge "Port to BoxedCommand" 2021-09-10 19:27:01 +00:00
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 b8a5dd08ee Expose Pygments version on Special:Version
Change-Id: Ia4eccc4f16873b16e106c8196d7582ca5b27b365
2021-09-10 11:47:28 -07:00
libraryupgrader 580ce3425f build: Updating composer dependencies
* mediawiki/mediawiki-phan-config: 0.10.6 → 0.11.0
* php-parallel-lint/php-parallel-lint: 1.3.0 → 1.3.1

Change-Id: I2930dc6c8e44bb306711c3770a695a9d201b1b65
2021-09-09 07:49:55 +00:00
libraryupgrader 96fe42fd33 build: Updating stylelint-config-wikimedia to 0.11.1
Change-Id: I49950c0b15a4be915259952811bfd2432da3062a
2021-09-04 22:54:14 +00:00