Physikerwelt has submitted this change and it was merged.
Change subject: Adjustments to the Math extension
......................................................................
Adjustments to the Math extension
added curl output to the debug page for LaTeXML developers
Change-Id: I72b0471d186f4054e8c691a926ab162a2a40e5ec
---
M FormulaInfo.php
M MathObject.php
M MathSearch.alias.php
M SpecialMathDebug.php
4 files changed, 33 insertions(+), 10 deletions(-)
Approvals:
Physikerwelt: Verified; Looks good to me, approved
diff --git a/FormulaInfo.php b/FormulaInfo.php
index 68e4f02..093da30 100644
--- a/FormulaInfo.php
+++ b/FormulaInfo.php
@@ -66,11 +66,11 @@
$mo = MathObject::constructformpage( $pid, $eid );
$wgOut->addWikiText( "Occurences on the following pages:" );
wfDebugLog( "MathSearch", var_export( $mo->getAllOccurences(),
true ) );
- // $wgOut->addWikiText('<b>:'.var_export($res,true).'</b>');
+ //$wgOut->addWikiText('<b>:'.var_export($res,true).'</b>');
$wgOut->addWikiText( 'TeX : <code>' . $mo->getTex() . '</code>'
);
$wgOut->addWikiText( 'MathML : ', false );
- $wgOut->addHTML( $mo->mathml );
+ $wgOut->addHTML( $mo->getMathml() );
$wgOut->addHtml( '<a href="/wiki/Special:MathSearch?pattern=' .
urlencode( $mo->getTex() ) . '&searchx=Search"><img
src="http://wikidemo.formulasearchengine.com/images/FSE-PIC.png" width="15"
height="15"></a>' );
# $log=htmlspecialchars( $res->math_log );
$wgOut->addWikiText( '==Similar pages==' );
@@ -82,7 +82,7 @@
$wgOut->addWikiText( '==MathML==' );
$wgOut->addHtml( "<br />" );
- $wgOut->addHtml( htmlspecialchars( $mo->mathml ) );
+ $wgOut->addHtml( htmlspecialchars( $mo->getMathml() ) );
$wgOut->addHtml( "<br />" );
$wgOut->addHtml( "<br />" );
$wgOut->addHtml( "<br />" );
@@ -90,7 +90,7 @@
$wgOut->addWikiText( '==LOG and Debug==' );
$wgOut->addWikiText( 'Rendered at : <code>' .
$mo->getTimestamp()
. '</code> an idexed at <code>' .
$mo->getIndexTimestamp() . '</code>' );
- $wgOut->addWikiText( 'validxml : <code>' . $mo->getValidXml() .
'</code> recheck:', false );
+ $wgOut->addWikiText( 'validxml : <code>' .
MathLaTeXML::isValidMathML($mo->getMathml()) . '</code> recheck:', false );
$wgOut->addHtml( MathLaTeXML::isValidMathML( $mo->getMathml() )
? "valid":"invalid" );
$wgOut->addWikiText( 'status : <code>' . $mo->getStatusCode() .
'</code>' );
$wgOut->addHtml( htmlspecialchars( $mo->getLog() ) );
diff --git a/MathObject.php b/MathObject.php
index dbc158d..73adcbd 100644
--- a/MathObject.php
+++ b/MathObject.php
@@ -3,6 +3,13 @@
protected $anchorID = 0;
protected $pageID = 0;
protected $index_timestamp = null;
+ protected $inputHash = '';
+
+ private static function DebugPrint($s){
+ //$s= Sanitizer::safeEncodeAttribute($s);
+ wfDebugLog( "MathSearch", $s);
+ }
+
public function getAnchorID() {
return $this->anchorID;
}
@@ -18,6 +25,15 @@
public function getIndexTimestamp() {
return $this->index_timestamp;
}
+ public function getInputHash(){
+ wfDebugLog('MathSearch', 'Debugger dies here');
+ //die('end of debug toolbar');
+ if ($this->inputHash){
+ return $this->inputHash;
+ } else {
+ return parent::getInputHash();
+ }
+ }
public static function constructformpagerow( $res ) {
global $wgDebugMath;
if ( $res->mathindex_page_id > 0 ) {
@@ -28,13 +44,14 @@
$instance->index_timestamp = $res->mathindex_timestamp;
}
$instance->inputHash = $res->mathindex_inputhash;
- $instance->readDatabaseEntry();
- wfDebugLog( "MathSearch", 'got' . var_export( $instance, true )
);
+ $instance->readFromDatabase();
+ self::DebugPrint( 'got' . var_export( $instance, true ) );
return $instance;
} else {
return false;
}
}
+
public static function findSimilarPages( $pid ) {
global $wgOut;
$out = "";
@@ -122,7 +139,7 @@
'mathindex_page_id = ' . $pid
. ' AND mathindex_anchor= ' . $eid
);
- wfDebugLog( "MathSearch", var_export( $res, true ) );
+ self::DebugPrint( var_export( $res, true ) );
return self::constructformpagerow( $res );
}
@@ -140,7 +157,7 @@
);
foreach ( $res as $row ) {
- wfDebugLog( "MathSearch", var_export( $row, true ) );
+ self::DebugPrint( var_export( $row, true ) );
$var = self::constructformpagerow( $row );
if ( $var ) {
$var->printLink2Page( false );
diff --git a/MathSearch.alias.php b/MathSearch.alias.php
index 9708a4d..77a72e7 100644
--- a/MathSearch.alias.php
+++ b/MathSearch.alias.php
@@ -10,7 +10,9 @@
/** English (English) */
$specialPageAliases['en'] = array(
- 'MathSearch' => array( 'MathSearch' ),
+ 'MathSearch' => array( 'MathSearch', 'Math Search' ),
+ 'MathDebug' => array( 'MathDebug', 'Math Debug' ),
+ 'FormulaInfo' => array( 'FormulaInfo', 'Formula Info' ),
);
/** German (Deutsch) */
diff --git a/SpecialMathDebug.php b/SpecialMathDebug.php
index 96aee93..39edd0e 100644
--- a/SpecialMathDebug.php
+++ b/SpecialMathDebug.php
@@ -86,7 +86,11 @@
if ( $diff->isEmpty() ) {
$out->addWikiText( 'Output is
identical' );
} else {
- $out->addWikiText( '<source
lang="diff">' . $diffFormatter->format( $diff ) . '</source>' );
+ $out->addWikiText('Requst A <source
lang="bash"> curl -d \''.
+ $renderer->getPostValue().'\'
'.$parserA.'</source>');
+ $out->addWikiText('Requst B <source
lang="bash"> curl -d \''.
+ $renderer->getPostValue().'\'
'.$parserB.'</source>');
+ $out->addWikiText( 'Diff: <source
lang="diff">' . $diffFormatter->format( $diff ) . '</source>' );
$out->addWikiText( 'XML Element based:'
);
$XMLA = explode( '>', $stringA );
$XMLB = explode( '>', $stringB );
--
To view, visit https://gerrit.wikimedia.org/r/66065
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I72b0471d186f4054e8c691a926ab162a2a40e5ec
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MathSearch
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <[email protected]>
Gerrit-Reviewer: Physikerwelt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits