Commit graph

390 commits

Author SHA1 Message Date
Derk-Jan Hartman 6d99438a7c MathJax: Add a renderTex hook to render elements on demand
Example usage: $('#wikiPreview').renderTex();

This supersedes: https://gerrit.wikimedia.org/r/23073
Bug: 35478

Change-Id: I18e2f089d56e42b8e603ac45d726942bb478580b
2013-04-27 19:20:39 +00:00
jenkins-bot 691d1b3186 Merge "(bug 35188) Do not poison the tex formula with markup" 2013-04-27 19:19:47 +00:00
jenkins-bot 0313f73814 Merge "MathJax: Allow user to configure MathJax" 2013-04-27 19:11:47 +00:00
nageh b08fbbbe38 (bug 35188) Do not poison the tex formula with markup
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
2013-04-27 14:41:32 +00:00
physikerwelt 5616ea01a3 Remove even more unused variables
* $inputhash is also never used.
* Additional comments.
* allow creation of math renderer without $tex code

Change-Id: I64c181408e8acd16aee7a53a81a176b62a6726b5
2013-04-27 14:34:57 +00:00
TheDJ 1a627916c1 Merge "remove unused code" 2013-04-27 14:32:48 +00:00
Derk-Jan Hartman 32acbe3f47 MathJax: Allow user to configure MathJax
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
2013-04-27 16:27:15 +02:00
jenkins-bot 8afccbe888 Merge "(bug 36855) escape literal % in tex input" 2013-04-27 14:10:31 +00:00
jenkins-bot da02740c14 Merge "(bug 35556) Allow MathJax to report errors." 2013-04-27 14:07:19 +00:00
physikerwelt b6faed7363 remove unused code
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
2013-04-26 14:17:37 +00:00
Antoine Musso 84d531cca0 debug log was attempting to show a Blob object
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
2013-04-26 12:40:03 +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 4822324c61 Merge "additional phpUnitTests" 2013-04-11 16:26:36 +00:00
Translation updater bot 1376c7a033 Localisation updates from http://translatewiki.net.
Change-Id: I6fc4ca9b56c8dd53983e59f8ff62ed258a263caf
2013-04-07 20:53:47 +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
Translation updater bot 0ede088c83 Localisation updates from http://translatewiki.net.
Change-Id: Icf520f109f9bfb0a8ccb257fded7b9abcb488177
2013-04-04 20:00:42 +00:00
Translation updater bot 4b4f8c2144 Localisation updates from http://translatewiki.net.
Change-Id: Ie1097f574b5a4386874f331802adf2eb04b7dcad
2013-04-02 19:05:21 +00:00
Translation updater bot 27796cf005 Localisation updates from http://translatewiki.net.
Change-Id: I215a0b3ebd8518f88aac1105c171771dff72560d
2013-03-26 21:15:49 +00:00
Translation updater bot 4f9701cf8f Localisation updates from http://translatewiki.net.
Change-Id: Ib2ca7bddd5820e3d2694c754900992c518ddaa2c
2013-03-25 19:59:15 +00:00
Liangent 20192a1ab8 Do proper pre-pack processing for $this->hash.
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
2013-03-13 21:56:53 +08:00
Matthew Flaschen aa8a0eaf19 Write cache unless there *is* a cache hit:
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
2013-03-12 00:38:45 -04:00
Matthew Flaschen 3916ac167c Revert "(Bug 45973) Fix check for avoiding re-cache"
Revert unreviewed self-merge with pending issues.

This reverts commit f5422cf85a.

Change-Id: I17471e2adccf54b79a9d8185c4a6f4b6937ce622
2013-03-12 00:24:43 -04:00
Ori Livneh f5422cf85a (Bug 45973) Fix check for avoiding re-cache
If the request could not be served from the cache, we *do* want to cache it.

Change-Id: Id58dac55ce79f568e4b4a42a155235af5a46bf7f
2013-03-12 04:16:21 +00:00
Translation updater bot 20af9faba6 Localisation updates from http://translatewiki.net.
Change-Id: I8a8017dd81d6afbe4b160d380843973e0139834f
2013-02-24 20:39:47 +00:00
Translation updater bot 9320742fce Localisation updates from http://translatewiki.net.
Change-Id: I209506266dfee0d80e213c1542130e6b81e00399
2013-02-22 20:12:04 +00:00
Ori Livneh 9ba4ef269d Only update the cache on cache miss
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
2013-02-21 17:39:17 -08: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
Daniel Friesen 48b029fbe9 Fix MathRenderer::renderMath.
The call to getRenderer is supposed to be a static method in the same class,
not a global function.

Change-Id: I5d101574b1d67238c6357e154209f2595cb36859
2013-02-17 10:32:09 +01:00
Matthew Flaschen 8a04254e6d Change default LockManager back to nullLockManager.
* This was changed in 926db7c3bd as a workaround for a testing issue.
* See 8cbd679aac781bdd73038064261736a937645fc1 , which fixes the test harness in core .

Change-Id: Ib57cafee35a699ce875ee4bc8951781e1a37553a
2013-02-08 13:59:26 -05:00
Physikerwelt 926db7c3bd Restructuring Math classes
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
2013-02-07 20:35:45 -08:00
Timo Tijhof c14159404f JSHint: Equality, unused arguments and other minor remnants.
After this jshint passes.

Change-Id: Iee640a1d485ac23caaa783b0069ce9f1616db9ad
2013-02-06 20:20:14 -08:00
Timo Tijhof 282960c4ba JSHint: Fix var statement and global scope issues.
Change-Id: Ia567d10b72f86963eb344cd5579738532531d3d9
2013-02-06 20:14:02 -08:00
Timo Tijhof 8a29221a83 JSHint: Fix curly braces.
Change-Id: Ib59ab38b2c3d9270d882798242e796b823206a50
2013-02-06 20:08:22 -08:00
Antoine Musso ca6a896cb0 JSHint: Fix quotmark and semicolon warnings.
Change-Id: I2ab9e7ce308fd47336f86d2571e8450347321f10
2013-02-06 20:02:47 -08:00
jenkins-bot 33c30a0d6c Merge "JSHint: Add .jshintrc" 2013-02-07 03:54:57 +00:00
Antoine Musso b13ec348ac JSHint: Add .jshintrc
Based on settings from MediaWiki core.

Change-Id: I71345f6906d430fcca750c995a689f785831e3f8
2013-02-06 19:54:07 -08:00
Translation updater bot a10ba58bc8 Localisation updates from http://translatewiki.net.
Change-Id: I47597423a9fd654cf999e7b9e7db29eb2ce7d21a
2013-01-29 21:02:36 +00:00
Translation updater bot 394275be20 Localisation updates from http://translatewiki.net.
Change-Id: I43d0cf6b012936f76379b87cd2834255e6394d19
2013-01-27 18:53:37 +00:00
Translation updater bot f9de81a9da Localisation updates from http://translatewiki.net.
Change-Id: Idb8014be033c9cf376ae8cec3c2fc0ad1878867f
2013-01-27 17:48:22 +00:00
Translation updater bot 3044599afe Localisation updates from http://translatewiki.net.
Change-Id: Ie9a3d11ff06a6852fb0f560de0a04c401a576c26
2013-01-22 20:50:00 +00:00
Antoine Musso b029a4037e JSHint: ignore modules/MathJax
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
2013-01-18 12:22:28 +01:00
Translation updater bot 766d548df9 Localisation updates from http://translatewiki.net.
Change-Id: Ic1a1c5e39aafb630c5d2d2478e39e869a3a7fc9b
2013-01-06 20:12:18 +00:00
Ori.livneh 33ee76cdae Merge "Rename Math.body to MathRenderer to be consistent with the class name. Reson: Further classes will be added in the next step." 2013-01-02 04:25:39 +00:00
Translation updater bot 3318be4b31 Localisation updates from http://translatewiki.net.
Change-Id: I97a3f906e57f5a06ff20040d197148c3d25daee7
2013-01-01 20:24:00 +00:00
physikerwelt 7ff47f898f Rename Math.body to MathRenderer to be consistent with the class name.
Reson: Further classes will be added in the next step.

Change-Id: I9dba8c1fca11cbc51fa11edebabde4687d17e312
2013-01-01 17:16:35 +01:00
Translation updater bot 075abb7b1e Localisation updates from http://translatewiki.net.
Change-Id: I67f28a8026b7b9844ad1b3b39dafaa0f97f54419
2012-12-27 21:23:09 +00:00
Translation updater bot 02f89f6ac0 Localisation updates from http://translatewiki.net.
Change-Id: I76b50906fafff8511ba070b8c14e502aacbe8be6
2012-12-09 20:27:54 +00:00