This patch is a result of an observation that when <math> tags being
placed before {{#tree:..}} call they are not rendering correctly and
displaying -postMath strip markers instead, so never being replaced by
the actual math markup.
The reason is that the TreeAndMenu do parse operations within its parser
function callback and considering the MathHooks::onParserAfterTidy is
programmed to clear all the MathHooks::$tags data after first call of
the hook it looses all the data stored.
This issue also should appear of <math> is used with any other extension
function that calls parser `parse`, `recursiveTagParse`, etc
The patch modified MathHooks::onParserAfterTidy callback making it
remove tag data only after successful replacement instead of clearing
all the tags data on the first call
Change-Id: Icd115c61492d2ee9aa2004ad1940ff837bd1059a
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
For now, the hook handler isn't actually used (T248551) but
when it is at some point it shouldn't use $wgUser
Bug: T248550
Bug: T248551
Change-Id: I826e91411deb91bbd8c58147b32fda3f3e7ed6a8
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
The current default for Message::__toString() is to parse, so this
keeps that behaviour unchanged.
Change-Id: Icf83608b031390126b5e8d29a5600d37589cf411
This allows it to respect the proposed limit on HTTP request timeout.
Bug: T245170
Depends-On: I8252f6c854b98059f4916d5460ea71cf4b580149
Change-Id: I1c3d96720709253ad15bb8528cdd132571de2e4e
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
* Currently PHP issues a unspecific warning if mathoid-cli does not
return a PNG image.
* This change suppresses this warning.
Bug: T200493
Change-Id: Ice7d12ca9131d76fe233fd332e37484feaf79883
Discussions in the Wikimedia Math Community show that there is consensus
to deprecate the use of MediaWiki specific LaTeX macros that conflict
with LaTeX macros from commonly used packages.
In this change, we show the deprecation warnings generated by mathoid.
Bug: T197842
Change-Id: I24dbb446665fdc227d0e7342fdbf8829b4c1bda4
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
$wgContLanguageCode has been an unconfigurable copy of $wgLanguageCode
since 2006 (MW 1.8).
Bug: T247674
Change-Id: I1d2ec1e63320086fdf9ab7c6321f949c99c1ab2a
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate
Change-Id: I57bb0f5bc4167ea4b4a50d666ad95c02fcc7d8c9
With this commit, the Math extension only depends on WikibaseClient
and no longer on WikibaseRepo.
Bug: T208758
Change-Id: Iac8f2568e0da1a4aff4f4b22d124626c8ecca8eb
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
When $wgMathoidCli is misconfigured the error message was misleading.
It was reported that the specified file was not executable, even though
other reasons are possible (e.g., nodejs misconfigured).
Therefore, we capture STDERR and add it to the error log.
Bug: T198564
Change-Id: I7d0ae0f3ab4789124f9ff1533e7712ca31233f9e
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 replacement OutputPage::addWikiTextAsInterface() method was added in
MW 1.32; the minimum required MW version has been bumped accordingly.
Bug: T198214
Change-Id: Ie9932b7398d0a9184094a99aec060d78f62dd6f0
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
* 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
The motivation for this patch is to make the code less complex, better
readable, and less brittle.
Example:
public function onExampleHook( Parser &$parser, array &$result ) {
/* This is the hook handler */
}
In this example the $result array is meant to be manipulated by the
hook handler. Changes should become visible to the caller. Since PHP
passes arrays by value, the & is needed to make this possible.
But the & is misplaced in pretty much all cases where the parameter is
an object. The only reason we still see these & in many hook handlers
is historical: PHP 4 passed objects by value, which potentially caused
expensive cloning. This was prevented with the &.
Since PHP 5 objects are passed by reference. However, this did not
made the & entirely meaningless. Keeping the & means callees are
allowed to replace passed objects with new ones. The & makes it look
like a function might intentionally replace a passed object, which is
unintended and actually scary in cases like the Parser. Luckily all
Hooks::run I have seen so far ignore unintended out-values. So even if
a hook handler tries to do something bad like replacing the Parser
with a different one, this would not have an effect.
Removing the & does not remove the possibility to manipulate the
object. Changes done to public properties are still visible to the
caller.
Unfortunately these & cannot be removed from the callers as long as
there is a single callee expecting a reference. This patch reduces the
number of such problematic callees.
Change-Id: I21d53c989ea487607dc69e6b3365c023ef6729f5
Without this change it would no longer load in safe mode (T185303)
because the module would be missing.
I think this has been copy-pasted from VisualEditor, see commit
I6d097ccbf1dc2462843219adcf96bf8313e30289 there for explanation.
Bug: T185303
Change-Id: I6644a361d1450c394a7f82dc3dad97515982846d
Without this change it would no longer load in safe mode (T185303)
because the module would be missing.
I think this has been copy-pasted from VisualEditor, see commit
I6d097ccbf1dc2462843219adcf96bf8313e30289 there for explanation.
Bug: T185303
Change-Id: Ieed46488c94c5809e9f17f667c6926a21ffe838b