Physikerwelt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/252685

Change subject: Display texvcinfo information in gui
......................................................................

Display texvcinfo information in gui

Change-Id: I3111692f968ec4cb7d84084f0a9f69ada8da20c9
---
M FormulaInfo.php
M MathObject.php
2 files changed, 27 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MathSearch 
refs/changes/85/252685/1

diff --git a/FormulaInfo.php b/FormulaInfo.php
index 9ad5a58..ba7be30 100644
--- a/FormulaInfo.php
+++ b/FormulaInfo.php
@@ -95,7 +95,8 @@
                }
                $out->addWikiText( 'Hash: ' . $mo->getMd5() );
                $this->printSource( $mo->getUserInputTex(), 'TeX (original user 
input)', 'latex' );
-               $this->printSource( $mo->getTex(), 'TeX (checked)', 'latex' );
+               $texInfo = $mo->getTexInfo();
+               $this->printSource( $texInfo->getChecked(), 'TeX (checked)', 
'latex' );
                $this->DisplayRendering( $mo->getUserInputTex(), 'latexml' );
                $this->DisplayRendering( $mo->getUserInputTex(), 'mathml' );
                $this->DisplayRendering( $mo->getUserInputTex(), 'png' );
@@ -105,7 +106,11 @@
                );
                $pid = Revision::newFromId( $oldID 
)->getTitle()->getArticleID();
                $mo->findSimilarPages( $pid );
-               $out->addWikiText( '==Variables==' );
+               $out->addWikiText( '==Identifiers==' );
+               foreach($texInfo->getIdentifiers() as $x){
+                       $out->addWikiText('* <math>'.$x.'</math>');
+               }
+               $out->addWikiText( '=== MathML observations ===' );
                $mo->getObservations();
                if ( $wgMathDebug ) {
                        $out->addWikiText( '==LOG and Debug==' );
diff --git a/MathObject.php b/MathObject.php
index 39a75b9..c55233b 100644
--- a/MathObject.php
+++ b/MathObject.php
@@ -1,6 +1,9 @@
 <?php
 use MediaWiki\Logger\LoggerFactory;
 
+/**
+ * Class MathObject
+ */
 class MathObject extends MathMathML {
        // DEBUG VARIABLES
        // Available, if Math extension runs in debug mode ($wgMathDebug = 
true) only.
@@ -134,11 +137,11 @@
                $dbw = wfGetDB( DB_MASTER );
                $dbw->query( 'TRUNCATE TABLE `mathvarstat`' );
                // @codingStandardsIgnoreStart
-               $dbw->query( "INSERT INTO `mathvarstat` (`varstat_featurename` 
, `varstat_featuretype`, `varstat_featurecount`)\n"
-                       . "SELECT `mathobservation_featurename` , 
`mathobservation_featuretype` , count( * ) AS CNT\n"
-                       . "FROM `mathobservation`\n"
-                       . "JOIN mathindex ON `mathobservation_inputhash` = 
mathindex_inputhash\n"
-                       . "GROUP BY `mathobservation_featurename` , 
`mathobservation_featuretype`\n"
+               $dbw->query( "INSERT INTO `mathvarstat` (`varstat_featurename` 
, `varstat_featuretype`, `varstat_featurecount`) "
+                       . "SELECT `mathobservation_featurename` , 
`mathobservation_featuretype` , count( * ) AS CNT "
+                       . "FROM `mathobservation` "
+                       . "JOIN mathindex ON `mathobservation_inputhash` = 
mathindex_inputhash "
+                       . "GROUP BY `mathobservation_featurename` , 
`mathobservation_featuretype` "
                        . "ORDER BY CNT DESC" );
                $dbw->query( 'TRUNCATE TABLE `mathrevisionstat`' );
                $dbw->query( 'INSERT INTO 
`mathrevisionstat`(`revstat_featureid`,`revstat_revid`,`revstat_featurecount`) '
@@ -437,4 +440,16 @@
        public function setMathTableName( $tableName ) {
                $this->mathTableName = $tableName;
        }
+
+       /**
+        * @return MathoidDriver
+        */
+       public function getTexInfo(){
+               $m = new MathoidDriver( $this->userInputTex );
+               if ( $m->texvcInfo() ){
+                       return $m;
+               } else {
+                       return false;
+               }
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/252685
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3111692f968ec4cb7d84084f0a9f69ada8da20c9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MathSearch
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to