Commit graph

2626 commits

Author SHA1 Message Date
thiemowmde f4ed725712 Fix and add test for "0" special case in TexNode
We fixed this in I47b6d5b but broke it again in Ie8d8106. Let's
finally add a test for this edge-case.

Change-Id: I9a43518f9edf0fab05e76bbb02a30fefd039b77d
2022-11-29 12:11:15 +01:00
jenkins-bot a58d9c39d3 Merge "Various code cleanups, more compact syntax and such" 2022-11-29 10:21:02 +00:00
jenkins-bot 4d3cb0dc69 Merge "Simplify VE data modules using 'packageFiles'" 2022-11-29 01:14:00 +00:00
jenkins-bot 3288979f2e Merge "Remove unnecessary uses of <span class="mw-headline">" 2022-11-28 18:45:29 +00:00
thiemowmde be25b18d8c Rewrite hot TexNode methods for performance
It appears like these methods are called hundreds of thousands of
times. This is mostly because they are recursive. According to my
benchmarks the changes proposed in this patch make a big difference.

Some notes:
* I try to avoid stepping deeper into the recursion whenever possible,
  i.e. do the recursion only when the current element is an array.
  This is relevant because the function call overhead is surpsiringly
  expensive in PHP.
* I tried to arrange the if-elseif-else branches in a way so that the
  most minimal code is executed while the code is still readable.

Change-Id: Ie8d8106390cac441cb93adcd48a937ba312a2d91
2022-11-28 12:13:41 +00:00
Translation updater bot d8279aa9cf Localisation updates from https://translatewiki.net.
Change-Id: I2317d0f772b82b85a38dbfe8bcd854d1ceba907b
2022-11-28 08:49:51 +01:00
jenkins-bot c7bfd4a695 Merge "Replace some confusing array_walk with more trivial foreach" 2022-11-27 14:59:43 +00:00
Moritz Schubotz (physikerwelt) 7ecce2a104
Skip tests that are known to fail
* don't return on skipped tests
* add some additional non math test cases

Change-Id: Ia389141693a2e2ed6dea4294549674402e109d64
2022-11-27 15:08:56 +01:00
Translation updater bot a1a5457473 Localisation updates from https://translatewiki.net.
Change-Id: I1c6c148c6359b7320d7a4ea7079c11d012a0b205
2022-11-25 08:26:16 +01:00
Bartosz Dziewoński 94a48c1f1b Remove unnecessary uses of <span class="mw-headline">
Bug: T323773
Change-Id: Ia9528a30174daaca3d557081ec5191e626056a9d
2022-11-24 17:04:29 +01:00
Translation updater bot f28d135be4 Localisation updates from https://translatewiki.net.
Change-Id: I623e3d87299477e5adae5fb34dd4f842dfecd899
2022-11-24 08:17:44 +01:00
jenkins-bot 21ee1d43aa Merge "Make code using the Math.CheckerFactory service discoverable" 2022-11-23 14:57:00 +00:00
Thiemo Kreuz 7dbc300a5f Various code cleanups, more compact syntax and such
Some notes:
* Note that array_column() strips array keys. I checked and this is
  fine here.
* Html::element() will skip attributes that are set to null or false.
  Perfect fit here.
* I routinely remove comments that do notjing but repeat what the
  code already says.

Change-Id: Ie7797b78f1af5d8404c9e97b333fac8c6b3ac85e
2022-11-23 15:36:22 +01:00
Moritz Schubotz (physikerwelt) b3e57cbfc2 Make code using the Math.CheckerFactory service discoverable
Otherwise IDEs and other tools don't know what's going on.
...->getService() returns mixed.

Change-Id: If0429485941c19eb0e88896cb1ada66a5320bafe
2022-11-23 12:10:32 +00:00
thiemowmde 9b32ed8eb6 Replace manual array merge in ParserUtil with native function
Note: I'm not sure if this code is copied from somewhere else. If it
is this change is better done in the source.

Change-Id: Ic84be9b8b52a190eb5a41f2c7ff8fd6c04724318
2022-11-23 10:56:33 +00:00
thiemowmde 14647fa3b1 Fix Phan warning in TexVC class
Required-For: If0429485941c19eb0e88896cb1ada66a5320bafe
Change-Id: I77f4d552b63b7ed935502e2d45cfa97e5310927c
2022-11-23 11:04:10 +01:00
thiemowmde a5668bd0a7 Replace some confusing array_walk with more trivial foreach
Personally I find them confusing because there is apparently no way
to "stop" an array_walk(), and that's why it constantly needs to
check if it even needs to run. Why not use a syntax we can actually
stop? I find this more readable and it makes the code actually run
faster. On average 50% of the iterations get skipped now.

Change-Id: I47b6d5b8f4ad5c9d0f47b389c638196e734809bb
2022-11-23 09:16:52 +00:00
Translation updater bot bb39263f59 Localisation updates from https://translatewiki.net.
Change-Id: Ib5ebef4eda6a0a55daa7a0f3b69aa5d456416fe5
2022-11-23 08:32:54 +01:00
jenkins-bot e0f6e21ac7 Merge "Remove PNG rendering mode" 2022-11-22 19:07:20 +00:00
Bartosz Dziewoński 9207931f53 Simplify VE data modules using 'packageFiles'
We can now serve the JSON data almost directly (although, curiously,
we need a main file in the module that is JavaScript, not JSON),
and without using global state in the JS code.

Change-Id: I203b3e396b28f4b4ef49c3c0918a4025082308c4
2022-11-22 18:43:04 +01:00
jenkins-bot e3d54827cf Merge "Make use of ?: and ?? shortcut syntax where it makes sense" 2022-11-22 12:19:30 +00:00
thiemowmde 67906845ff Make use of ?: and ?? shortcut syntax where it makes sense
I hope this makes the code more readable.

Change-Id: Ie458551d26cd8c8cd6e1cc18789d93176230f0d4
2022-11-22 12:29:44 +01:00
Stegmujo 1b241d4aeb Change validate in MathValidator to php-based checking
Bug: T323554
Change-Id: I8e900e03794bf4eda0ff27381c2c8078234a0b2d
2022-11-22 11:17:20 +00:00
Translation updater bot 223b945b5d Localisation updates from https://translatewiki.net.
Change-Id: I62671b61d03d6b6735ff671c2db49453997acdf8
2022-11-22 08:34:03 +01:00
Moritz Schubotz (physikerwelt) 110656335f Remove PNG rendering mode
Removes functionality to
* select PNG rendering mode
* automated fallback to PNG images for SVG rendering
* PNG mode related class and tests

However, PNG images received from mathoid / restbase are still stored.

Bug: T311620
Change-Id: I595926027433182cc0396570bc3f1ce0cd2cafb3
2022-11-21 18:57:27 +00:00
Stegmujo db40ad2ac3 Add Service Initialization in Render
Bug: T312528

Change-Id: I88db7691cf7ac0a66d130b5472b41355a6c4abc2
2022-11-21 11:40:43 +00:00
jenkins-bot 4b6137bed4 Merge "Avoid try…catch where if…else will do when using LanguageFactory" 2022-11-21 08:57:13 +00:00
Bartosz Dziewoński 1b7a46ff4f Avoid try…catch where if…else will do when using LanguageFactory
Needed for I869af06896b9757af18488b916211c5a41a8c563, where I am
trying to change LanguageFactory in MediaWiki core not to use
MWException.

I truly feel mocked after working with this code. See if you can find
the two lines in this diff where the meaningful changes are.

Change-Id: Ifcb31dbb7113ce57526f06558cde2abedee317d7
2022-11-18 21:08:24 +01:00
Translation updater bot 7a65053816 Localisation updates from https://translatewiki.net.
Change-Id: I8cd8de308c84a3a8a2b64e49ffd5a3cb1d40a254
2022-11-17 08:27:23 +01:00
libraryupgrader 6d70e134b8 build: Updating grunt-stylelint to 0.18.0
Change-Id: I6dc890fdbcc30116c39cc4bf4130b7aa9457b1ae
2022-11-13 06:02:16 +00:00
d.savuljesku ef32effe35 Fix calling array function on stdClass
Bug: T322634
Change-Id: I8c7c7004128da9de6f266ebca43b9aa78802a2de
2022-11-08 14:59:03 +01:00
Translation updater bot e0e2d6da23 Localisation updates from https://translatewiki.net.
Change-Id: I274d82d84cc74979a6f85eccd0f27deffe787f18
2022-11-07 08:34:45 +01:00
Reedy 6081e9b01a DeclhTest: Fix string interpolation
Bug: T314096
Change-Id: I1c2a11c1481ca7d8e91e9c0468600ace9038e333
2022-11-04 18:08:02 -06:00
Translation updater bot 7b90132b49 Localisation updates from https://translatewiki.net.
Change-Id: I8e3b1426f1189228c20b3ba2c8949b71dabfc998
2022-11-04 09:03:15 +01:00
Translation updater bot 66e3b942d4 Localisation updates from https://translatewiki.net.
Change-Id: If54846e2a07cc46ab89ca6bfd2c8c62ff435c2a6
2022-11-03 08:24:56 +01:00
Translation updater bot 9e4de8215b Localisation updates from https://translatewiki.net.
Change-Id: I283b2bfc628beb9528aade8269c8bda5b069515d
2022-11-01 08:53:23 +01:00
Translation updater bot ff4ad7fff1 Localisation updates from https://translatewiki.net.
Change-Id: I1790ea47f382422a7e37054f057b904c66366da8
2022-10-31 09:46:08 +01:00
Translation updater bot 3486cc7181 Localisation updates from https://translatewiki.net.
Change-Id: I84d809c4d6b1890523d5b00d834b1fe09f2cf2b6
2022-10-26 08:19:35 +02:00
jenkins-bot 3dcdbbd95b Merge "Fix Perfomance Issues of TexUtil" 2022-10-25 18:10:09 +00:00
jenkins-bot ded8f70772 Merge "Activate chem and inline-tex type input in LocalChecker" 2022-10-25 17:50:31 +00:00
Stegmujo b5d3bca4b4 Fix Perfomance Issues of TexUtil
TexUtil gets instanciated and loads a json for each node in Literal and Fun1. This is not necessary since it takes much RAM and time to load the corresponding JSON from files.

Bug: T321599

Change-Id: I91855ebc4437f075302ae13d367ca4902cc0f3ba
2022-10-25 17:44:02 +00:00
Stegmujo c74ced3716
Activate chem and inline-tex type input in LocalChecker
Bug: T321262

Change-Id: Ib8e55290cc77cdc07274e7f1dbd27d20db0f3227
2022-10-25 18:35:54 +02:00
jenkins-bot 8ef681c6be Merge "Fixing Parser for All Wiki and Chem Tests" 2022-10-25 15:43:08 +00:00
Stegmujo d2bd2f4554
Add Tests and Downloader for Chem Input Types
Bug: T321262

Change-Id: I4e0af8ab0eaa02829dffb7ff5fccc4564ed5c1ba
2022-10-25 16:55:58 +02:00
Stegmujo caf3a1e26b
Add All Wikipedia Tests and Fixes
These tests are skipped in CI, but are ran locally.
Contains also preliminary fixes to make the assertions not crash
locally and a shellscript for downloading the json-file with tests locally.

Bug: T315223

Change-Id: If5da7e2a29d9179eabecbb4707ed244f5d445d39
2022-10-25 15:32:53 +02:00
Stegmujo 2d56f19e3c Fixing Parser for All Wiki and Chem Tests
This is required to run these tests.

Change-Id: I9e12b2f4cf6dc7d96cd51f408d8aa8d71b224ab3
2022-10-25 12:06:58 +00:00
Translation updater bot 551bc174c9 Localisation updates from https://translatewiki.net.
Change-Id: I3f4808d94e1d2067b397de8f8e49106458ca393a
2022-10-24 08:23:10 +02:00
Stegmujo c27f7edef9 Add Integration for the TexVC-PHP check to Math
Bug: T312528

Change-Id: I0eda7d4213a5f703ab7ae7887aa364af9e576dbe
2022-10-20 16:39:19 +00:00
Stegmujo 8333e2541a Create Tests for Parser and TexVC
Parser.php is excluded from linting steps.

Bug: T312528

Change-Id: I372832bb9ea212f9bc06947d0ef192f270dc54c2
2022-10-19 17:25:20 +00:00
Stegmujo ba47c32e1d
Add Node and Util fixes for Parser.php
For development history of this changeset see:
Id96a4b1b55e3959aab81f4ba436c5ac125f2a1bb

Bug: T312528

Change-Id: I61cfdbd63f8d50b072ada05927a134686fdd53d3
2022-10-19 16:33:15 +02:00