Commit graph

241 commits

Author SHA1 Message Date
jenkins-bot e0f6e21ac7 Merge "Remove PNG rendering mode" 2022-11-22 19:07:20 +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
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
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
Reedy 6081e9b01a DeclhTest: Fix string interpolation
Bug: T314096
Change-Id: I1c2a11c1481ca7d8e91e9c0468600ace9038e333
2022-11-04 18:08:02 -06: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
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 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
Stegmujo 2ae8f50348
Add final nodes
Related code:
fb56991251/lib/nodes/

Bug: T312528
Change-Id: I01b99430d510c0df452d1faba340e2595ae50a33
2022-09-06 14:42:37 +02:00
Stegmujo d940161a3e
Add further nodes
Related code:
fb56991251/lib/nodes/

Bug: T312528
Change-Id: I8bd30bc45d2c23214b317ca0c04aa8e7d6a2da33
2022-09-02 19:34:07 +02:00
jenkins-bot bfcb547e63 Merge "Minor: MathDatabaseTest cleaning" 2022-08-26 17:15:36 +00:00
jenkins-bot 008f6a6739 Merge "Add some basic nodes and texUtil" 2022-08-26 17:06:28 +00:00
jenkins-bot 1d3bbf8fe7 Merge "tests: Skip schema test for sqlite/postgres" 2022-08-26 16:45:54 +00:00
Moritz Schubotz (physikerwelt) 7cae2517e5
Minor: MathDatabaseTest cleaning
* Remove unused constants
* Refactor deprecated wfGetDB

Change-Id: I926fbe59fd2fef9617da9870b8b9c2a6662f22df
2022-08-26 18:23:50 +02:00
Stegmujo 6be5724740 Add some basic nodes and texUtil
Texutil related functionalities and tests will come in other changeset.
Related code:
fb56991251/lib/nodes/

Bug: T312528
Change-Id: Iead338a31403348603442b43ae802270f6b1d675
2022-08-26 15:41:38 +00:00
Stegmujo 4901388cfc
Add TexNode
This is corresponding to 6c6988c4f6/lib/nodes/texnode.js

Bug: T312528
Change-Id: Idfd6826e6d15c0e70848e879dd23fc5e4cf113b5
2022-08-23 08:43:01 +02:00
AndreG-P 951dec1fab
REST API endpoint for popups
Implement a rest API endpoint that displays the popup that is currently
only shown on a special page.

Code was revived from Idd22057a88312bf1a1cb5546d0a6edca5678d80d

Bug: T288076
Bug: T233099
Change-Id: I65fcbf25ac5818f6c649daf494c719921247e8f5
2022-08-05 17:47:44 +09:00
AndreG-P 14c4df1336
Support new properties 'Symbol Represents' and 'In Defining Formula'
Add support for the new properties 'P9758' (symbol represents) and
'P2534' (in defining formula) for the special page that shows
in depth information about tagged formulae.

Bug: T312893
Change-Id: I39551e04487f77cca60c89e8c95293032fd5bd6a
2022-07-27 22:30:54 +09:00
Moritz Schubotz (physikerwelt) 480d241f97
Make dependency to Wikibase client config optional
The MathEntitySelector gets its config from wbRepo which caused a hard
dependency on the Wikibase client.
If the Wikibase client config is not available a default value (wikidata)
is used to determine the URL of the foreign repo.
As the dropdown will never do write operations, we restrict the repo
access to anonymous read only.

Bug: T313143
Change-Id: Iba33dfd32a78f4ad7c2e99a1f56218458ab884b4
2022-07-25 09:51:47 +02:00
jenkins-bot 12ca486684 Merge "Replace MathWikibaseConfig with ServiceOptions" 2022-07-25 07:10:18 +00:00
jenkins-bot 53a2ea9909 Merge "Provide static Factory Class for Math related services" 2022-07-25 05:52:32 +00:00
Moritz Schubotz (physikerwelt) 882c49599b
Replace MathWikibaseConfig with ServiceOptions
MathWikibaseConfig introduced additional complexity by passing through
some services to MathWikibaseConnector.
The remaining options were just a list of properties that could also be defined as ServiceOptions.

Bug: T313646
Change-Id: Ib9083c0cb62f6d972befc7f5dc3ed47f55cf92a5
2022-07-23 11:37:30 +02:00
Moritz Schubotz (physikerwelt) 73c41b4626
Provide static Factory Class for Math related services
Initially we provide one service. More services will come in
the future.

Change-Id: I98a0f5f181f729e123a063dabf3597b5effa55b8
2022-07-22 18:59:11 +02:00
Moritz Schubotz (physikerwelt) 0bec9dc904 Remove deprecated method hasSite
The method always returns true and has no obvious benefit.

Change-Id: I77727d37c16e6234cf13e0ccf5d8fe94142ddd2a
2022-07-22 12:51:21 +00:00
Moritz Schubotz (physikerwelt) a274beae78
Transform MathWikibaseConfig into a service
* add some basic tests
* migrate MathWikibaseConnectorTest to a unit test

Bug: T313331
Depends-On: Ic3b8d4f685d5cf648a02696284b6ee499502a12a
Change-Id: I38d6425eb5e2c52ae4362c4b8656223a8d9d90a5
2022-07-21 15:22:47 +02:00
Moritz Schubotz (physikerwelt) a8052d564b
Transform MathWikibaseConnector into a service
* add some basic tests
* MathWikibaseConfig should also be transformed into a service in a follow
up to allow for better testing

Bug: T313331
Change-Id: Iec7446a06d9a117cdeba9d26616f4fdf8e8540ca
2022-07-21 08:34:25 +02:00
Umherirrender e176ed68c3 tests: Skip schema test for sqlite/postgres
Running the updater twice (in test setup and in tests) confused posgres
-> Error 42P07: ERROR:  relation "mathoid" already exists

Change-Id: I1113888a38a49ee79b94d83c305eb99baa75f802
2022-07-19 21:06:45 +02:00
Stegmujo c60565c790 Remove some unused methods.
Bug: T310350
Change-Id: I0629b9a963bf57b1368ffc61f7c3b631b19f5260
2022-06-27 18:20:06 +00:00
russ-rogovetz 894c22989b
Replace getNativeData to getText for Math
Replace Content::getNativeData() calls with TextContent::getText() in Math extension.

Bug: T283679
Change-Id: Iaf3b7f82f14069374de8ede7b519d822f8d6010f
2022-05-30 21:04:39 +02:00
osamaahmed17 099e327cc6 selenium: Refactor WebdriverIO tests from sync to async mode
WebdriverIO has dropped support of sync mode due to breaking changes in Chromium, hence all tests have been changed to async.

Update npm packages: @wdio/*, wdio-mediawiki and webdriverio because async mode needs at least webdriverio v7.9.

Remove npm package: @wdio/sync.

Bug: T293076
Change-Id: I35b3b29c09e80306d14a12c5194efeead22a9804
2022-02-01 01:24:19 +11:00
Umherirrender e2e4f1cb6b Use ParserOptions::newFromAnon instead of ParserOptions::newCanonical
ParserOptions::newCanonical is deprecated.

Change-Id: I8e709cd4e1b2dbf86f10176a3bbc5854d463ede0
2021-12-18 20:10:48 +01:00
Alexander Vorwerk ee2867db2d MediaWikiTestCase -> MediaWikiIntegrationTestCase
MediaWikiTestCase has been renamed to MediaWikiIntegrationTestCase in 1.34.

Bug: T293043
Change-Id: Icef9bbb1c515b775ccdcf6bc692c8c2cab4ae503
2021-10-12 00:51:10 +02:00
Reedy df89742072 Remove global namespace class aliases
Depends-On: I7e8e7f5ec0ac2f995489a559e88fc55ab877e06e
Change-Id: Ie3f5d5880363777eda4608fe8753a69e7ff3c5f9
2021-10-01 16:30:09 +00:00
Petr Pchelko cfc2f4f319 Register 'math' parser option
Instead of modifying a page rendering hash,
use the proper mechanism of parser option
registration. The cache is still split on parser
option value. The 'math' option is lazy, since
not all pages contain 'math' tag and we want to
avoid an user preference lookup for every parse.

WARNING: this will invalidate ParserCache for
all pages that contain <math> tags, but according
to Moritz, this is about 1% of all pages, so we
should be fine.

Setting up the test is still rather hard and weird
due to very hacky rendering mode to user option
converter, and math renderer interaction with the DB.
This will be cleaned up later.

Depends-On: I92b3e18fabef4eecac2ec2a4844f1be2716e5d89
Change-Id: I3bce04684070ad306685dabbc51267def25773cd
2021-09-30 06:55:54 -07:00
Petr Pchelko b458303fed Move rendering modes name resolution to MathConfig
Change-Id: Ie1926f1da02f6ab585d3efbc71abe1716dac66e5
2021-09-30 06:29:36 -07:00
Petr Pchelko a3306b24df Clean up handling of user preferences
Change-Id: I3e8f0a0be16d92a411de796b8e25df3a7760099f
2021-09-29 10:28:03 -07:00
Petr Pchelko 9b7205599c Move math configuration methods into a service
This is doing a bulk of the job of creating a service
for working with math modes configuration. There's
still things to do, like moving math mode names,
and perhaps depending on default user options to
provide a bit more convenience, but that will be the
next step.

Change-Id: I1259a93651920f44104f2f5135e3e620c858be8d
2021-09-28 13:31:08 -07:00
Jakob Warkotsch 950b150e8c FP: Change PropertyId to NumericPropertyId
See ADR 22 for more info.

Bug: T289125
Change-Id: Id6293612a102d2785f5fee984af431e1219b64c0
2021-09-17 10:47:14 +02:00
Petr Pchelko 551340ee11 Skip wikibase tests if wikibase is not loaded
When running tests locally I don't want to install wikibase
if I'm not working on wikibase-math integration. It's
annoying that some of the tests fail in this schenario.

Depends-On: Id996abdb353547b95d795494ba961b9a215ef2ef
Change-Id: I836c7a3bab5393b7482e985d9148226373ae0a58
2021-08-13 18:43:42 +00:00
Petr Pchelko da8e918fb3 Enable most tests which were previously disabled
Additionally - remove RestbaseInterface::checkBackend.
When HTTP requests are banned from unit tests this method
makes no sence.

MathoidCli tests were not reenabled cause it's a bit hard
to mock shell acceess. Hopefully as part of Shellbox
transition we can have MockShell trait in core and reenable
those tests

Bug: T265628
Depends-On: I350ed59af603a0504704af3265787a4be8f2dc2a
Change-Id: I294d0ed905193850dc38cb3071eb9b31c8863121
2021-08-12 08:57:58 -07:00
Petr Pchelko 0cd6acd3f7 First pass at cleaning up error handling
The overall aim is to make renderer and checker
proper services and stop storing each operation
state in them. This patch reduces the number of
places where we store the lastError. I've decided
to stop here in the first pass so that the patch
doesn't grow out of proportion.

Change-Id: Ice7e1f9f2f074d62ef1819355a510ce0b0335d88
2021-08-11 06:05:33 -07:00
Petr Pchelko 404315973e MathLateXML: override getPostData
Instead of having a separate method for getting the post data
in MathLateXML, we can just override getPostData method from
parent and make the makeRequest method signature much simpler.

Change-Id: I07b683856885396ff7b6b5a40df79399828c8214
2021-08-10 12:12:53 -07:00
Petr Pchelko 44ad3fbdf9 MathMathML::batchEvaluate - only pass MathRenderer
We do not need a ParserObject in the batchEvaluate,
so only pass in the MathRenderer

Change-Id: Id2e8cad709c08a0225597cb1fbf85289830f828b
2021-08-05 07:09:59 +00:00