Commit graph

95 commits

Author SHA1 Message Date
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
Physikerwelt 63e19a8c69 Revert "Revert "Add wbEntitySelector widget to edit qid in VE""
This reverts commit 2dc6bcac48.

Reason for revert: Re-enable functionality with fix

Bug: T313143 
Change-Id: I7536ae187872b9c0a6abab18861499290ad621e0
2022-07-23 07:57:54 +00:00
Reedy 2dc6bcac48 Revert "Add wbEntitySelector widget to edit qid in VE"
This reverts commit 422be143f6.

Reason for revert: Caused hard dependancy on Wikibase

Bug: T313143
Change-Id: Ia6f551307f0fbaa2a3fc5747ed180e588c60b02f
2022-07-16 17:40:09 +00:00
Fwolz 422be143f6 Add wbEntitySelector widget to edit qid in VE
Add the MathWbEntitySelector field to provide a dropdown menu which retrieves
the expression or qid from wikidata instead of the simple  TextInputWidget to
edit the qid in the Visual Editor.

Change-Id: I0a6fddd2c2978c9c4f195d668458b8d2ed478d98
2022-07-06 12:13:28 +00:00
Fwolz 74bd7c4730 Add text field in VE to change QID
Makes it possilbe to change the QID of a formula in the visual editor
quick editor and in the dialog editor inside the options panel.

Change-Id: Ie4cb651939a59bf4446cd3e5327522d100eac5bf
2022-06-01 12:27:43 +02:00
jenkins-bot 9e420ab960 Merge "Use new ResourceLoader namespace" 2022-05-24 23:44:32 +00:00
Tim Starling a5c7506265 Use new ResourceLoader namespace
Extensions using Phan need to be updated simultaneously with core due
to T308443.

Bug: T308718
Depends-On: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
Change-Id: I6d355e7037186e840a76f319886ed870419d9fc8
2022-05-24 22:59:43 +00:00
lens0021 cb9b94c0bc
extension.json: Fix the invalid name of $wgMathUseInternalRestbasePath
Bug: T308546

Change-Id: I63592f4cfdd4ec8f7774bf75fb847ffedfe6934d
2022-05-17 22:29:27 +09:00
lens0021 72a537e8a8 Add $wgMathUseInternalRestbasePath
Adds a new configuration variable that can be used to run RESTBase
independently from Math.

Bug: T306572
Change-Id: Ie40bd36a53fa5018364cf9268fee29533f4aa23b
2022-05-17 07:32:57 +00: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
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
physikerwelt (Moritz Schubotz) be9d701825
Add JS unit test
Add a first test to check that the testing framework is functional.

Bug: T288074
Change-Id: If4a6d14f14d7b964db31781b3caf23eb383c06c1
2021-08-05 09:54:10 +02:00
Petr Pchelko 45090ad369 Make use of MockHttpTrait instead of custom mechanism
Depends-On: I4c3aab6ab88695729b4f398dacf3575fbdb4dad4
Change-Id: I60b192c9b9c2ae434fb3f9aff8c460e0fc0806b1
2021-08-02 13:46:44 -07:00
Petr Pchelko e6507e95d7 Create Math.RendererFactory service
Change-Id: I474d746bae81ddf4322814c45141c981ecdb077b
2021-08-02 11:57:57 -07:00
Petr Pchelko e9bc5d3a42 Switch parser hooks to a new-style hook handler
Change-Id: Ie09e4cfb31a8aaea6f21d7472ae3a067dcc7c40b
2021-07-31 08:17:29 -07:00
Petr Pchelko ed08441fa3 Remove ParserTestTables hook handler.
This hook is no longer needed by core so it's not
called anymore.

See I5124789fac333a664b73b4b4a1e801ecc0a618ca

Change-Id: I9a554b4e70a2564834e1df4058b1ad5cb98a56e3
2021-07-30 13:00:46 +00:00
vladshapik a024908d5f Avoid using deprecated Parser::getUser
Bug: T287168
Change-Id: If3443b879ee01c3cbdbf94d1a690bd9c3bf182b1
2021-07-27 17:50:25 +03:00
Amir Sarabadani b4fd28f842 Replace class_exists with ExtensionRegistry
And also changing name of the function because it's making phpcs unhappy

Bug: T274275
Change-Id: I8d75fb919f87d2404d61ec756bc1cd27510f6d2a
2021-06-21 13:58:31 +02:00
physikerwelt (Moritz Schubotz) d25dc0fb79 Remove wgMathUseRestBase
Bug: T274436
Change-Id: I0c0311130516646833ef862e047c8f540f40c92a
2021-05-14 14:39:25 +02:00
Reedy b0f07ee605 Namespace extension
Change-Id: I7ba90b35e5b6f6e4c296079fc524667ea41c0980
2021-04-08 01:17:14 +01:00
jenkins-bot 7bb3d281da Merge "Use Mathoid to validate Wikibase formuale" 2021-02-23 21:06:52 +00:00
Moritz Schubotz (physikerwelt) 35d57a65cc Use Mathoid to validate Wikibase formuale
* Reenable math validator tests
* Introduce $wgMathUseRestBase which defaults to true
  and determines if mathoid is used via RESTbase or directly
* The effect of this change can be tested by setting $wgMathUseRestBase
  to false, and then creating a new statement of a property with type math.
  One should see a connection to mathoid for every new string and one should
  also see the WAN cache for the check endpoint to fill up. Note that
  setting WANObject cache to the database simplifies the investigation
  of the WAN cache content.

Bug: T274436
Change-Id: I40109e9e09464da78bf855646fb800ee87c1ea67
2021-02-18 22:13:58 +01:00
Timo Tijhof 2308e436ce Remove redundant ExtensionRegistry callback
This additional hook does not seem to be needed.

- wgMathValidModes: All access to this information already uses
  getValidModes() and thus there is no need to write this back
  to the input variable (use outside the extension is not supported
  and it is already not used as cache either).

- wgMathDisableTexFilter: All access already uses getDisableTexFilter()
  Move the last bit of logic there instead.

- wgDefaultUserOptions: Duplicate of this already exists in the
  onGetPreferences hook higher up.

This seems almost too easy, so I suspect someone tried this before
and intentionally didn't finish it because of some non-obvious
issue.

See T189966 for related perf anaysis.

Change-Id: I4d7fdf6fcae3d44a37bf80d9c72fff2b4361f0c9
2021-02-10 23:29:49 +00:00
Moritz Schubotz (physikerwelt) ba19b3e1cd Implement wikidata entity selector
The current wikidata entity selector requires WikibaseRepo to be enabled on the client wiki, which is only the case for very small installations.

We implement our custom entity selector that
* displays the item label and
* uses the description as tool-tip.

The implementation was inspired by
mw.widgets.TitleInputWidget.

Bug: T229939
Change-Id: I35d6cc317cf2984d9de6e062f79030f5c31c0811
2020-12-19 09:11:40 +01:00
Moritz Schubotz (physikerwelt) 31aa824cc9 Remove RESTbase check compatibility endpoint
Change-Id: I8c539e96519e0f23ed606403ed88370edde70764
2020-11-24 19:24:41 +01:00
jenkins-bot a1e4882543 Merge "Register refresh links hook" 2020-10-27 22:43:19 +00:00
Moritz Schubotz (physikerwelt) a12b91cdc0 Register tracking category texvc deprecation
* list math-tracking-category-texvc-deprecation on Special:TrackingCategories

Bug: T256468
Change-Id: I6e629b299021684a65c61df044f7abba51377763
2020-10-26 08:56:49 +01:00
Moritz Schubotz (physikerwelt) 6f41c0887c Register refresh links hook
* register hook
 MathHooks::onMaintenanceRefreshLinksInit
 from MaintenanceRefreshLinksInit

Bug: T248551
Change-Id: I0607265df22da5ab26cfc4c8958e9502b0e31b12
2020-09-29 18:06:08 +02:00
Reedy 939fcce084 Bump required MW version to >= 1.35
Change-Id: Idb720c4c82bc0589426c3bda7c10ecbb1a128323
Follows-Up: I1c3d96720709253ad15bb8528cdd132571de2e4e
2020-06-15 21:53:21 +01:00
Moritz Schubotz (physikerwelt) 7c41bc19f8 Add mathoid check endpoint to REST API
Expose the math checking service via the REST API.

Port the behaviour of the RESTbase check endpoint to a new endpoint
that uses the MediaWiki API.

* this endpoint does not (yet) provide actual rendering (only checking)
* consequently it does not supply the x-resource-location header

Bug: T252390
Change-Id: I28bcb9a925953062b43cd3481536784431edcd8a
2020-06-01 12:11:24 -07:00
Moritz Schubotz (physikerwelt) 707ad58598 Add MathCheckerFactory Service
Use WANObjectCache rather than genuine DB tables for greater
flexibility.

Note, this commit is the second step of Ifd89e2d9cb30fa15cc318f077b434207ed6b7214

Bug: T252390
Change-Id: Ifa7d943875f05088ef697a5a18ad292342a9b4ad
2020-05-27 07:29:49 +02:00
Moritz Schubotz (physikerwelt) fc0faf18c3 Move checking code to a new namespace
Introduce new namespace \MediaWiki\Extension\Math\ and move checking
code to this new namespace.

Note, this commit is the first step of Ifd89e2d9cb30fa15cc318f077b434207ed6b7214

Bug: T252390, T187154
Change-Id: I8c93f4b21d4a72ef2d52d4774d69e4ef55d037ec
2020-05-12 21:26:45 +02:00
Reedy 4c8b4deb2f Convert to manifest_version 2
Bug: T252470
Change-Id: I49e84a81a8d3d77883d925991a83c5cb29c34826
2020-05-12 01:46:30 +00:00
Moritz Schubotz (physikerwelt) c57ee06598 Change default for wgMathLaTeXMLUrl
The xsede project was terminated. Thus a new sane default is needed.
This value is picked up by extension MathSearch.

Bug: T117659
Change-Id: I7845484a603ef008c9373b76202705c818184dc1
2020-04-05 16:35:25 +00:00
DannyS712 08291a2adc extension.json - don't use array syntax when hooks only have 1 handler
Change-Id: Icedb34ae5183240458d2da39a031df60093c8d6d
2020-03-21 10:20:39 +00:00
Umherirrender 50b030a6ac Move test-only classes to new TestAutoloadClasses declaration
Bug: T196090
Change-Id: I1a5bc889f011cc2f9c5b08b0f3f94005357ac2a1
2019-12-31 00:44:53 +01:00
jenkins-bot 45e6751a3c Merge "Don't list Special:MathWikibase if the wikibase client isn't loaded" 2019-12-30 09:05:52 +00:00
AndreG-P 30ca468200 Activate formula links
Activate formula links by default in Math extension.

Bug: T239356
Change-Id: I37345ca280d326d59b270d61fa578546bfff285f
2019-12-29 04:20:07 +09:00
DannyS712 8faab2c2a0 Don't list Special:MathWikibase if the wikibase client isn't loaded
Bug: T241507
Change-Id: I23f6e8e72afeb791b3709d423041c02b58eb0b4a
2019-12-28 09:06:47 +00:00
Karsten Hoffmeyer 2b2ddac15a Switch configuration parameter setting to a working URL
--> URL as suggested on Phabricator

Bug: T209563
Change-Id: I87e4df0365e8c718cc00c9990ebce7e03026ec37
2019-12-17 22:35:41 +00:00
AndreG-P 4c56817ba3 Delete Math Wikibase API
Delete the unused wikibase API endpoint in Math extension.

Bug: T240458
Change-Id: I3e6b0cfd61e8be8c65e64f85945bca32a4ba6089
2019-12-13 00:23:53 +09:00
Umherirrender 0be18dc97d Move test helper classes into own class file
Also fix the name of one test file to match the file name

Change-Id: If622e925645cf21bf726f4db0f779182d78bbd73
2019-12-06 21:47:52 +01:00
Amir Aharoni 67108480b3 Move API messages to a separate file
Bug: T189982
Change-Id: I3155ef30739ec343c011c57525757de8ab3fe35a
2019-11-25 17:51:19 +01:00
Moritz Schubotz (physikerwelt) 4a7bc3ee31 Add special page and API endpoint that show information from math Wikibase items
Add a special page and an API endpoint to fetch data from Wikibase
items with a given qID. The special page summarizes information from
Wikibase. The API endpoint allows to request the information
directly. Both, the API endpoint and the special page, fetch the data
from a new helper class for consistency.

Bug: T208758
Bug: T229939
Change-Id: Idd22057a88312bf1a1cb5546d0a6edca5678d80d
2019-11-14 23:42:35 +09:00