Example usage: $('#wikiPreview').renderTex();
This supersedes: https://gerrit.wikimedia.org/r/23073
Bug: 35478
Change-Id: I18e2f089d56e42b8e603ac45d726942bb478580b
We move the block/inline styling (aka display vs textstyle) markup into
a filter used just before rendering. This way the 'used' formula will
not suddenly contain styling information that wasn't part of the
original formula.
Change-Id: Ie0c308c31d38581e556dc73109879c7a3d365121
* $inputhash is also never used.
* Additional comments.
* allow creation of math renderer without $tex code
Change-Id: I64c181408e8acd16aee7a53a81a176b62a6726b5
The user can provide his own mathJax.config object.
Supersedes: https://gerrit.wikimedia.org/r/61182
PS2: Add relevant info for this feature to README
Bug: 35478
Change-Id: I97800317366aafcaad87ecf6644e9417c698c5da
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
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
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
Moves writeCache call back to hooks (changed in 9ba4ef269d)
and makes it unconditional, so only one part of the code decides
whether to write to the cache.
Bug: 45973
Change-Id: I6b387795304ff15c960fcf0f5354a9ac939e1212
Change I9b1d68c4faa8d177d8d0088fa1a5879caed4f1fe added an indiscriminant call
to writeCache(). I assume that it was supposed to be regulated by the check for
$this->isRecall() (which is a getter for '$this->recall'), but there was no
concomitant change to ensure that recall is set true on cache hits.
My fix does not set recall to true. The style of "pass-by-attribute" is tricky
and should be factored out by a subsequent change. This change moves the call
to writeCache() so that it is only called on cache miss.
Change-Id: I9b690e55001859c97fd40330272791d49ec6de75
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
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
The call to getRenderer is supposed to be a static method in the same class,
not a global function.
Change-Id: I5d101574b1d67238c6357e154209f2595cb36859
* This was changed in 926db7c3bd as a workaround for a testing issue.
* See 8cbd679aac781bdd73038064261736a937645fc1 , which fixes the test harness in core .
Change-Id: Ib57cafee35a699ce875ee4bc8951781e1a37553a
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
modules/MathJax is a third party library, we do not want to report
JSHint errors for it. Any errors there should be committed upstream.
Change-Id: I48a73eacb635149141e554853bf4aef65ecdcd49