Commit graph

192 commits

Author SHA1 Message Date
libraryupgrader f03d14ea2c build: Updating cross-spawn to 7.0.6
* https://github.com/advisories/GHSA-3xgq-45jj-v275

Change-Id: I0a35cb7be0fbd77911205d06bbd4cbe50969bd7e
2024-11-19 19:26:56 +00:00
libraryupgrader 9b5881a4c5 build: Updating mediawiki/mediawiki-codesniffer to 45.0.0
Change-Id: I36f5e958b5329d1c51b44130a6f77d227b29553f
2024-11-02 06:31:09 +00:00
libraryupgrader e0fceb439a build: Updating micromatch to 4.0.8
* https://github.com/advisories/GHSA-952p-6rrq-rcjv

Change-Id: Ic906201a71398729807ed0901d30356fc921d3f8
2024-08-24 01:52:27 +00:00
libraryupgrader 1787e3c837 build: Updating mediawiki/mediawiki-codesniffer to 44.0.0
Change-Id: I049c9f4a64146e3bd1d2f6c8a330aadd16018f86
2024-08-11 06:12:47 +00:00
libraryupgrader 80bca7637b build: Updating eslint-config-wikimedia to 0.28.2
Change-Id: Id2e30a7504836b5a4cdb605f2e8bdd0d5e32601b
2024-06-20 06:23:38 +00:00
libraryupgrader 139477f424 build: Updating braces to 3.0.3
* https://github.com/advisories/GHSA-grv7-fg5c-xmjg

Change-Id: I0d77aa82e2df37554799ce25009ff6e0135894eb
2024-06-11 04:34:01 +00:00
libraryupgrader 43aa5a33b1 build: Updating eslint-config-wikimedia to 0.28.0
Change-Id: I2c7d088150fabb7cf3ea42d745207ccfbbd3e2c1
2024-06-06 10:53:57 +00:00
jenkins-bot 9bee08e25a Merge "Implement a RemexHtml-based provider (requires 1.38)" 2024-05-20 11:51:49 +00:00
libraryupgrader 4c1da662d0 build: Updating grunt-banana-checker to 0.13.0
Change-Id: I74ba2546e9b368b534607d6ef3dd986eeb6b4150
2024-05-18 05:51:10 +00:00
alex4401 dcfd6ea6a8 Implement a RemexHtml-based provider (requires 1.38)
This patch has been in testing on ark.wiki.gg (with the platform's approval) for a few months now, and has yielded us significantly better extracts than the live algorithm. It brings Description2 closer to TextExtracts' level, but without its constraints. TextExtracts does not enable us to override descriptions as we see fit, requires internal API calls, and uses HtmlFormatter which has its own slew of problems.

I'm also raising MW requirement to 1.38: this change has not been tested with older versions, and I removed uses of old `getProperty` in favour of `getPageProperty` to clean up the code. I doubt this really matters much: support for 1.35 is about to end (if it hasn't already), and 1.38 itself is already EoL. It also appears that lately this extension only received forward-compatibility patches.

New provider leverages RemexHtml (used in core MediaWiki and Parsoid) to parse and process a page's HTML. For performance reasons (but also bit of practicality - it's unlikely that description derival needs full page text...) any HTML after the first <h1-6> heading is dropped and not parsed. However, this is just a precaution, on ARK we haven't  noticed any performance degradation.

Two new configuration variables are added:
- `$wgUseSimpleDescriptionAlgorithm` (proposed default: false) determines which extract provider is used. `true` is the previous algorithm. `false` is the new Remex implementation.
- `$wgDescriptionRemoveElements` is an array of tag names and/or class names to strip out when generating extracts. This is only supported in the Remex provider, and would be hard to retrofit into the previous algorithm.

Depends-On: I04b00f99085f07f773212ee3eca8470eece34e9e
Change-Id: I8e6bf1f17443feac89f07e728d395e5a525bd4d1
2024-05-17 20:03:08 +00:00
jenkins-bot d325abc0dd Merge "Truncate descriptions to a certain length" 2024-05-17 19:59:23 +00:00
libraryupgrader 8a63cae9e0 build: Updating grunt-banana-checker to 0.12.0
Change-Id: I91c07b443983db2e3606f43d482c52e6189bed30
2024-05-10 03:42:20 +00:00
libraryupgrader 7c56ad79d3 build: Updating composer dependencies
* mediawiki/minus-x: 1.1.1 → 1.1.3
* php-parallel-lint/php-parallel-lint: 1.3.2 → 1.4.0

Change-Id: I01ae354ba07961c5b02f9eb3817f4b79e8acf5ea
2024-05-05 15:35:35 +00:00
libraryupgrader 8607c097dc build: Updating eslint-config-wikimedia to 0.27.0
Change-Id: I47d24a8c0f01d6d859b8ab6116dac86bd974fac6
2024-04-17 03:50:59 +00:00
jenkins-bot 859b31417f Merge "Remove style tags in description" 2024-04-05 10:07:08 +00:00
libraryupgrader 4fc6b76c30 build: Updating mediawiki/mediawiki-codesniffer to 43.0.0
Change-Id: I0f13435b35a53329bda5e136490bdc90c3b1adf0
2024-03-17 16:52:30 +00:00
alex4401 c146909532
Truncate descriptions to a certain length
With this change, generated descriptions are cut at 300 characters, without breaking words when possible, and with an ellipsis added in case the cut happened mid-sentence.

The `Description2::getFirstChars` function was borrowed from TextExtracts with minor alterations (added comment for their regex, and removed `>` from word healing given it's unclear why it's been included).

New configuration variable `$wgDescriptionMaxChars` (proposed default: 300, which seems like a sensible amount) controls this behaviour.

This has been in testing on ark.wiki.gg (with the platform's approval, which I'm glad for) since early September. Without this change, we had a few pages with little sections having a huge part of their body text thrown into the `description` meta tag...

Depends-On: I585f2c0046571310aad67f3ba148c4f22aaae49f
Change-Id: I04b00f99085f07f773212ee3eca8470eece34e9e
2024-02-24 08:44:53 +01:00
xtex 055927a901 Remove style tags in description
Some pages' description may include CSS code rendered by [[Extension:TemplateStyles]].

Change-Id: I352ac2338eb5977305308546523ec6c55f7cb599
2024-02-14 07:16:19 +00:00
libraryupgrader bc54a5a120 build: Updating grunt-banana-checker to 0.11.1
Change-Id: I464c576ea6062676c41801fcb54d5b38f860793f
2024-02-10 08:38:23 +00:00
libraryupgrader 77db4d0127 build: Updating npm dependencies
* eslint-config-wikimedia: 0.25.1 → 0.26.0
* grunt-eslint: 24.0.1 → 24.3.0

Change-Id: I9dede31a39fd0f81f5f23fbca610bbbf8d0b5dda
2024-02-09 02:05:56 +00:00
libraryupgrader 8cf12f5160 build: Updating eslint-config-wikimedia to 0.25.1
Change-Id: I6a23f62934c754bc9e155f83e392fb25597e1119
2024-02-05 04:58:18 +00:00
libraryupgrader ebc5ca21e2 build: Updating npm dependencies
* eslint-plugin-compat: 4.0.2 → 4.2.0
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
* semver: 7.3.5 → 7.5.4
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
  * https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
* word-wrap: 1.2.3 → 1.2.5
  * https://github.com/advisories/GHSA-j8xg-fqg3-53r7

Change-Id: I555d14c23825f9a5402fb728bcbdb39fc03ac7d8
2024-02-03 17:36:45 +00:00
Translation updater bot cdb35a545d Localisation updates from https://translatewiki.net.
Change-Id: I77d92242f931574eb50615a66f351baba4c2ab99
2024-01-30 09:38:55 +01:00
Translation updater bot 43a4771737 Localisation updates from https://translatewiki.net.
Change-Id: I6a044c5e55e485253e2e9b64d5d9266b7394c2eb
2024-01-28 16:06:10 +01:00
alex4401 050086dd6e Do not try to derive descriptions if one has been specified already
Skip running the generator on interface messages and if a description has already been set. This resolves some annoyances ranging from performance (relevant if the algorithm becomes more expensive to run) to multiple description meta tags being spawned.

This is part of my RemexHtml patch chain, which I've split up to avoid having a single commit alter the majority of the codebase. If it ends up being rejected, I can rebase this change to rid of dependencies on the rest of the chain.

Depends-On: I97fd065c9554837747021ba9fff26005e33270f4
Change-Id: I585f2c0046571310aad67f3ba148c4f22aaae49f
2024-01-12 08:28:31 +00:00
alex4401 b73fe26c29 Extract description algorithm into a new class
Separating the extract algorithm from integration code. This results in a slightly cleaner code structure (at least in my opinion) and enables adding alternate algorithms without devolving into spaghetti.

The DescriptionProvider (name of the new base interface) is exposed as a service through dependency injection to avoid factories. The implementation can be swapped at service instantiation time.

Depends-On: I73c61ce045dcf31ac1ca5888f1548de8fd8b56ff
Change-Id: I97fd065c9554837747021ba9fff26005e33270f4
2024-01-12 08:24:19 +00:00
alex4401 43eb47183e Switch to hook handlers and inject ConfigFactory
Moving hooks into a separate class, and using dependency injection for configuration. Due to hook interfaces being added in MW 1.35, this change also raises the MediaWiki requirement to >1.35.0.

This patch is a part of my RemexHtml deriver chain (split into multiple patches to avoid a single commit altering almost the entirety of the codebase), which raises the floor to 1.38 later. There's not really a point in merging this if the rest of the patch chain is declined.

Depends-On: I484feeb51beab0c2e06c9f958a1c15c40853b967
Change-Id: I73c61ce045dcf31ac1ca5888f1548de8fd8b56ff
2024-01-11 22:44:02 +00:00
alex4401 15f2edbaee Use namespace autoloading instead of manually tracking classes
This extension's classes have already been namespaced. Perhaps wrongly, but I don't see any showstoppers against using PSR-4 autoloading here.

Change-Id: I484feeb51beab0c2e06c9f958a1c15c40853b967
2023-12-07 15:37:32 +00:00
Translation updater bot 323c797f28 Localisation updates from https://translatewiki.net.
Change-Id: I2d4a3bc2a96f98c22d115c5a721a2a40ba8d5af6
2023-09-13 08:31:48 +02:00
Translation updater bot 1f10d667fe Localisation updates from https://translatewiki.net.
Change-Id: Id6bd7d7432289c887e6144f02c330d00b747048f
2023-07-31 08:57:09 +02:00
libraryupgrader 2d68312307 build: Updating grunt-banana-checker to 0.11.0
Change-Id: Ieaa8314b65d77e77367af692476a0bb03bd4a9ca
2023-06-01 04:19:12 +00:00
libraryupgrader 6cbe68fa54 build: Updating npm dependencies
* eslint-config-wikimedia: 0.24.0 → 0.25.0
* grunt-eslint: 24.0.0 → 24.0.1

Change-Id: Ia12348aa1098e03ee65fcffc3c7bde2d208a40bd
2023-05-04 01:54:14 +00:00
libraryupgrader cab185a2a6 build: Updating npm dependencies
* eslint-config-wikimedia: 0.22.1 → 0.24.0
* grunt: 1.5.3 → 1.6.1

Change-Id: I8240834199bd51f76664026759e27903b718fec5
2023-03-15 04:47:13 +00:00
libraryupgrader 4cd70b8e7e build: Updating mediawiki/mediawiki-codesniffer to 41.0.0
Change-Id: If0f4df5a40f2c5fbd63535b5d895d4a7934f265b
2023-03-12 00:41:07 +00:00
Translation updater bot 655b11d7ea Localisation updates from https://translatewiki.net.
Change-Id: I550012a6b7562a647cc3a87bc86ba19ef2199e67
2023-01-05 09:07:56 +01:00
Translation updater bot 4ba5e24b71 Localisation updates from https://translatewiki.net.
Change-Id: I41b7a5e2b0855b79da83eb4852398587f768603a
2022-12-21 09:14:56 +01:00
libraryupgrader dbc034f125 build: Updating mediawiki/mediawiki-codesniffer to 40.0.1
Change-Id: I8a3d0295a57e7cbb8776e637e3b191b3bc0ce60e
2022-11-16 04:50:22 +00:00
libraryupgrader e83256f305 build: Updating minimatch to 3.0.8
* https://github.com/advisories/GHSA-f8q6-p94x-37v3

Change-Id: Ie10e39d694879722b03e824626eed6494486aa74
2022-10-21 04:25:30 +00:00
libraryupgrader 6b4777721f build: Updating grunt-banana-checker to 0.10.0
Change-Id: I9488e108b555de13447db3a9e339f250330c2d09
2022-10-06 01:59:41 +00:00
libraryupgrader d2a5322a44 build: Updating grunt to 1.5.3
Change-Id: Ic14500ab823ac82074ca6eed50ea1abea65af98e
2022-05-26 10:07:42 +00:00
libraryupgrader 6eca5a303c build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 38.0.0 → 39.0.0
* 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-eslint: 23.0.0 → 24.0.0

Change-Id: Ic5c5cb36ad85238dbc5a1cbaec3f3ea0e3eda707
2022-05-21 02:41:53 +00:00
libraryupgrader bd9bc72317 build: Updating grunt to 1.5.2
Change-Id: I50c0ad5627d769697a5ff1d9e5b93511ad2177b9
2022-04-27 09:39:11 +00:00
libraryupgrader d53638e642 build: Updating npm dependencies
* eslint-config-wikimedia: 0.21.0 → 0.22.1
* async: 3.2.0 → 3.2.3
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25

Change-Id: I92726e9b0cd4bec2839c03366bd1b9a450028917
2022-04-15 02:51:41 +00:00
Translation updater bot 23e0582f58 Localisation updates from https://translatewiki.net.
Change-Id: I331d9b42ca98f0fea2f9598b89450f93b0d9cf95
2022-02-25 09:43:17 +01:00
C. Scott Ananian b269304773 ParserOutput::getPageProperty() now returns null when key is missing.
The return value of ParserOutput::getPageProperty() has transitioned
to returning `null` instead of `false` when the page property is missing.

Bug: T301915
Depends-On: Iaa25c390118d2db2b6578cdd558f2defd5351d15
Change-Id: I31d4115d75e080bb0177f30b2acf55ca2525a19d
2022-02-16 19:33:00 -05:00
C. Scott Ananian 84276905bc Update uses of ParserOutput::getPageProperty() to handle new return value
The return value of ParserOutput::getPageProperty() will transition to
returning `null` instead of `false` when the page property is missing.

Bug: T301915
Change-Id: Id95dbdd427310e4e1cf40330b149adfe2b68f848
2022-02-16 19:31:35 -05:00
libraryupgrader adc340542c build: Updating npm dependencies
* eslint-config-wikimedia: 0.20.0 → 0.21.0
* grunt: 1.4.0 → 1.4.1

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

Change-Id: I80cb9a1386e4217c3d1721c1a76c556b31c9d3b1
2022-02-06 12:13:42 +00:00
Umherirrender 6d3b7ce782 Replace deprecated ParserOutput::getProperty
Change-Id: I9278120212bcd0c003af899ce9602c292edac947
2022-02-06 13:11:38 +01:00
Umherirrender 838ef90fe0 Set MediaWiki 1.31 as minimum requirement in extension.json
Added an old, but not to-outdated required version to keep a minimum
requirement

Change-Id: I7ffdf9c3246614521853c70fef6a2f0c105d7d3c
2021-12-10 13:18:23 +01:00
libraryupgrader 0c238dce47 build: Updating mediawiki/mediawiki-codesniffer to 38.0.0
Change-Id: Ic4ca68f9346bcf13083564704f183cf2e5168b3c
2021-10-24 02:10:21 +00:00