mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-28 01:10:09 +00:00
926db7c3bd
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
43 lines
954 B
PHP
43 lines
954 B
PHP
<?php
|
|
/**
|
|
* MediaWiki math extension
|
|
*
|
|
* (c) 2002-2012 Tomasz Wegrzanowski, Brion Vibber, Moritz Schubotz and other MediaWiki contributors
|
|
* GPLv2 license; info in main package.
|
|
*
|
|
* Contains everything related to <math> </math> parsing
|
|
* @file
|
|
*/
|
|
|
|
|
|
/**
|
|
* Takes LaTeX fragments and outputs the source directly to the browser
|
|
*
|
|
* @author Tomasz Wegrzanowski
|
|
* @author Brion Vibber
|
|
* @author Moritz Schubotz
|
|
* @ingroup Parser
|
|
*/
|
|
class MathSource extends MathRenderer {
|
|
/**
|
|
* Renders TeX by outputting it to the browser in a span tag
|
|
*
|
|
* @return string span tag with TeX
|
|
*/
|
|
function render() {
|
|
# No need to render or parse anything more!
|
|
# New lines are replaced with spaces, which avoids confusing our parser (bugs 23190, 22818)
|
|
return Xml::element( 'span',
|
|
$this->getAttributes(
|
|
'span',
|
|
array(
|
|
'class' => 'tex',
|
|
'dir' => 'ltr'
|
|
)
|
|
),
|
|
'$ ' . str_replace( "\n", " ", $this->tex ) . ' $'
|
|
);
|
|
}
|
|
|
|
}
|