jenkins-bot has submitted this change and it was merged.
Change subject: Simplify display of Math rendering
......................................................................
Simplify display of Math rendering
* adopt image sizes to restbase
Change-Id: Id759598db88448f59665f175246e079155840d2b
---
M MathObject.php
M includes/special/SpecialMlpEval.php
2 files changed, 16 insertions(+), 15 deletions(-)
Approvals:
Physikerwelt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/MathObject.php b/MathObject.php
index 0eb5839..1e47e50 100644
--- a/MathObject.php
+++ b/MathObject.php
@@ -492,29 +492,29 @@
return '';
}
- public function getSvgWidth() {
- if ( preg_match( "/width=\"(.*?)(ex|px|em)?\"/",
$this->getSvg(), $matches ) ) {
+ public static function getSvgWidth( $svg ) {
+ if ( preg_match( "/width=\"(.*?)(ex|px|em)?\"/", $svg, $matches
) ) {
return $matches;
}
return 0;
}
- public function getSvgHeight() {
- if ( preg_match( "/height=\"(.*?)(ex|px|em)?\"/",
$this->getSvg(), $matches ) ) {
+ public static function getSvgHeight( $svg ) {
+ if ( preg_match( "/height=\"(.*?)(ex|px|em)?\"/", $svg,
$matches ) ) {
return $matches;
}
return 0;
}
- public function getReSizedSvgLink( $factor = 2 ) {
- $width = $this->getSvgWidth();
- $width = $width[1]*$factor.$width[2];
- $height = $this->getSvgHeight();
- $height = $height[1]*$factor.$height[2];
- $reflector = new ReflectionObject( $this );
+ public static function getReSizedSvgLink( MathRenderer $renderer,
$factor = 2 ) {
+ $width = self::getSvgWidth( $renderer->getSvg() );
+ $width = $width[1] * $factor . $width[2];
+ $height = self::getSvgHeight( $renderer->getSvg() );
+ $height = $height[1] * $factor . $height[2];
+ $reflector = new ReflectionObject( $renderer );
$method = $reflector->getMethod( 'getFallbackImage' );
$method->setAccessible( true );
- $fbi = $method->invoke( $this );
+ $fbi = $method->invoke( $renderer );
$fbi = preg_replace( "/width: (.*?)(ex|px|em)/", "width:
$width", $fbi );
$fbi = preg_replace( "/height: (.*?)(ex|px|em)/", "height:
$height", $fbi );
return $fbi;
diff --git a/includes/special/SpecialMlpEval.php
b/includes/special/SpecialMlpEval.php
index b106969..e4aa6e7 100644
--- a/includes/special/SpecialMlpEval.php
+++ b/includes/special/SpecialMlpEval.php
@@ -476,13 +476,14 @@
$source . '</syntaxhighlight>', $linestart );
}
- public function getSvgRenderingAsHtmlFragment( $factor = 2.4, $tex =
false, $options = array() ) {
+ public function getSvgRenderingAsHtmlFragment( $factor = 2, $tex =
false, $options = array() ) {
$renderer = $this->getMathMlRenderer( $tex, $options );
- $mo = MathObject::cloneFromRenderer( $renderer );
- return $mo->getReSizedSvgLink( $factor );
+ return MathObject::getReSizedSvgLink( $renderer, $factor );
}
- public function getMathMLRenderingAsHtmlFragment( $factor = 2, $tex =
false, $options = array() ) {
+ public function getMathMLRenderingAsHtmlFragment(
+ $factor = 2.5, $tex = false, $options = array()
+ ) {
$renderer = $this->getMathMlRenderer( $tex, $options );
$largeMathML = $renderer->getMathml();
$factor = round( $factor * 100 );
--
To view, visit https://gerrit.wikimedia.org/r/258128
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id759598db88448f59665f175246e079155840d2b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MathSearch
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <[email protected]>
Gerrit-Reviewer: Physikerwelt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits