2011-04-09 00:39:40 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* MediaWiki math extension
|
|
|
|
*
|
2011-04-09 15:13:22 +00:00
|
|
|
* @file
|
|
|
|
* @ingroup Extensions
|
|
|
|
* @version 1.0
|
|
|
|
* @author Tomasz Wegrzanowski
|
|
|
|
* @author Brion Vibber
|
2012-10-27 14:30:50 +00:00
|
|
|
* @author Moritz Schubotz
|
2012-03-05 22:25:09 +00:00
|
|
|
* @copyright © 2002-2012 various MediaWiki contributors
|
2011-04-09 15:13:22 +00:00
|
|
|
* @license GPLv2 license; info in main package.
|
|
|
|
* @link http://www.mediawiki.org/wiki/Extension:Math Documentation
|
|
|
|
* @see https://bugzilla.wikimedia.org/show_bug.cgi?id=14202
|
2011-04-09 00:39:40 +00:00
|
|
|
*/
|
|
|
|
|
2011-04-09 15:13:22 +00:00
|
|
|
if ( !defined( 'MEDIAWIKI' ) ) {
|
|
|
|
die( "This is not a valid entry point to MediaWiki.\n" );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Extension credits that will show up on Special:Version
|
|
|
|
$wgExtensionCredits['parserhook'][] = array(
|
2011-09-30 20:55:54 +00:00
|
|
|
'path' => __FILE__,
|
2011-04-09 15:13:22 +00:00
|
|
|
'name' => 'Math',
|
|
|
|
'version' => '1.0',
|
|
|
|
'author' => array( 'Tomasz Wegrzanowski', 'Brion Vibber', '...' ),
|
2012-01-22 23:00:21 +00:00
|
|
|
'descriptionmsg' => 'math-desc',
|
2011-12-13 23:49:33 +00:00
|
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:Math',
|
2011-04-09 15:13:22 +00:00
|
|
|
);
|
|
|
|
|
2011-04-09 19:57:35 +00:00
|
|
|
/**@{
|
|
|
|
* Maths constants
|
|
|
|
*/
|
|
|
|
define( 'MW_MATH_PNG', 0 );
|
2011-11-28 22:30:33 +00:00
|
|
|
define( 'MW_MATH_SIMPLE', 1 ); /// @deprecated
|
|
|
|
define( 'MW_MATH_HTML', 2 ); /// @deprecated
|
2011-04-09 19:57:35 +00:00
|
|
|
define( 'MW_MATH_SOURCE', 3 );
|
2011-11-28 22:30:33 +00:00
|
|
|
define( 'MW_MATH_MODERN', 4 ); /// @deprecated
|
|
|
|
define( 'MW_MATH_MATHML', 5 ); /// @deprecated
|
2012-03-05 20:34:29 +00:00
|
|
|
define( 'MW_MATH_MATHJAX', 6 ); /// new in 1.19/1.20
|
2011-04-09 19:57:35 +00:00
|
|
|
/**@}*/
|
|
|
|
|
2011-04-09 00:39:40 +00:00
|
|
|
/** For back-compat */
|
|
|
|
$wgUseTeX = true;
|
|
|
|
|
|
|
|
/** Location of the texvc binary */
|
|
|
|
$wgTexvc = dirname( __FILE__ ) . '/math/texvc';
|
|
|
|
/**
|
2011-04-09 15:13:22 +00:00
|
|
|
* Texvc background color
|
|
|
|
* use LaTeX color format as used in \special function
|
|
|
|
* for transparent background use value 'Transparent' for alpha transparency or
|
|
|
|
* 'transparent' for binary transparency.
|
|
|
|
*/
|
2011-04-09 00:39:40 +00:00
|
|
|
$wgTexvcBackgroundColor = 'transparent';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Normally when generating math images, we double-check that the
|
|
|
|
* directories we want to write to exist, and that files that have
|
|
|
|
* been generated still exist when we need to bring them up again.
|
|
|
|
*
|
|
|
|
* This lets us give useful error messages in case of permission
|
|
|
|
* problems, and automatically rebuild images that have been lost.
|
|
|
|
*
|
|
|
|
* On a big site with heavy NFS traffic this can be slow and flaky,
|
|
|
|
* so sometimes we want to short-circuit it by setting this to false.
|
|
|
|
*/
|
|
|
|
$wgMathCheckFiles = true;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The URL path of the math directory. Defaults to "{$wgUploadPath}/math".
|
|
|
|
*
|
|
|
|
* See http://www.mediawiki.org/wiki/Manual:Enable_TeX for details about how to
|
|
|
|
* set up mathematical formula display.
|
|
|
|
*/
|
2011-04-09 15:13:22 +00:00
|
|
|
$wgMathPath = false;
|
2011-04-09 00:39:40 +00:00
|
|
|
|
2012-08-20 22:11:16 +00:00
|
|
|
/**
|
|
|
|
* The name of a file backend ($wgFileBackends) to use for storing math renderings.
|
|
|
|
* Defaults to FSFileBackend using $wgMathDirectory as a base path.
|
|
|
|
*
|
|
|
|
* See http://www.mediawiki.org/wiki/Manual:Enable_TeX for details about how to
|
|
|
|
* set up mathematical formula display.
|
|
|
|
*/
|
|
|
|
$wgMathFileBackend = false;
|
|
|
|
|
2011-04-09 00:39:40 +00:00
|
|
|
/**
|
|
|
|
* The filesystem path of the math directory.
|
|
|
|
* Defaults to "{$wgUploadDirectory}/math".
|
|
|
|
*
|
|
|
|
* See http://www.mediawiki.org/wiki/Manual:Enable_TeX for details about how to
|
|
|
|
* set up mathematical formula display.
|
|
|
|
*/
|
2011-04-09 15:13:22 +00:00
|
|
|
$wgMathDirectory = false;
|
2011-04-09 00:39:40 +00:00
|
|
|
|
2011-11-29 00:37:13 +00:00
|
|
|
/**
|
|
|
|
* Experimental option to use MathJax library to do client-side math rendering
|
|
|
|
* when JavaScript is available. In supporting browsers this makes nice output
|
|
|
|
* that's scalable for zooming, printing, and high-resolution displays.
|
|
|
|
*
|
|
|
|
* Not guaranteed to be stable at this time.
|
|
|
|
*/
|
2012-03-05 20:34:29 +00:00
|
|
|
$wgUseMathJax = false;
|
2011-11-29 00:37:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Use of MathJax's CDN is governed by terms of service
|
|
|
|
* <http://www.mathjax.org/download/mathjax-cdn-terms-of-service/>
|
|
|
|
*
|
|
|
|
* If you don't like them, install your own copy to load.
|
|
|
|
*/
|
|
|
|
$wgMathJaxUrl = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML';
|
2011-04-09 00:39:40 +00:00
|
|
|
|
|
|
|
////////// end of config settings.
|
|
|
|
|
2011-11-28 22:30:33 +00:00
|
|
|
$wgDefaultUserOptions['math'] = MW_MATH_PNG;
|
2011-04-09 00:39:40 +00:00
|
|
|
|
|
|
|
$wgExtensionFunctions[] = 'MathHooks::setup';
|
|
|
|
$wgHooks['ParserFirstCallInit'][] = 'MathHooks::onParserFirstCallInit';
|
|
|
|
$wgHooks['GetPreferences'][] = 'MathHooks::onGetPreferences';
|
2011-04-22 21:37:16 +00:00
|
|
|
$wgHooks['LoadExtensionSchemaUpdates'][] = 'MathHooks::onLoadExtensionSchemaUpdates';
|
|
|
|
$wgHooks['ParserTestTables'][] = 'MathHooks::onParserTestTables';
|
2011-09-13 21:03:38 +00:00
|
|
|
$wgHooks['ParserTestParser'][] = 'MathHooks::onParserTestParser';
|
2011-04-09 00:39:40 +00:00
|
|
|
|
2011-04-09 15:13:22 +00:00
|
|
|
$dir = dirname( __FILE__ ) . '/';
|
|
|
|
$wgAutoloadClasses['MathHooks'] = $dir . 'Math.hooks.php';
|
2013-01-01 16:16:35 +00:00
|
|
|
$wgAutoloadClasses['MathRenderer'] = $dir . 'MathRenderer.php';
|
2012-10-27 14:30:50 +00:00
|
|
|
$wgAutoloadClasses['MathTexvc'] = $dir . 'MathTexvc.php';
|
|
|
|
$wgAutoloadClasses['MathSource'] = $dir . 'MathSource.php';
|
|
|
|
$wgAutoloadClasses['MathMathJax'] = $dir . 'MathMathJax.php';
|
2011-04-09 15:13:22 +00:00
|
|
|
$wgExtensionMessagesFiles['Math'] = $dir . 'Math.i18n.php';
|
2011-04-09 00:39:40 +00:00
|
|
|
|
2011-09-30 20:55:54 +00:00
|
|
|
$wgParserTestFiles[] = $dir . 'mathParserTests.txt';
|
2011-12-06 01:17:35 +00:00
|
|
|
|
|
|
|
$moduleTemplate = array(
|
|
|
|
'localBasePath' => dirname( __FILE__ ) . '/modules',
|
|
|
|
'remoteExtPath' => 'Math/modules',
|
|
|
|
);
|
|
|
|
|
|
|
|
$wgResourceModules['ext.math.mathjax'] = array(
|
|
|
|
'scripts' => array(
|
|
|
|
'MathJax/MathJax.js',
|
2012-03-06 21:57:12 +00:00
|
|
|
// We'll let the other parts be loaded by MathJax's
|
|
|
|
// own module/config loader.
|
2011-12-06 01:17:35 +00:00
|
|
|
),
|
|
|
|
'group' => 'ext.math.mathjax',
|
|
|
|
) + $moduleTemplate;
|
|
|
|
|
|
|
|
$wgResourceModules['ext.math.mathjax.enabler'] = array(
|
|
|
|
'scripts' => 'ext.math.mathjax.enabler.js',
|
|
|
|
) + $moduleTemplate;
|