Redo Ibf6bdbd4ea36b4905445d5878f32f7e0b2bc8bac, which was
reverted by I029328849f05ec2afcabf38d2b79b337cb54cbd5.
In addition this patch simplifies the tex sent to the mathoid
server. Instead of {\displaystyle {\textstyle ... } } only
{\textstyle is sent (which overwrites \displaystyle anyway).
Change-Id: I16d6f67215c2f85ecd1d3a0bddacfc1700681557
* LaTeXML has a feature to add automatic line breaks
* This change adds a new integration test
* Sets a default line length of 90
* add the additional display attribute 'linebreak' which
can be used to enable the feature
* mathoid support for line breaks will follow shortly
Bug: T106423
Change-Id: I029328849f05ec2afcabf38d2b79b337cb54cbd5
In I6d1094ece79e912d9ddbef6681a25196c7a6e801 math styles
were renamed from integer constants to string constants.
Before NULL corresponded to inlineDisplaystyle. This is
no longer the case so NULL has to be replaced by the actual
default value.
Change-Id: Ibf6bdbd4ea36b4905445d5878f32f7e0b2bc8bac
* Use string constants instead of integers
* Derive new names from old via conversion of constant
naming convention to CamelCase.
* Replace old constant string e.g. 'MW_MATH_ABC_DEF'
with new string 'abcDef'
* Replace old constant value with new string.
* Tests to demonstrates what is actually done.
* Rename constants
Bug: T106630
Bug: T106631
Bug: T87941
Change-Id: I6d1094ece79e912d9ddbef6681a25196c7a6e801
* MathDebug was intended to provide advanced debugging functionality
for the math extension. However, the interesting debugging and
logging feature never made it from the debug branch to the master.
* The current debug functionality is mostly useless. Only some values
are written to memory and never used thereafter.
* This change moves the existing functionality to the MathSearch
extension and introduced the required hook for that.
Details:
* $wgMathDebug is removed
* A new Hook MathRenderingResultRetrieved is created
* The math rendering object is printed to the svg error
page if wgDebugComments is active (instead of wgMathDebug)
Change-Id: I6fad69b5d9b9ca8a7d12c7e410d3ae6180fbddbf
- We don't localize errors and debug logs like this, it makes them
impossible to decipher
- Also remove some 1.21 and below back-compat while we're here
Change-Id: Idb23fe5b434fa9fa3518672d57ec6e5466d005ac
MathMathML::renderingRequired called the getSvg
function in MathLaTeXML that caused an automatic
rerendering of the SVG image if it was not cached.
That this rendering is triggered from the function
renderingRequired is contra intutive and should be
avoided.
Change-Id: Ifa14f50193a05b3058624a18974c56897fcec09e
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
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
* id: Allows to name equations
and deep link to equations
* forcemathmode: Allows to override the user defined rendering mode.
This feature is useful for help pages and discussions about rendering.
* type: support for MathML and asciimath input
required for MediaWiki instances that want to
incorporate MathML sources like for instance pubmed
Change-Id: I615c7f1a5762e9e662937b70953fb873309d4c07
Adds a new constructor that allows
to create a new instance of the MathRenderer
based on an inputhash.
This method is required for the Specialpage
and the MathSearch extension.
Change-Id: I618b0fa7dcfdf8a7c740991c19ae0d70e71f19ba
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
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
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
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.
In this change the MathRenderer class fields are updated
and new setters and getters are introduced.
Bug: 65522
Change-Id: I09ba07c5ed6b16d65cffe4da238d138a6cafd795
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
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
* 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
* 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
The output of texvccheck is not only "checked" but also
rewritten to another form.
(For example $\R$ is transformed to $\mathbb{R}$.)
But the output might not be a valid input for the thexvccheck
part of texvc, like it happened in for the example given in the bug
description.
See also I599c4390da9b8f36d800f379a33ad5ce90f5096c
Bug: 61012
Change-Id: Iae5e350cb78c0e637e574390c586fbdb8dc38496
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
Many things in MediaWiki (and various on-wiki templates, at least on
enwiki) output error messages wrapped in <strong class="error">. MathJax
parsing all of these (added in I1199cb34) is completely broken.
What appears to have been intended is that MathJax would parse the
errors output by MathRenderer.php. So let's add a "texerror" class to
those and have MathJax look for that class instead.
Bug: 55675
Change-Id: Iaa6c3a892af463f38e6706f9407c6dcb948fe670
- Remove MathMathJax.php, which uses exactly the same output as MathSource.php.
- Make wiki2jax able to handle texvc output as a preview before MathJax rendering.
Change-Id: I1199cb34d555d2a1e57da98857f41a22cfe81df4
* 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
* 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
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
* $inputhash is also never used.
* Additional comments.
* allow creation of math renderer without $tex code
Change-Id: I64c181408e8acd16aee7a53a81a176b62a6726b5
This code is never used and will not be used in the future.
Adressing the equation for search will be handled by the
MathSearch extension. There will be a hook function to label
the equations.
Change-Id: Ia2149460134b361fb44f8ad85660793b1951d988
A wfDebugLog() was attempting to concatenate a string with a Blob object
which does not support conversion to a string. Since that was used to
show some hash, display the current string hash instead.
Furthermore the input-hash, which can be calculated from the TeX input
string was displayed, which is not very helpful. The variable hash is
calculated by texvc and can be used to search for the rendered image in
the filesystem.
Change-Id: I9943fd51d3021bf2d62a29f33de0858803763f86
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
Output hash calcuation sometimes fails because of Texvc failure for
example, and $this->hash remains ''. At this time inserting null as
outputhash into database is improper, because that column is NOT NULL.
With this patch an empty string '' is inserted instead, and the if-check
is modified to avoid cases where ->hash exists but evaluates as null
(for example when it's '0000000000...' though it's extremely rare).
Change-Id: I852859f4b151b777c11b743faaed61dfc2c029a7
The call to getRenderer is supposed to be a static method in the same class,
not a global function.
Change-Id: I5d101574b1d67238c6357e154209f2595cb36859
The Math.body file which contains the MathRender class was split in the following way:
- Math.base contains the base class with the database related stuff and provides an abstract interface
- Math.source and Math.MathJax handle the plain tex string output. There are two classes since they
will differntiate in the future I think.
- Math.texvc contains the "old" implementation of png generation with all the file handling related stuff
- Other implementation of math renderer can be added in the same style.
- Cleanup to better follow coding conventions.
- Changed LockManager to 'fsLockManager'
The first attempt restructure the class layout and introduce LaTeXML at the same
time was dropped. Instead this was split up into two phases.
This commit only deals about the restructuring of the math module design.
Change-Id: I9b1d68c4faa8d177d8d0088fa1a5879caed4f1fe