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
Use WANObjectCache rather than genuine DB tables for greater
flexibility.
Note, this commit is the second step of Ifd89e2d9cb30fa15cc318f077b434207ed6b7214
Bug: T252390
Change-Id: Ifa7d943875f05088ef697a5a18ad292342a9b4ad
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
Using assertContains() with string haystacks is deprecated and will not
be supported in PHPUnit 9. Refactor your test to use
assertStringContainsString() or assertStringContainsStringIgnoringCase()
instead.
Change-Id: Ic35f3c60a7f49dfe244b87192d7f161c117b37e1
Actual changes:
* Let the special page accept the subpage parameter, e.g.
[[Special:MathWikibase/Q6203]].
* Fix some of the message escaping issues in SpecialMathWikibase.
Messages that are just plain text and not supposed to contain any
parameters, wikitext, HTML, or something like this should be
properly escaped, either via Html::rawElement( $msg->escaped() ) or
better Html::element( $msg->plain ). The later approach is cheaper.
Other code cleanups that don't affect production:
* Reduce the amount of duplicate code in SpecialMathWikibase.
* Make use of the preg_match() return value.
* Remove default parameters from parent::__construct() call.
* Remove some auto-generated comments.
* Remove some comments that don't add new information, but just repeat
what the code already says.
* Make use of PHPUnit's assertCount().
We can split this patch into smaller patches, if you prefer. This
should especially be done if one of the changes is controversial, to
not block the other changes. Please tell me.
Change-Id: I8c20014435af3d2ac9c7381fe5fd00b9fe49b2c2
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate
Change-Id: I57bb0f5bc4167ea4b4a50d666ad95c02fcc7d8c9
* Get rid of a few more MockBuilders and mocks that aren't needed.
* Make sure the original constructor is always called. This is highly
relevant for I263a711.
* Fix mixed order in assertions. In PHP, the expected value comes first.
* Add some missing inline @var type hints.
Change-Id: Ia15d62af56dfdb61bc2514aa994ce3d4ecd6e077
* Replace MockBuilders with straight constructor calls, if possible.
* Use TestingAccessWrapper instead of using reflection directly.
* Favor assertSame instead of the loose assertEquals. Note how this was
actually hiding a bad assertion in one place.
* Remove some tiny pieces of dead code.
This was motivated by I263a711. I hope this patch here helps unblocking
the other.
Change-Id: I66efb818243a41aeed5fcd51fd520cd0d4acee4d
Some mentioned a "__constructor", which should be "__construct".
The leading backslash is not strictly needed by all tools. But some
need it. I learned it's best practice to always have it.
Change-Id: I22fe3a3b4828c02ab5a457aba9af5af1c72567ea
Gets warning information from restbase and adds tracking categories
for deprecated chemical syntax.
Refactor mechanism to add tracking categories, and avoiding rechecking
already checked formulae.
Depends on: Ieca66f45ae7685d61eece1624bd7ff65ccad2eaa
Change-Id: I10e78ab79015dc1331f645c60b25bbbd237e23fe
The comments behind @group Database prevented the tests from being run
as part of the --group Database phpunit jobs.
Bug: T202223
Change-Id: I8dc68d3d90502fa7bd691cf18f0e296d97d3c893
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
Note that a class is not resolved this was. …::class is not a function
call. It's more like a named string constant. Technically still a
string. The advantage is that IDEs and tools like linters can much easier
understand that these strings refer to a class, and list them in usage
reports, renames, and such.
Change-Id: I5225543dbb837685a1840837cb2772dd576cca38
* deprecate and fix pickHost. It was broken and never used.
* simplify inputTypeSelection
* remove superfluous is_array check for the result of explode
Change-Id: I392f22f074facfe30b97d53a3002f464a471b67e
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
They are replaced by Selenuium tests in Node.js.
Bug: T162455
Change-Id: I1f5bc8f9c5cd687a6ba116f2f0461eb2992096c7
Depends-On: Ibd8a39cc75231932f872456b8d3ec1fe41ef23e2
* 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
* currently the phpunit tests are not triggered by jenkins
* some test can't be re-enabled possible reasons:
** the texvc and texvccheck binaries are not available from jenkins
** the binaries can not be generated
** the path to the binaries are not set up correctly
Bug: T142120
Change-Id: I0c8fe5ad652c4663eeb029781521acbf56e42bad
A formatter like this is not supposed to check if the format is known
or not. The code calling these formatters can introduce new (sub) formats
any time. What a formatter like this should do then are two things:
* If it's some HTML format, always return HTML.
* If you really can't identify the format, do a sensible fallback.
This currently blocks introducing a new format in Wikibase.
Bug: T46727
Change-Id: I585069e8f2ba33ec657ca4d514c6d502fe0f5ba3
This is obviously copy-pasted from somwhere else. Note that this tag
only appears in these two files. No other file does have it. It's not
useful for anything this way.
Change-Id: I7e0dcf0594fb59b396b1fd26b13383d59227b3f9
Documenting protected members as protected members is not really helpful.
One can see this by looking at the code.
Same for documenting a variable named "$html…" as "HTML". This does not
add anything.
Change-Id: I72364b6857166d77b9c85aa884cd139dc163c6bb
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.LicenseComment.InvalidLicenseTag
The following sniffs now pass and were enabled:
* MediaWiki.Commenting.FunctionComment.MissingParamComment
Change-Id: Ia8000677263c4150d4900526bcba1c0602664b8e
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
Phpunit now checks if the coverage annotations are reasonable.
This fix corrects unresolvable references in phpunit covers annotations.
Change-Id: I7eba10bd7dc445b175df750465bb80bd5ef0f4c6
The following sniffs are failing and were disabled:
* MediaWiki.Files.ClassMatchesFilename.NotMatch
* MediaWiki.Files.ClassMatchesFilename.WrongCase
* MediaWiki.Files.OneClassPerFile.MultipleFound
Change-Id: Ia2c06ebe33acefdf03625d86d98bf0dbaf826c4c
Display error message in the UI,
if the check command passes,
but the mml/svg/complete endpoints returns an valid json error.
Bug: T143225
Change-Id: I50776926e42f75a2c1e30fc9afe08baae3fcdbd1
The test is broken on beta cluster because the formula is rendered as
meta tag. It is rendered at img tag on my mediawiki-vagrant virtual
machine. The test now works on both environments.
Bug: T128190
Change-Id: I458d618af24533d104fcac25a8d8c6468b14605a
selenium* jobs are a new way of running Ruby based Selenium tests. The
jobs are triggered daily.
Bug: T128190
Change-Id: Ide349ea15e0c38ff9f61d348abd61cd2349a83f6
It was reported that under certain circumstances a semicolon was
missing from the SVG style.
Bug: T132563
Change-Id: I148433657848fdc74889fcaf6d883078c46a4006
Diffs should show the rendered output as well as the TeX source,
so changes that do not affect the output noticably can still be
assessed by looking at the diff.
Bug: T125712
Change-Id: I098d30ea3158ec34723bfca313cf2bcc4cbc591f
When user is logged in, visual editor is the default editor. When user
is not logged in, source editor is the default editor. When the test
does not log in, everything works just fine.
Bug: T126463
Change-Id: I1f15000a275657c0a92172781f57c5d1db537dcc
The problems was that visual editor is the default editor at
en.wikipedia.beta.wmflabs.org, and the test was expecting source editor.
The test now works also locally, using mediawiki-vagrant.
Removed headers from some files. We no longer use those headers.
Removed cucumber tags we no longer use, mostly internet explorer.
Added missing dependency (rake) to gemfile.
Bug: T126463
Change-Id: Ia5809f40719a2fe0c6c94338072a38765fa5c87b
* Add support for LaTeX package mhchem.
* Add hook <ce>
* Add format <math chem>
See bug description for the details.
Bug: T98306
Change-Id: I2ab80834edc5d071618bc52f133cfb2b7ece5016
This fixes some warnings in my PHPStorm, gets rid
of duplicate code, inlines constants that do not
make the code easier to read, and more.
Change-Id: I02f446491509043f5d3e51e26e932f76c9ecb6cf
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
The simple math test failed to find the edit link on a non existent
page. It was looking for the text 'Create source' from Vector which is
now simply 'Create'.
Change the PageObject selector to use a CSS selector, more robust to
text changes.
Change-Id: Ifcbd07da8e343b5697fcff6af6ffac90ff4d6420
* This will increase the performance of tex rendering for all
rendering modes since no shell access is required anymore.
Merge with caution. If the connection to restbase fails, rendering
of new formulae will be completely disabled i.e. broken.
Change-Id: I1982612e8c6a356e3dbdf447724ac82e5968cc77
This change only connects the restbase and the mathinput interfaces
but does not change any functionality.
Change-Id: I3a23e5008c26c5f14ad842dcb5d22906a8aff33c
Tex validation should be skipped if checking is disabled.
Consequently if 'disable tex filter' is set to 'never' it's a double
negation and tex should always be checked.
If 'disable tex filter' is set to always, never check tex.
Change-Id: Ic6fda8016838eae03a0ed36e3d8d4f35423ba8b1