Previously, the 'action=purge' parameter could not be
accessed by the math extension, since 'action=purge' caused a reload
of the page, even before the math extension was called. However,
before MediaWiki 1.29.+ additional GET request parameter were
forwarded to the next page and could be evaluated by the math
extension. Thus, an additional parameter 'mathpurge=true' was added
to re-render formulae. However, it seems that this additional GET
parameter is no longer being forwarded.
This change reads the refer header to check if 'action=purge' was
passed. This makes the mathpurge parameter obsolete.
Bug: T74537
Change-Id: Ia09c039de3a7232a28bfdd5a97daf1029e5d7c40
When the user specifies the mathpurge=true query parameter, the Math
extension needs to prompt RESTBase to regenerate the renders for all
formulae on the page and consequently issue Varnish purge requests. This
behaviour is achieved by including the `Cache-Control: no-cache` header
when requesting a render. Since RESTBase regenerates all of the renders
when it receives the header, send it only for the first content request;
if subsequent content requests are made, RESTBase will already have the
new renders.
Bug: T136205
Change-Id: I44482ccc1d8afdf6d40dcf8965d8debe83ef7e17
This change reduces the number of Restbase requests to two
by bundling all requests for MathML
Bug: T132096
Change-Id: Idfc29eeeca754738fe78ca0372e6b6725065528d
* Add support for LaTeX package mhchem.
* Add hook <ce>
* Add format <math chem>
See bug description for the details.
Bug: T98306
Change-Id: I2ab80834edc5d071618bc52f133cfb2b7ece5016
Currently two post request and one get request is sent
for each formula.
This change gets rid of the second post request.
Change-Id: I805a2c0fa619c9143c38a0cc60e76c9480578ed3
Most info-level log entries are actually debug messages, which should
not end up in the production log by default, so adjust them.
Only the Mathoid-powered TeX check fail has been promoted to info so
that we can quickly identify such requests from pages.
Bug: T121445
Change-Id: I3736c59f6425d675befea9438182ee1cdebe5fc5
* Do not contact RESTbase in texvc rendering mode and
use the well established tex checking that is already build
into texvc.
* Do not use RESTbase in LaTeXML mode.
Background:
In I1982612e8c6a356e3dbdf447724ac82e5968cc77 RESTbased replaced
texvccheck that was a derivate of texvc designed for people
that wanted to use secure MathML rendering using mathoid.
The integration of mathoid to restbase made this feature obsolete.
However, texvccheck was not only used to check the latex input
that was sent to mathoid, but also the string which was sent to texvc.
Since texvc has already build in tex checking this is not
required and does not improve security.
Finally, users updating from old versions of the math extension
(prior to 2014) that do not have textexvccheck installed,
do not need to compile the texvccheck binary after this change.
PS5: Also treats the case where VisualEditor is not installed.
Bug: T121173
Change-Id: I1bd076b09206869b5ed75280d22e1b36bfb8d8ad
* This will increase the performance of tex rendering for all
rendering modes since no shell access is required anymore.
Merge with caution. If the connection to restbase fails, rendering
of new formulae will be completely disabled i.e. broken.
Change-Id: I1982612e8c6a356e3dbdf447724ac82e5968cc77
Tex validation should be skipped if checking is disabled.
Consequently if 'disable tex filter' is set to 'never' it's a double
negation and tex should always be checked.
If 'disable tex filter' is set to always, never check tex.
Change-Id: Ic6fda8016838eae03a0ed36e3d8d4f35423ba8b1
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