Commit graph

125 commits

Author SHA1 Message Date
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
Moritz Schubotz (physikerwelt) 6e28bf8743
Move php source files
Move php source files to scr. This allows jenkins to calculate the test
coverage.

Bug: T126034
Change-Id: If012c6a4fce0fdeaa5a63dad23210a42d1fc80e6
2018-04-23 15:09:23 +02:00
Jayprakash12345 270b942c64 Update extensions to take advantage of parser test autodiscovery
Bug: T170037
Change-Id: I2fe982bc146355d7faec03e39a2a59e9d32e22be
2018-04-13 17:37:23 +00:00
jenkins-bot 13640dfeea Merge "Mathoid CLI interface" 2018-02-21 22:39:41 +00:00
Moritz Schubotz (physikerwelt) b9f84f804b
Update default configuration
Make math run out of the box without any additional setup.
After this the only remaining 'additional' requirement is 'php-curl' (cf. I25edfcb34ee5451a742cac6ae099019a16f6c417)

Bug: T186327
Change-Id: Ied495f0a4bb2d6292a8d926ae3e2891a0091eeed
2018-02-21 22:09:22 +01:00
Moritz Schubotz d8822169ab
Mathoid CLI interface
Renders formulae via mathoid without to run mathoid as a service.
Mathoid 0.7.1 or later must be installed locally and configured to be
accessed directly from the math extension. It has been tested with the
config.dev.yaml of version 0.7.1. If mathoid is installed in
'/srv/mathoid' the following line might be added to LocalSettings.php
$wgMathoidCli = ['/srv/mathoid/cli.js', '-c', '/srv/mathoid/config.dev.yaml'];
i.e., make sure to specify the -c parameter with an absolute path.
In addition mathoid uses more memory than the the default. With
the config.dev.yaml a value of
$wgMaxShellMemory = 2097152;
has been tested to work well.

Change-Id: I0600f056d21927963267cf979d342e313419e9fa
2018-02-21 20:29:20 +01:00
Tulsi Bhagat b9c070c6f2 Removed deprecated position statements from resource loader module
Bug: T184257
Change-Id: I09a57f53db1cb830b832849c4cd7307c460d3156
2018-02-12 11:19:56 +00:00
Kunal Mehta 1509a19a3f Use SPDX 3.0 license identifier
SPDX released version 3 of their license list (<https://spdx.org/licenses/>),
which changed the FSF licenses to explicitly end in -only or -or-later
instead of relying on an easy to miss + symbol.

Bug: T183858
Change-Id: I998ba3c3b3adaf66b7a028d5fab1d7169d595b6c
2018-01-31 23:19:23 -08:00
Umherirrender 13d43ec6be Rename files to match classes
Change-Id: Iecf3ea2d0e7ec3dc0f743a3d1a8d85463939d19d
2017-12-10 12:42:41 +01:00
Umherirrender fc2d573028 Add config for tracking category math-tracking-category-render-error
The tracking category was added with
If7537ed9117fb736a09f4396b7d55d774ce9674f

Bug: T173371
Change-Id: I6cdcfa0ece8e2b2644106bc219b538702b0bb2d8
2017-08-16 16:35:40 +00:00
Amire80 8674fdd47b Correct "operators" message in chemSymbols.json
Follow up to
I4452ceca55197fda5f1e1293a5741c6f5fb7c245

Change-Id: I061180179da83a7ad1229999ed97a783777bcfed
2017-02-23 19:34:54 +00:00
Amire80 848d762e24 Add support for chemical formulae in VisualEditor
The chemical and mathematical formula inspectors and dialogs
have a lot of similar functionality, and the common parts are
now moved to the common MWLatex class.

MWMath* classes now inherit from MWLatex*, and so do
the new MWChem* classes.

Bug: T153365
Change-Id: I4452ceca55197fda5f1e1293a5741c6f5fb7c245
2017-02-19 18:36:26 +00:00
Amire80 48a5a0a7e8 Split ve.ui.MWMathPage.css from ve.ui.MWMathDialog.css
There are separate JS files for them, so the CSS should be separate, too.

This is a part of the refactoring that is required for bug T153365.

Change-Id: Iadbe5eeccff25ed1d184658945a4eb52e465d863
2017-01-11 19:44:31 -08:00
Physikerwelt 797c8ddfc9 Revert "Add class mwe-math-element to math elements"
This reverts commit e674d7e73b.
That commit does not help to solve T134281.
It adds a CSS class name which is configurable
by a global variable to various math elements, which is confusing.

Change-Id: Iea5f231e0cea1221dc717b3409b36c0baf11bb24
2017-01-03 23:57:46 +00:00
tameeshb e674d7e73b Add class mwe-math-element to math elements
This is the fix for the bug that makes the whole page scroll when long 
equations are present in the wiki article.

Bug: T134281
Change-Id: I29f8df027384098cd0923bcfa23a914c8d887bba
2016-12-21 23:03:18 +00:00
Reedy b8d6ba165b Remove 'UnitTestList' hook
No longer needed now that extension unittests are autodiscovered.

Bug: T142120
Bug: T142121
Change-Id: I08e3fdf24481a0404c2bf9822d5d02b815cb2e76
2016-08-05 19:00:28 +00:00
Moritz Schubotz 14ec229cf9 Add tracking category for math errors
Bug: T134872
Change-Id: I6d0bce34aacfba27bedda23f6395001dae9c6568
2016-06-06 12:06:22 +00:00
Ed Sanders dba9d04c8c Load math styles with VE
We could load them async in the view node and the dialog
but the file is so small.

Bug: T136407
Change-Id: I7feb63cc2d8cb8975b714066aef1934c248f4ca1
2016-05-27 15:04:30 +01:00
Frédéric Wang be7be3becb Remove woff fonts
1) Because enabling native MathML now requires special configuration steps
  from the users, they can as well just check their math font setup. Hence we
  remove the Web font fallback.
2) We then can actually just remove ext.math.desktop.css since no specific
  style is necessary any more on desktop.
3) We also no longer need to add the Web font to the list of font-family on
  the <math> element. We actually just remove the whole font-family rule so
  that it is up to web engines developers & users to decide the best math font
  to use (e.g. via the "Fonts for mathematics" option in the font preference
  menu of Firefox).

Change-Id: I1818d288b0f28715a460e3163590e4d0374c42b4
2016-05-23 14:52:59 +00:00
Marko Obrovac d8e172f713 Allow the number of concurrent connections to be configurable
The MultiHttpClient class allows the user to set the number of
concurrent connections it keeps open. This patch simply allows users of
the Math extension to set it when connecting to RESTBase.

Note that this patch is effectively a no-op, since MultiHttpClient's
default is (also) 50.

Bug: T132096
Change-Id: If9b6e61ffa23f8d22b3aab874058e809ff4c74b8
2016-04-13 21:31:29 +02:00
physikerwelt 31cd0d611a Insert MathML content after tidy
* BeforeTidy caused problems when math tags were used
  within links.

Bug: T130508
Change-Id: Icb9b88a7552d14231f96cbfd2b3cf3fa7e29276d
2016-03-24 13:31:15 +00:00
physikerwelt 9e605e09cd Render all math tags in parallel
Bug: T125543
Change-Id: Ia2febf2c0309e5de514445ad2aad58b7e5ce6837
2016-02-18 02:25:38 +00:00
physikerwelt 5f16307582 RDF Formatter for Math data type
Bug: T126349
Change-Id: I15fbeec282868b4267a3e3d15740f2c3ff37ea48
2016-02-12 20:38:27 +00:00
aude d293620809 Add license-name to extension.json
Change-Id: Iadec5b3253b13b9163140ac8ef1e27f10718dbd2
2016-01-16 21:21:09 -05:00
Marius Hoch d955be7eca Introduce a "MathEnableWikibaseDataType" config
Set to true per default.
In order to be able to switch it off in production
for a coordinated deployment.

Change-Id: I520b2ff1ae6dc3bad4b6067f0b673821d3c01cb4
2016-01-12 21:22:49 +01:00
jenkins-bot 6c61ce19fa Merge "Implement datatype 'Math' for Wikidata" 2016-01-12 12:14:59 +00:00
lyrianos93 946a18d14c Implement datatype 'Math' for Wikidata
This change implements all components to use the datatype 'Math' in Wikidata.
Because 'String 'is used as value type, only the Formatter and Validator are needed to be implemended.

The components are:
* hooks
* Formatter class
* Validator class
* Test cases

Bug: T67397
Change-Id: Ic64fd6c8560f48052e2db24ae1f013d48a82b5e9
2016-01-11 22:29:29 +00:00
Thalia 5fe280c3cf Allow users to choose math inspector or math dialog
The context item for math nodes now has two edit buttons,
one for the inspector (edit inline) and one for the dialog
(edit). Creating a new math node automatically opens the
dialog.

Bug: T120382
Change-Id: Icd3ec75262fcc5e0cbc304051c651278b0d8b01c
2016-01-04 08:20:16 +00:00
paladox 19db7ea163 Bump version to 3.0.0
Requires https://gerrit.wikimedia.org/r/#/c/226998/

Bug: T99369
Bug: T106414
Change-Id: I82c4eda7b73fddf8a08694b339335659e6ad2506
2015-12-08 23:13:30 +00:00
physikerwelt f63eaeac23 Restbase based texvc input check
This change only connects the restbase and the mathinput interfaces
but does not change any functionality.

Change-Id: I3a23e5008c26c5f14ad842dcb5d22906a8aff33c
2015-12-03 08:56:47 +00:00
physikerwelt 6ef2e56439 Add Restbase interface
* Add a simple interface to Restbase that currently
  does not do anything.

Change-Id: I4c2ef329b3954fd35276a5e270d0dc3fcacabf7b
2015-12-01 21:10:09 +00:00
Thalia 6e73aaf86c Make math dialog with clickable list of formula fragments
The main components are:
- a menu of formula fragment buttons
- an ace editor text input into which LaTeX commands are
inserted on clicking the buttons
- a preview of the formula

The deviations from the draft design (full-width menu,
smaller buttons, dialog is 'larger' instead of 'large')
are so that more buttons can be seen at once.

Depends on Ia0f46da2d4 in ve-mw
Depends on Ib75fb7b087 in ve-mw
Depends on I758f90abb9 in ve-mw
Depends on Ibcd941d938 in CodeEditor
Depends on Ie814f59086 in oojs-ui
Depends on If540670bf2 in oojs-ui
Depends on I5f70f133b7 in ve core

Bug: T114163
Bug: T118617
Bug: T118618
Change-Id: I96d4b72f2e49ad3f43a2e5c71f0d348fdfb35503
2015-11-23 16:30:38 -08:00
Ed Sanders abad392272 Rename modules/VisualEditor to modules/ve-math
Per new naming convention (i.e. to be consistent with
ve-graph).

Change-Id: I3eae4ce011f0078b204d882a8068f844cd19daa3
2015-09-17 15:10:30 +00:00
physikerwelt 866854b7ca Support for LaTeXML line break feature
* LaTeXML has a feature to add automatic line breaks
* This change adds a new integration test
* Sets a default line length of 90
* add the additional display attribute 'linebreak' which
  can be used to enable the feature
* mathoid support for line breaks will follow shortly

Bug: T106423
Change-Id: I029328849f05ec2afcabf38d2b79b337cb54cbd5
2015-08-02 11:55:25 +00:00
physikerwelt bc52c77d24 Use extension.json, empty PHP entry point
* Use string constants instead of integers
* Derive new names from old via conversion of constant
  naming convention to CamelCase.
* Replace old constant string e.g. 'MW_MATH_ABC_DEF'
  with new string 'abcDef'
* Replace old constant value with new string.
* Tests to demonstrates what is actually done.
* Rename constants

Bug: T106630
Bug: T106631
Bug: T87941
Change-Id: I6d1094ece79e912d9ddbef6681a25196c7a6e801
2015-07-30 22:01:20 +00:00