Commit Graph

23 Commits

Author SHA1 Message Date
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
Umherirrender 791dcde7f9 Fix caller name in MathRenderer::writeToDatabase
Seeing {closure} in the logs as caller is not helpful

Change-Id: I2b50ead956fa0df5a220b97f7e1523671bf46866
2018-09-30 13:36:12 +02:00
Umherirrender c82458bbbc Remove @global doc annotation
It is unknown to doxygen

Change-Id: I1ef4bf4292b78fcd434f35c31f75b08b9c6a49d8
2018-09-09 20:53:28 +02:00
James D. Forrester 087a973f30 build: Bump mediawiki-codesniffer to 22.0.0
Change-Id: I448e8d368d76eee40fe57c89428a0ce472c48d01
2018-09-06 11:48:25 +00:00
Zoranzoki21 4f5225d612 Fix common typos in code
Bug: T201491
Change-Id: Ib1f2e5ea8a67311702d82c46741903f58449a09b
2018-09-06 11:00:32 +00:00
jenkins-bot b542793035 Merge "Remove @return from MathRenderer::setPurge" 2018-08-07 17:14:53 +00:00
Umherirrender da2b19de0c Remove @return from MathRenderer::setPurge
The function does not return anything

Change-Id: Id3eca085c0419aef02c59be5973bb27a4635ccb7
2018-08-07 09:42:17 +02: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
Thiemo Kreuz 97000ed8b0 Fix "@param $…" missing the type
Change-Id: I8d20ae852100a6ecc39df05eab3aa8e2b9c09480
2018-06-20 11:10:43 +02:00
Thiemo Kreuz 5648b8e2c3 Make use of the …::class feature whenever possible
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
2018-06-06 12:13:04 +02:00
Moritz Schubotz (physikerwelt) aa2c4cf913 Improve tests coverage for MathMathML
* 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
2018-06-01 15:36:35 +00: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
libraryupgrader 2587469834 build: Updating mediawiki/mediawiki-codesniffer to 20.0.0
Change-Id: I4385a05df9b40d4da19f280bd211e8c261d22c41
2018-05-26 04:26:21 +00: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
jenkins-bot 22d63b1973 Merge "Throw InvalidArgumentException when validating/formatting null" 2018-05-18 19:00:32 +00:00
Thiemo Kreuz b12b4f740f Throw InvalidArgumentException when validating/formatting null
Change-Id: Ia46f76a89b26c830aab70ebf5fcc222711c325d1
2018-05-18 20:02:43 +02:00
Thiemo Kreuz 670f0bb8f9 Don't expect objects by reference in hook handlers
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
2018-05-15 17:50:08 +02:00
Kunal Mehta 7a53bd905c Disable PHPCS more narrowly
Change-Id: I20d8b519d5827e865ccd3adf7c2c6ba069f37afb
2018-05-03 19:00:55 -07:00
jenkins-bot dcf8f0926d Merge "MathChemSymbolsDataModule: Remove origin restriction" 2018-04-30 20:42:06 +00:00
Bartosz Dziewoński 7270d702f1 MathMathSymbolsDataModule: Remove origin restriction
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
2018-04-30 22:26:28 +02:00
Bartosz Dziewoński 4ccb9abe8a MathChemSymbolsDataModule: Remove origin restriction
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
2018-04-30 22:25:52 +02:00
Moritz Schubotz (physikerwelt) 9fee65ae24
Generate HTML tag using HTML class
Change-Id: I8c37fdaa112cfeac0466f4380e972b63404a8d35
2018-04-23 15:39:30 +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