Enable popup extension for annotated math expressions. The popup shows a short summary of the formula and is generated via the Popup API introduced with I65fcbf25ac5818f6c649daf494c719921247e8f5. It is a follow up of Iefe98c1f0422dbf034e385b1a41a859d030a2cf4.
Bug: T208758
Change-Id: I8c45b7e441083c240bbf2e0217ec219df7dcc351
I compared with
6c6988c4f6/lib/astutil.js
and found two mistakes:
* Missing space at the end of the color regex.
* Not enough backslash escaping in the last regex.
Note how the code in lines #116 and #130 is now identical.
Change-Id: I13b75ad4a1e4da0766c0d73b8786b21865945697
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