Commit graph

84 commits

Author SHA1 Message Date
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
Moritz Schubotz (physikerwelt) 0de63bdf6c Remove unused config variables from extension.json
Bug: T228547
Change-Id: I0aa7b624b645c3773b0d758634d370a494d1028a
2019-09-16 09:41:12 +00:00
Ed Sanders 1ce95efb54 Show latex source in context items
Change-Id: I32af1c13c31dc0f94434daa4a4db8c94a7033582
2019-07-31 22:55:03 +01:00
Amir Sarabadani eb7a8371d8 MathWikidataHook.php -> MathWikibaseHook.php
These hooks are related to Wikibase and can be used outside of Wikidata

Change-Id: I90e0abbdc54aa85957b15f60c4e821ee68b9517f
2019-02-08 19:49:08 +01:00
Volker E c131018ad1 Replace extension icons with standard OOUI icons
Replacing outdated 'chem' and 'math*' icons with standardized
OOUI icons from 'editing-advanced' pack.

Bug: T195480
Change-Id: Iefc02ca5c2f0c310fdc83fe26a17f7fcba5195b8
2019-01-23 23:48:02 +00:00
Ed Sanders ba66ec1375 Missing space in JSON
Change-Id: Icac4e36d17231163686d63c5493e1683ca7b83b0
2018-12-10 13:40:06 +00:00
James D. Forrester 428f5a847b Drop support for MediaWiki core's removed "2006 wikitext editor"
Change-Id: I59bad8faee3f0f998344f985eb675087533d3d8f
2018-11-06 17:19:43 -08:00
C. Scott Ananian 0f32a506a0 Replace deprecated untidy OutputPage::addWikiText() method
The replacement OutputPage::addWikiTextAsInterface() method was added in
MW 1.32; the minimum required MW version has been bumped accordingly.

Bug: T198214
Change-Id: Ie9932b7398d0a9184094a99aec060d78f62dd6f0
2018-10-19 17:53:34 +00:00
Moritz Schubotz (physikerwelt) f0c8840148
Add math related styles and script via appropriate hook
Create MathDataUpdater class that checks if statements
are using math and adds the stlyes required for math in that case.

This patch has no effect until
I5bc0622ee7338f3215d14e15331a0a1931ca1ae0
is merged.

After both changes are in effect
I0abd6acbfa12fd503d11476f0c8c8c8a8a851cdc
can be merged.

Bug: T173949
Change-Id: I0e24bbb53e6e01d549f534744780ca1afc49fdd7
2018-07-24 16:40:52 +02:00
Ed Sanders 9b2ba59ac9 Move icons to RL image module and generate variants
Bug: T196050
Change-Id: Ie6acbeac3d74b99278b8d5b0db3ca1d349065d5e
2018-06-02 21:56:49 +01:00
Moritz Schubotz (physikerwelt) 4156f1c9b7
Remove dead texvc code from the math extension
In T74240 support for LaTeX based rendering of the <math/>-tags was
removed. This change eliminates the unused code from the repository.

Bug: T195871
Change-Id: Ic57d83fa49f090b574ce8b82fd2ebc84a5350318
2018-05-29 17:41:53 +02:00
Moritz Schubotz (physikerwelt) b5cf0e0b77
Serve png mode from mathoid
* Use the exactly same routines to deliver png images that are used in
  mathml mode.
* Change the output to use mathoids png image rather than the mathml
  and svg output.
* Locally tested on Firefox and Chrome: Depending on the mode either
  the SVG or the PNG path is used.

Bug: T74240
Change-Id: I4b1cac92eb9a02190f316faab6621940951603d5
2018-05-21 13:47:49 +02:00