Commit graph

1244 commits

Author SHA1 Message Date
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
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