Positive as well as negative tests. This patch intentionally doesn't
touch the implementation but simply documents how the code currently
behaves.
Change-Id: Ib670ad680087e520f4a99e932e5a2a9fd2d115de
Personally I find this easier to read. It allows to maintain a compact
list of input values with the expected output.
Change-Id: Ifeb532e2b94c674b512b3c40f101977939b83cd5
This apparently doesn't make that much of a difference, but should
still be worth it. Strings that don't start with a backslash can not
match anything. We can stop much earlier in this case.
Change-Id: I1efb8dc6807931a075f450c56f9bbd64980c879a
We fixed this in I47b6d5b but broke it again in Ie8d8106. Let's
finally add a test for this edge-case.
Change-Id: I9a43518f9edf0fab05e76bbb02a30fefd039b77d
It appears like these methods are called hundreds of thousands of
times. This is mostly because they are recursive. According to my
benchmarks the changes proposed in this patch make a big difference.
Some notes:
* I try to avoid stepping deeper into the recursion whenever possible,
i.e. do the recursion only when the current element is an array.
This is relevant because the function call overhead is surpsiringly
expensive in PHP.
* I tried to arrange the if-elseif-else branches in a way so that the
most minimal code is executed while the code is still readable.
Change-Id: Ie8d8106390cac441cb93adcd48a937ba312a2d91
Some notes:
* Note that array_column() strips array keys. I checked and this is
fine here.
* Html::element() will skip attributes that are set to null or false.
Perfect fit here.
* I routinely remove comments that do notjing but repeat what the
code already says.
Change-Id: Ie7797b78f1af5d8404c9e97b333fac8c6b3ac85e
Note: I'm not sure if this code is copied from somewhere else. If it
is this change is better done in the source.
Change-Id: Ic84be9b8b52a190eb5a41f2c7ff8fd6c04724318
Personally I find them confusing because there is apparently no way
to "stop" an array_walk(), and that's why it constantly needs to
check if it even needs to run. Why not use a syntax we can actually
stop? I find this more readable and it makes the code actually run
faster. On average 50% of the iterations get skipped now.
Change-Id: I47b6d5b8f4ad5c9d0f47b389c638196e734809bb
We can now serve the JSON data almost directly (although, curiously,
we need a main file in the module that is JavaScript, not JSON),
and without using global state in the JS code.
Change-Id: I203b3e396b28f4b4ef49c3c0918a4025082308c4
Removes functionality to
* select PNG rendering mode
* automated fallback to PNG images for SVG rendering
* PNG mode related class and tests
However, PNG images received from mathoid / restbase are still stored.
Bug: T311620
Change-Id: I595926027433182cc0396570bc3f1ce0cd2cafb3
Needed for I869af06896b9757af18488b916211c5a41a8c563, where I am
trying to change LanguageFactory in MediaWiki core not to use
MWException.
I truly feel mocked after working with this code. See if you can find
the two lines in this diff where the meaningful changes are.
Change-Id: Ifcb31dbb7113ce57526f06558cde2abedee317d7
TexUtil gets instanciated and loads a json for each node in Literal and Fun1. This is not necessary since it takes much RAM and time to load the corresponding JSON from files.
Bug: T321599
Change-Id: I91855ebc4437f075302ae13d367ca4902cc0f3ba