Commit Graph

49 Commits

Author SHA1 Message Date
physikerwelt (Moritz Schubotz) 8bc23cafb4 SpecialPage for MathImages
Add new special page that displays
math images. (Either SVG- or PNG-Images)

Change-Id: I6065b474b8197232fcb4e79ae17bb08d9bef3ac4
2014-06-06 17:18:30 +02:00
jenkins-bot b71cedd915 Merge "Introduce variables required for mathoid" 2014-06-05 09:39:33 +00:00
physikerwelt (Moritz Schubotz) 1bb3bfa3b5 Introduce variables required for mathoid
This change prepares the reactivation of the
MathML rendering mode. It adds configuration
variables for
* the mathoid server url
* the mathoid server timeout
* the debug mode.

Change-Id: I8a2bb9076e571d7769787aac3e863f65637ce553
2014-06-05 09:36:01 +00: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 3b7ea6413c Change default value for $wgMathLaTeXMLUrl
new LaTeXML instance.
Sponsored by https://www.xsede.org/

Cherry-Pick from Id92ef141c7921a82528b3ba4384e026322499312

Change-Id: Idd1de9da348d473acc6cea8d2d1a855f1f6b07fa
2014-05-09 11:06:39 +02:00
James D. Forrester 60411b9a9f Convert VisualEditor Beta Feature to a normal (non-optional) plugin
Change-Id: I0dd1c85ad92d7e42654e23b6237b30f8f4dfe0fa
2014-04-29 13:34:40 -07:00
Moritz Schubotz (Physikerwelt) 75999d5aae Add default value for user option mathJax
Bug: 63915
Change-Id: I9aa0b1c9a3f09c412f14756ffd251957b7777a47
2014-04-21 09:30:13 +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
Frédéric Wang b9353836c5 Add mathchoice.js to the 'TeX' module
mathchoice.js is necessary for the \mod command. This patch includes it
in the TeX module, so that it is included by ResourceLoader.

Bug: 63621
Change-Id: I624358baee04d396207e87ab81b47718573ea3b3
2014-04-07 22:34:01 +00:00
Derk-Jan Hartman 23f94d5b6a Add dependency for math edit button
Declare that ext.math.editbutton.enabler depends on
mediawiki.action.edit.

Follow up to: I3d126c1c252c27fa65ab8fb42ffab66a2d99cfa8
Bug: 60471
Change-Id: Ibcda91bbb164b0b896d4c3f5f7c2c6ea6658468e
2014-04-07 13:15:02 +00:00
jenkins-bot ea48a4442f Merge "Editbutton for math" 2014-04-07 09:33:56 +00:00
Moritz Schubotz 9f7a1e51c4 Editbutton for math
Move the code that creates the Editbutton for math from core,
where it is removed in Ib17aa47c7d647e1ed293541adbdd1aa77e25e59e.

Imported button image from:
ssh://gerrit.wikimedia.org:29418/mediawiki/core.git/skins/common/button_math.png

We don't need to vary the icon per language, because there is not a
single language that has a non default icon.

Bug: 60471
Change-Id: I3d126c1c252c27fa65ab8fb42ffab66a2d99cfa8
2014-04-07 09:26:16 +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
Derk-Jan Hartman 24f2ed2c5e Add the TeX color extension back
The color and the cancel extension was not RL'ified in the update
to MathJax 2.3

Followup to: I9471b1baf41d2bcc4fdc64a26e7d806e92b9b17f
Bug: 63574

Change-Id: I816db6b66ef48a90e7424372783c69ffe8343957
2014-04-05 18:01:15 +02:00
Siebrand Mazeland 5cbbd0c807 Migrate to JSON i18n
Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php
with shim.

Change-Id: Ifcaf0e8516cd92587fc5e51a580a53f4158cdb6e
2014-03-28 11:06:06 +01:00
Roan Kattouw fcf045f832 Add VisualEditor support
Moved from the VisualEditor extension, where it was removed in Iab0c56246626de1e0f

Change-Id: I8e582ee6deadc2750d30b49f0c6de31ed9c16a50
2014-03-20 01:29:25 +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
physikerwelt dcc3f0fd3c Differentiate missing texvccheck from missing texvc
Introduce different error messages for missing texvccheck and
texvc and update the README file.

Bug: 61154
Change-Id: I52f796f181f6a3ab6d65a8e8d89f59d523d5b7b8
2014-02-12 01:38:01 +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 52d206c4b4 Remove call to deprecated ParserOptions::getMath
Since math has been moved from core to an extension
it should take care of the caching by its own.
Therefore, a call to the parserOptions::getMath is removed
and own caching logic is introduced, once getMath is removed
from core.

Bug: 14202
Change-Id: Ifa847b61264f8d640c9886fd374eb3d6cf482c0c
2014-01-29 09:10:05 +00:00
jenkins-bot 6d7fa3ef13 Merge "Remove $wgUseTeX" 2014-01-28 20:50:46 +00:00
Frédéric Wang 2c3e4a4b5d Update to MathJax 2.3
* Uses the MediaWiki resource modules to load MathJax

Change-Id: I9471b1baf41d2bcc4fdc64a26e7d806e92b9b17f
2014-01-27 21:36:02 +00:00
physikerwelt 636f96d3bb Remove $wgUseTeX
$wgUseTeX is not needed in the extension. For backwards compatibility,
it's also set in /mediawiki/includes/DefaultSettings.php and used in
/mediawiki/includes/EditPage.php only.

Change-Id: Ie5bcabf9e2e7474a4d41d1efcc5072c144640388
2014-01-26 00:07:16 +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 (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
Frédéric Wang bfc9ce8e7b Improvements to prepare a MathJax+PNG option
- 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
2013-09-10 18:38:10 +02: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 3b5749cdad Remove dead config variable, wgMathJaxUrl
Change-Id: I15e701f26e8a522bcc34d9c00f3a900982a71f63
2013-05-03 05:41:22 -04: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
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
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
Aaron ae9e0d989b Added file backend support via $wgMathFileBackend.
* Also removed old legacy migration code.

Change-Id: I43cfd7f0da49690a2d0b4eb2daab9b8a110137b7
2012-08-22 17:16:49 -07:00
Brion Vibber 261310bad9 Tweak MathJax loading per recommendations from mathjax-users list:
* drop some of the init lines that don't appear to work/be needed
* only load MathJax.js through ResourceLoader; let MathJax's loader handle the rest

This gets us working in Chrome, where previously we hadn't initialized correctly. Should also help in IE, still needs testing.
Will probably want to swap in the pre-minimized versions of the files at some point, but the expanded ones are fine at this stage of work.
2012-03-06 21:57:12 +00:00
Brion Vibber 2be6ad801a Avoid conflict between MathJax's TeX finder and our own: remove theirs so we don't end up putting preview markup inside other markup 2012-03-05 22:45:56 +00:00
Brion Vibber 829372f32d update copyright notice years for 2012 2012-03-05 22:25:09 +00:00
Brion Vibber 2af7057b05 Set up MathJax as a selectable option in math preferences 2012-03-05 20:34:29 +00:00
Brion Vibber b7c09b58c3 fixes to mathjax loading that somehow didn't get committed yesterday? 2012-03-01 21:13:10 +00:00
Sam Reed 0cf3f13dba Bug 33892 - Move math description into i18n file 2012-01-22 23:00:21 +00:00
Brion Vibber 02f69bf300 Update a butt-ton of extension about URLs to point to https://www.mediawiki.org/ 2011-12-13 23:49:33 +00:00
Brion Vibber a36b0e04d8 Initial experimental import of MathJax source into Math extension as a client-side rendering supplement to the PNG rendering.
* Pulled in MathJax 1.1 (minus the 112 megabytes of PNG "fonts")
* Pulled in some of <https://en.wikipedia.org/wiki/User:Nageh/mathJax> bits for initialization

This doesn't currently override PNG images, but does replace the text-form if you configure it.
2011-12-06 01:17:35 +00:00
Brion Vibber 1042006fd4 Experimental option $wgMathUseMathJax to have Extension:Math load things via MathJax.
If enabled, by default loads MathJax from a CDN and forces all equations through MathJax when JavaScript is available -- the image or source form gets used only as <noscript> fallback.

This has a couple of problems for us:
* if scripts are missing -- such as when viewed via MobileFrontend -- you end up with no math at all, as the <script type="math/tex"> bits get ignored but the <noscript> still hides the images.
* while MathJax is loading things, blank spots on the page may appear and stuff jumps around
* if loading new text in via ajax, it doesn't trigger there

Also using some fairly default config, no idea how appropriate it is. Hoping to get some insight from Nageh who's done some of the MathJax work on Wikipedia so far - <https://en.wikipedia.org/wiki/User_talk:Nageh#MathJax_integration_into_stock_MediaWiki>
2011-11-29 00:37:13 +00:00
Brion Vibber 09679f2f39 Disable the partial HTML and MathML rendering options for Math extension.
MathML mode was so incomplete most people thought it simply didn't work (bug 25646).
HTML modes often rendered poorly (eg req bug 24207 to set default to PNG on some sites)

This may cause regressions in that simple "equations" of just variables that came out as HTML
will now render as PNGs that don't get aligned properly with the text baseline. Fixing this is
covered by bug 32694: <https://bugzilla.wikimedia.org/show_bug.cgi?id=32694> to retrieve the
baseline info from dvipng and position images to fit.

Note that because of the way user options are pulled in to the oarser cache key, some folks
may see cached pages with their old settings until they get redone or they save their prefs
again and have it normalized.
2011-11-28 22:30:33 +00:00
Alexandre Emsenhuber 2494e28140 Added path to extension's credits show that it can show SVN revision on Special:Version 2011-09-30 20:55:54 +00:00
Brion Vibber 6d5b5679fd Followup r97001: fix for Math parser tests image URLs
Setting $wgMathPath to a fixed value during parser test runs so the values are predictable.
2011-09-13 21:03:38 +00:00
Brion Vibber d61409f974 Breaking the 'math' table setup out to Math extension. Should be the last main step in extension-ification of the math options!
The 'math' table will no longer be created on a default install unless you've explicitly enabled the Math plugin at install time; the usual update.php procedure will add it in.

Postgres, Oracle, MSSQL, and DB2 variants are included -- broken out from the core files -- but have not been tested.

I know there has been some code duplication in parser test infrastructure but could only find one instance of the parser test temporary table setup to remove the 'math' table from (the extension adds it back via the hook). If the phpunit-based runner breaks, please track it down and fix it there too.
2011-04-22 21:37:16 +00:00
Brion Vibber 9a767a671a Followup to r85706 and friends: now that Math messages have been moved to extension, move out the settings list and constants.
* MW_MATH_* constants are now defined in Math extension
* Language::getMathNames() is removed
* mathNames section in message files is removed
* A hardcoded preference override in refreshLinks moved to MaintenanceRefreshLinksInit hook
2011-04-09 19:57:35 +00:00
Jack Phoenix e0b832c637 Math extension:
*coding style tweaks
*documentation
*check for MediaWiki environment in the main setup file
*add extension credits
*add i18n file (only English at the moment); messages from core MessagesEn.php

This is a follow-up to Brion's r85706.
2011-04-09 15:13:22 +00:00
Brion Vibber c4d9349786 Initial stab at breaking math/texvc out to Math extension.
* (bug 14202) $wgUseTeX has been superseded by the Math extension. To re-enable
  math conversion after upgrading, obtain the Math extension from SVN or from
  http://www.mediawiki.org/wiki/Extension:Math and add to LocalSettings.php:
  require_once "$IP/extensions/Math/Math.php";

This is an initial stab, and a few things remain to be cleaned up:
* messages need to be moved from core to extension
* MW_MATH_* constants should be moved to the extension from core
* old back-compat math names interfaces using those constants should be removed from message files
* classic edit toolbar's math button should be added from the extension (or else dropped) -- currently there's not a clean hook, but could do it by JS
* couple of things like the 'armourMath' function on Language & LanguageConverter may want to be redone just as an unconditional, if that's simpler.

Setting $wgUseTeX alone will no longer have any affect. The var's still there for the moment as a few bits still need to be fully moved out from core.
2011-04-09 00:39:40 +00:00