jenkins-bot has submitted this change and it was merged.

Change subject: Draft Step 3 Layout evaluation
......................................................................


Draft Step 3 Layout evaluation

Change-Id: I05c9335382ed855737afa3da1a23b5249f0d3313
---
M includes/MlpEvalForm.php
M includes/special/SpecialMlpEval.php
2 files changed, 38 insertions(+), 12 deletions(-)

Approvals:
  Physikerwelt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/MlpEvalForm.php b/includes/MlpEvalForm.php
index cd2b9e5..108c263 100644
--- a/includes/MlpEvalForm.php
+++ b/includes/MlpEvalForm.php
@@ -40,6 +40,9 @@
                                $formDescriptor['evalPage'] = $s;
                                break;
                        case SpecialMlpEval::STEP_FORMULA:
+                       case SpecialMlpEval::STEP_STYLE:
+                       case SpecialMlpEval::STEP_IDENTIFIERS:
+                       case SpecialMlpEval::STEP_DEFINITIONS:
                                $formDescriptor['snippetSelector'] = array(
                                                'type'    => 'radio',
                                                'label'   => 'Page to evaluate',
diff --git a/includes/special/SpecialMlpEval.php 
b/includes/special/SpecialMlpEval.php
index 89b8a9a..6f0e429 100644
--- a/includes/special/SpecialMlpEval.php
+++ b/includes/special/SpecialMlpEval.php
@@ -90,7 +90,8 @@
                if ( $this->setFId( $fId ) === false ) {
                        return $this->setStep( 2 );
                }
-               if ( $req->getInt( 'oldStep' ) === 2 ){
+               // @TODO: Switch back to === 2
+               if ( $req->getInt( 'oldStep' ) > 1 ){
                        switch ( $req->getInt( 'wpsnippetSelector' ) ){
                                                case MlpEvalForm::OPT_BACK;
                                                return $this->resetPage();
@@ -100,7 +101,7 @@
                                                $this->writeLog( "pgRst: User 
selects formula $fId" );
                        }
                }
-               return $this->setStep( 3 );
+               return $this->setStep( $req->getInt( 'oldStep' ) + 1 );
        }
 
        /**
@@ -203,16 +204,6 @@
        }
 
 
-       /**
-        *
-        * @param String $src
-        * @param String $lang the language of the source snippet
-        */
-       public function printSource( $src, $lang = "xml" ) {
-               $out = $this->getOutput();
-               $out->addWikiText( '<source lang="' . $lang . '">' . $src . 
'</source>' );
-       }
-
        protected function getGroupName() {
                return 'mathsearch';
        }
@@ -275,6 +266,14 @@
                                $this->getOutput()->addWikiText( 
$hl->getWikiText() );
                                break;
                        case self::STEP_STYLE:
+                               $this->enableMathStyles();
+                               $mo = MathObject::newFromRevisionText( 
$this->oldId, $this->fId );
+                               $this->printSource( $mo->getUserInputTex(), 
'TeX (original user input)', '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' );
                                break;
                        case self::STEP_IDENTIFIERS:
                                break;
@@ -312,4 +311,28 @@
                return $this->setStep( 2 );
        }
 
+       private function printSource( $source, $description = "", $language = 
"text", $linestart = true ) {
+               if ( $description ) {
+                       $description .= ": ";
+               }
+               $this->getOutput()->addWikiText( "$description<syntaxhighlight 
lang=\"$language\">" .
+                               $source . '</syntaxhighlight>', $linestart );
+       }
+
+       private function DisplayRendering( $tex, $mode ) {
+               global $wgMathValidModes;
+               if ( !in_array( $mode, $wgMathValidModes ) ) {
+                       return;
+               }
+               $out = $this->getOutput();
+               $names = MathHooks::getMathNames();
+               $name = $names[$mode];
+               $out->addWikiText( "=== $name rendering === " );
+               $renderer = MathRenderer::getRenderer( $tex, array(), $mode );
+               $renderer->checkTex();
+               $renderer->render();
+               $out->addHTML( $renderer->getHtmlOutput() );
+               $renderer->writeCache();
+
+       }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I05c9335382ed855737afa3da1a23b5249f0d3313
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MathSearch
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <w...@physikerwelt.de>
Gerrit-Reviewer: Dyiop <akashworkm...@gmail.com>
Gerrit-Reviewer: Hcohl <hc...@nist.gov>
Gerrit-Reviewer: Physikerwelt <w...@physikerwelt.de>
Gerrit-Reviewer: Whyameri <yusuf.am...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to