Physikerwelt has uploaded a new change for review. https://gerrit.wikimedia.org/r/60642
Change subject: Remove even more unused variables ...................................................................... Remove even more unused variables * $inputhash is also never used. * Additional comments. * allow creatation of math renderer without $tex code Change-Id: I64c181408e8acd16aee7a53a81a176b62a6726b5 --- M MathRenderer.php 1 file changed, 25 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/42/60642/1 diff --git a/MathRenderer.php b/MathRenderer.php index 2077efc..a504ee3 100644 --- a/MathRenderer.php +++ b/MathRenderer.php @@ -9,7 +9,11 @@ */ /** - * Abstract base class for math renderers using different technologies. + * Abstract base class with static methods for rendering the <math> tags using different technologies. + * This static methods create a new istance of the extending classes and render the math tags based on the + * mode setting of the user. + * Furthermore this class handles the caching of the rendered output and provides debug information, + * if run in mathdebug mode. * * @author Tomasz Wegrzanowski * @author Brion Vibber @@ -17,11 +21,15 @@ */ abstract class MathRenderer { /** - * The following variables should made private, as soon it can be verified that they are not being directly accessed by other extensions. + * The following variables should made private, as soon it can be verified + * that they are not being directly accessed by other extensions. */ var $mode = MW_MATH_PNG; var $tex = ''; - var $inputhash = ''; + /** + * is calculated by texvc. + * @var string + */ var $hash = ''; var $html = ''; var $mathml = ''; @@ -35,7 +43,7 @@ * @param string $tex LaTeX markup * @param array $params HTML attributes */ - public function __construct( $tex, $params = array() ) { + public function __construct( $tex='', $params = array() ) { $this->tex = $tex; $this->params = $params; } @@ -77,17 +85,21 @@ default: $renderer = new MathTexvc( $tex, $params ); } + wfDebugLog ( "Math", 'start rendering $' . $renderer->tex . '$' ); return $renderer; } /** - * Returns TeX to HTML + * Performs the rendering and returns the rendered element that needs to be embedded. * * @return string of rendered HTML */ - abstract public function render(); + abstract public function render(); + /** + * texvc error messages + * TODO: update to MathML * Returns an internationalized HTML error string * * @param string $msg message key for specific error @@ -147,7 +159,13 @@ } /** - * Writes rendering entry to database + * Writes rendering entry to database. + * + * WARNING: Use writeCache() instead of this method to be sure that all + * renderer specific (such as squid caching) are taken into account. + * This function stores the values that are currently present in the class to the database even if they are empty. + * + * This function can be seen as protected function. */ public function writeToDatabase() { # Now save it back to the DB: -- To view, visit https://gerrit.wikimedia.org/r/60642 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I64c181408e8acd16aee7a53a81a176b62a6726b5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Physikerwelt <w...@physikerwelt.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits