Commit Graph

48 Commits

Author SHA1 Message Date
Reedy 672df7dcc8 Fix file permissions
Bug: 71941
Change-Id: I7b0eddc0ca679cf233ef29dcdfeca024ecc71d38
2014-10-15 12:16:20 +00:00
Frédéric Wang 3d0b787cbe Move vertical-align back to ext.math.css
This improves If8ee1cf6453257a0a2f6aa186d4007954a8e5d8e

Change-Id: I794b39a5d322a92d9f722ded790e213803448127
2014-10-12 18:22:06 +00:00
C. Scott Ananian 7914fbea61 MathCoverageTest: encode test file using JSON instead of PHP serialize.
This ensures that changes to the test inputs or outputs yield readable
diffs when reviewing.

Change-Id: I7b4ef8102ad7fbf7c289a27db60f304a140b93a5
2014-10-12 18:02:50 +00:00
Frédéric Wang 61a3d9c719 Merge "Revert "Disable failing latexml integration tests"" 2014-10-11 17:20:00 +00:00
Physikerwelt 2a20654ab9 Revert "Disable failing latexml integration tests"
This reverts commit 4c544f002b.

Change-Id: Ifafb5782e10e80240a282beb449ab069ad93c37f
2014-10-11 19:17:29 +02:00
physikerwelt (Moritz Schubotz) ccc4114812 Fine grained options for wgMathDisableTeXFilter
Add new option to filter only new input.
Now the complete list of possible settings is:
MW_MATH_CHECK_ALWAYS  backwards compatible to false
MW_MATH_CHECK_NEVER   backwards compatible to true
MW_MATH_CHECK_NEW     new option

Change-Id: I455b41c8b8d918f4c34f6c115194d227a8394e0a
2014-10-10 18:27:04 +00:00
Gabriel Wicke 4c544f002b Disable failing latexml integration tests
Change-Id: Ib0ea79155f87f036464756b3d303048f8df84897
2014-10-08 17:45:24 -07:00
physikerwelt 21c89c22b1 tests: Add missing parent::tearDown() call
Follows-up 6a0af8f3b4.

Change-Id: I9418205479053c4129b6a9b888e38150799edcc5
2014-09-16 00:50:30 +00:00
Cmcmahon c31fe814be QA: update to fix deprecated API token call
Change-Id: I8654964a86c1154a6c7b14fc46235da5738a0985
2014-08-27 16:28:40 +00:00
addshore a47620df7e Use public instead of var in classes
Change-Id: Id7d5c9e609e20d7b1d5ef68101770f57d6f183c6
2014-08-17 22:09:06 +01:00
Max Semenik 130c3f44f1 @group Math where it's missing
Change-Id: If8ec86c4b70d7d78d30cab6f9529af1cd0c2ea52
2014-07-25 15:09:30 -07:00
physikerwelt f2dff6574b Fix: id-attribute
Id attribute was read wrong place

Change-Id: I6f2671a322f637a1d8e0c88833ce4456d188829b
2014-07-25 17:18:45 +00:00
physikerwelt (Moritz Schubotz) 5e2c1c5101 Displaystyle in Mathoid 0.2.5
Beginning from mathoid 0.2.5 displaystyle is the default
option. This property has to be removed as default.

Change-Id: I3c176f4227f32709f6db4014e1e3b435c3c853c4
2014-07-20 00:00:43 +00:00
physikerwelt 147ffa2307 Fix broken unit tests
Unit tests fail because the inner structure of the
SVG image that is gernerated by the Mathoid server
has changed.

Change-Id: I49d3116ee36b0a7a776df75656706d54bf04e961
2014-07-19 21:21:17 +00:00
jenkins-bot 4eebc40812 Merge "Fix MathDatabaseTest" 2014-07-11 01:37:18 +00:00
physikerwelt (Moritz Schubotz) cac44883d3 Fix MathDatabaseTest
The test used an unnecessary call to
setupTestDB. This might have caused
that the unittest_math table was deleted
twice during the setup routine of the
unittest.

Bug: 67148
Change-Id: I4a414900c1c2d97b759ef1755e53e82c5c2e8e14
2014-06-30 10:52:03 +00:00
Cmcmahon 94ded6c7b9 Port browser test for Math extension from the /qa/browsertest repo
From an earlier discussion with physikerwelt.

This is one step toward retiring the /qa/browsertest repo
entirely.

Change-Id: I804f32d2a5a984c8eb0dfc50c8ab50a7f1035256
2014-06-27 22:31:56 +00:00
physikerwelt (Moritz Schubotz) cbbf5453d1 Enable MathML rendering mode
This change allows to registered users
to test the new MathML rendering mode.
Invalid settings for math rendering mode
will default to MathMathML.

Change-Id: I75f24cb762609d6728247e3758fcc18f2ebfc6e6
2014-06-11 13:21:34 +02:00
physikerwelt 65642489ae Separate render and getHtml
Currently the method render always returns
a html string that can be a string that
represents the correct result or a rendered
error message.
This change splits rendering and
fetching of the HTML output.
This simplifies the logic of the rendering
and caching mechanism.
Now the render method returns a boolean that
indicates if the rendering was sucessful or
not.

Step 2/2

Warning: Errors in this change might affect
caching logic and squid caches.

Change-Id: I00502b84212ed70cdf63bd69916a35afbd6fdbc1
2014-06-09 23:21:44 +02:00
physikerwelt c390f6479a Add getHtmlOutput method
Currently the method render always returns
a html string that can be a string that
represents the correct result or a rendered
error message.
This change adds a mechanism that allows
to fetch the HTML output.
In a followup commit the rendering function
is changed to return a boolean value rather
than the rendering result.
This will simplify the error handling and caching.

Change-Id: I80760493e391911c41eb69d75a93c6a34db8852e
2014-06-06 21:52:35 +02:00
physikerwelt (Moritz Schubotz) 52656990b4 MathMathML
The LaTeXML class contains some code that is
not specific to LaTeXML but to MathML.
This code can be shared between LaTeXML and Mathoid.
This change introduces a new class called MathMathML
and moves the shared code from the LaTeXML class to this
new class.

Bug: 65973
Change-Id: I50517ba83f9a0d2aa8e237f062f18e4319ddbac8
2014-06-05 09:06:33 +00:00
physikerwelt (Moritz Schubotz) c7197bee19 Add separate database table for LaTeXML (step 5)
Currently the PNG and the LaTeXML rendering mode
use a common table in the database. If both rendering
modes are allowed in a wiki simultaneously this causes
problems, because the fields are continuously overwritten.

This is patch changes the logic of the rendering
engine to use the specific database.
The caching logic is now simpler to understand.
A entry is written to the database if the changed field
of the MathRenderer class is true. Is is triggered by the
setters of the database relevant fields.


Bug: 65522
Change-Id: Ief9de889b9292b21c9d1529a8b1797f38196edad
2014-05-31 10:34:21 +00:00
physikerwelt bf33d51320 Add separate database table for LaTeXML (step 3)
Currently the PNG and the LaTeXML rendering mode
use a common table in the database. If both rendering
modes are allowed in a wiki simultaneously this causes
problems, because the fields are continuously overwritten.

This change adds the method getMathTableName that will
allow renderers to access their specific table in the
database.

Change-Id: I8b11ffd0a39fadd7d3c8de1e94e74ff5f490430d
2014-05-27 05:33:20 +00:00
physikerwelt 972cee0f98 Add separate database table for LaTeXML (step 2)
Currently the PNG and the LaTeXML rendering mode
use a common table in the database. If both rendering
modes are allowed in a wiki simultaneously this causes
problems, because the fields are continuously overwritten.

This change creates the new database table defined in step 1.

Bug: 65522
Change-Id: I5f125d36b83776ca6f75ff014dc9095d0a737a35
2014-05-21 17:23:42 +00:00
Moritz Schubotz (Physikerwelt) 3a36b25ee3 Fix: Allow <div /> as valid Math output
Some simple math tags such as the rendering result of
$\mathcal{ABC}$
are converted to an HTML-div tag by LaTeXML if inline-mode
is used. This change
* makes the $wgMathDefaultLaTeXMLSetting easier to read
* improves the XML validation of the LaTeXML output.

Change-Id: I807dbfa3a45930deec8eb5615133be9a39f3f101
2014-04-08 16:13:28 +00:00
Moritz Schubotz (Physikerwelt) 58f913ecb0 $wgMathValidModes and orthogonal MathJax enabler
To adjust the selectable math rendering modes in user preferences $wgMathValidModes
is introduced.

* $wgUseLaTeXML becomes unnecessary use $wgMathValidModes[] = MW_MATH_LATEXML;
  to enable the LaTeXML rendering mode
* add $wgMathValidModes[] = MW_MATH_MATHJAX; to enable MathJax

Currently, MathJax is bound to the MW_MATH_SOURCE rendering mode.
This change makes the base mode user configurable.
That means before MathJax is loaded the png fallback image could
be displayed.

ATTENTION: This change modifies global variables as follows:
* MW_MATH_MATHJAX is deprecated.

Bug: 57981
Change-Id: Ibf705cb66754d04e4c7eafd1e98608b25d7dbb94
2014-04-08 15:29:42 +00:00
Moritz Schubotz (Physikerwelt) c5b0b15d8f Fix MathJax centers equations
* Removes the MathJax heuristics that decides
  if equations are centered or left-aligned.
* Introduces the attribute display to specify
  if the math element is rendered in inline,
  display, or inline-displaystyle.
* add css rules for display / inline math images

Bug: 61051
Change-Id: Iba69903f781f0cb1606b8ddcffb90fb86c9b229b
2014-04-06 21:58:30 +00:00
Moritz Schubotz (Physikerwelt) 0b6ed3ce2f Improvement of LaTeXML integration tests
* use setMwGlobals to set the globals

Change-Id: I253c75f93fe6fa098b1b6f462129148782db2fa7
2014-03-20 15:51:00 +00:00
addshore 80bf30ca45 Split up some long lines in tests
Change-Id: I45be8ea1b9a9a974614354c0199e3107a5cdc23e
2014-03-11 23:32:33 +00:00
physikerwelt 94b035b26a Coverage tests for the Math extension
* Include generated tests for a better test coverage
of the Math extension.
* Compiles texvc in testsuite (if required)
* Test generator now included
* Replaces the old parser tests
* Fixes whitspace issues

Bug: 61090
Change-Id: Iff7eeb5ee72137492c3f6659e4d4d106e5715586
2014-03-11 15:35:07 +00:00
Antoine Musso 28e6a1a751 Compile texvccheck in testsuite
The MathInputCheckTexvcTest class expects texvccheck to be available
via $wgMathTexvcCheckExecutable.  It is not always set or the executable
might not have been compiled (for example on Wikimedia CI Jenkins).

This patch still attempt to use $wgMathTexvcCheckExecutable, if it is
not found it will attempt to compile it using the Makefile in the
texvccheck subfolder of the repository.  That should work whenever
someone has ocaml installed, the resulting binary is used to set
$wgMathTexvcCheckExecutable.

Bug: 61090
Change-Id: I9ea4b87de6e2827aad83961712f66ecbef2639de
2014-02-20 08:00:16 +00:00
physikerwelt dd4f911d87 Rename some global variables that violate the naming convention
* $wg(.*) variables from extension should start with the extension name
    i.e. for extension Math $wgMath(.*)
* But keep $wgUseMathJax, because it has been used for 2 years now.
* Add release notes

Change-Id: Ib70a9f7767890cc4618bc10c2610784f5b17e670
2014-02-01 11:56:07 +00:00
physikerwelt 6a0af8f3b4 Validate TeX input for all renderers, not just texvc
The user input specified in the math tag a. la
<math>E=m <script>alert('attacked')</script>^2 </math>
is verified in PNG rendering mode, but not in plaintext, MathJax
or LaTeXML rendering mode. This is a potential security issue.

Furthermore, the texvc specific commands such as $\reals$
that is expanded to $\mathbb{R}$ might be rendered differently
depended on the rendering mode.

Therefore, the security checking and rewriting portion of texvc
have been extracted from the texvc source
(see I1650e6ec2ccefff6335fbc36bbe8ca8f59db0faa) and are
now available as a separate executable (texvccheck).

This commit will now enable this enhancement in security and
provide even more compatibility among the different rendering
modes.

Bug: 49169
Change-Id: Ida24b6bf339508753bed40d2e218c4a5b7fe7d0c
2014-01-22 10:07:27 +00:00
physikerwelt abba28949c Fix LaTeXML integration test
The XML attributes in LaTeXML are ordered alphabetically now.

Bug: 60279
Change-Id: Iba810f71a151fa2ae56140557cc902fe1f8c1062
2014-01-21 08:17:49 +00:00
physikerwelt (Moritz Schubotz) 12b43489ea Expose LaTeXML Settings
Make LaTeXML setting configurable with the new global
variable $wgDefaultLaTeXMLSetting.

PS: This variable can be specified as an array or a
string. If specified as an array, the
 array('a'=>'b','c'=>array('e','f'))
would be transformed to the equivalent setting
 a=b&c=e&c=f
,which is the input format for the LaTeXML daemon.

Change-Id: I2869df27cee83b426c6eb2312306fac9d6203ef2
2013-09-20 17:20:03 +00:00
physikerwelt 48461d0fca Check if media wiki core is capable of xml type checking
* new test for XML type checking function
* check if StrigUtils::isUtf8 exists in core (Thanks to Deyan Ginev for the hint.)

Bug: 50884
Change-Id: I86af95cbecc4b5c9c33fcd3a66a7fb2ccdde0194
2013-07-18 20:49:09 +00:00
physikerwelt 90d678782f Fix: PHP Style corrections
* Explicit function visibility
* Uniform constant definition

Change-Id: I5f064d2eac0dedd4c8cc94f442c65f0e338ebbf4
2013-06-07 15:37:56 +00:00
physikerwelt (Moritz Schubotz) ffdd0f6c87 Fix: Added details to error message
The detailed information about the error messeage provided by the MW
HTTP libraries has not been passed to the end-user output.

Change-Id: I9cac67d8fc3a732a87c14e922670253e82f64bbb
2013-05-26 23:02:10 +00:00
physikerwelt 927340d345 New rendering option LaTeXML
Introduces a new rending option to render TeX to MathML
via LaTeXML.

Bug: 43222
Change-Id: I5d29e219c0d3b907e22ea0bb3b30f000d8a7a9f8
2013-05-26 12:12:51 +00:00
Matthew Flaschen 32e2f4d4f5 Use i18n params for errors than appending raw string, with test
* Remove parameters/append that are never outputted by texvc.ml
* Add missing math_output_error to i18n file
* Improve a few qqq descriptions

Change-Id: Iea5139682fbe8389e578549f5f62e5505f4c0b48
2013-05-18 01:48:16 -04:00
physikerwelt 10aea50551 rename MathSourceTest::simpleTest->MathSourceTest::testBasics
Test was not executed, because it did not start with 'test'.

Change-Id: Ie5e14b0a23da6a908781f9a2f17dcd6c7795bebe
2013-05-04 10:43:14 +00:00
physikerwelt 5245d0f555 Introduce getter and setter for the MathRenderer
Adds a new method isChanged() for determining if a value was changed.
This is done in preparation for a more elaborated caching method that is
handled inside the abstract base class.

Change-Id: Ica15f77d96453d30edd3a117c7185c694ad3691e
2013-05-03 21:12:36 +00:00
Antoine Musso eaed42d8e4 tests: skip math table creation for SQLite DB
SQLite has global indices, not per table one.  When using the database
updater to create the `unitest_math` table, we would get an error
with a duplicate `math_inputhash` index which is created by the the
database installer.

This patch skips the testBasicCreateTable() test on sqlite.

Change-Id: I6da56d67d7af45f86cf6163cf73f5464505b43f3
2013-04-26 14:17:03 +02:00
physikerwelt 08b93eebd6 renaming of read and write methods for database access
readFromBB->readFromDatabase
writeDBEntry->writeToDatabase

Change-Id: I426be5dc479ad789d0e85b149a989a581945c9be
2013-04-24 06:03:37 +00:00
Physikerwelt 10662ea6e3 rename tests/MathRenderTest.php
Rename according to base class that we test.

Change-Id: I8b8969fa3f6b8b5d78ac9b5308db2ba2b4181226
2013-04-17 20:08:37 +00:00
physikerwelt c22f628a68 additional phpUnitTests
adds two new phpUnitTests for the abstract MathRender class
and another one that test the basic database access.
Therefore the read and write methods have been made changed
from protected to public.

Change-Id: I77a8b0a4dfe7529b5521ead097ac7b518688ef70
2013-04-07 20:21:35 +02:00
Ori Livneh 7831957091 Add unit tests, demonstrating how to stub out deps.
Physikerwelt asked for some guidance on how to write good unit tests for
classes that depend on external resources. I wrote a few to serve as examples
for additional tests. Because they have an ulterior didactic purpose, the
comments are a bit more verbose than I would otherwise like, but despite that
the tests are good enough to merit being merged.

Change-Id: Ifa97eec1a68fb68b4744d1e5b192b410afe5ef68
2013-02-17 20:55:47 -08:00
Moritz Schubortz c869831f45 Add and register PHP unit tests for MathSource class
This change adds test cases for the MathSource class and registers a
hook for loading these tests. Also adds documentation about how to run
these tests in README.

Change-Id: Ie58a273326e0353dfa4437b3de21a2393adb5a87
2013-02-17 20:23:50 +00:00