コード例 #1
0
 /**
  * @see DifferenceEngine::generateContentDiffBody
  *
  * @param Content $old
  * @param Content $new
  *
  * @throws MWException If the two content objects are neither EntityContent nor TextContent.
  * @return string
  */
 public function generateContentDiffBody(Content $old, Content $new)
 {
     if ($old instanceof EntityContent && $new instanceof EntityContent) {
         $diff = $old->getDiff($new);
         return $this->diffVisualizer->visualizeEntityContentDiff($diff);
     }
     return parent::generateContentDiffBody($old, $new);
 }
コード例 #2
0
 /**
  * @param EntityContentDiff $diff
  */
 private function displayUndoDiff(EntityContentDiff $diff)
 {
     $tableClass = 'diff diff-contentalign-' . htmlspecialchars($this->getTitle()->getPageLanguage()->alignStart());
     $this->getOutput()->addHTML(Html::openElement('table', array('class' => $tableClass)));
     $this->getOutput()->addHTML('<colgroup>' . '<col class="diff-marker"><col class="diff-content">' . '<col class="diff-marker"><col class="diff-content">' . '</colgroup>');
     $this->getOutput()->addHTML(Html::openElement('tbody'));
     $old = $this->msg('currentrev')->parse();
     $new = $this->msg('yourtext')->parse();
     //XXX: better message?
     $this->getOutput()->addHTML(Html::openElement('tr', array('valign' => 'top')));
     $this->getOutput()->addHTML(Html::rawElement('td', array('colspan' => '2'), Html::rawElement('div', array('id' => 'mw-diff-otitle1'), $old)));
     $this->getOutput()->addHTML(Html::rawElement('td', array('colspan' => '2'), Html::rawElement('div', array('id' => 'mw-diff-ntitle1'), $new)));
     $this->getOutput()->addHTML(Html::closeElement('tr'));
     $this->getOutput()->addHTML($this->entityDiffVisualizer->visualizeEntityContentDiff($diff));
     $this->getOutput()->addHTML(Html::closeElement('tbody'));
     $this->getOutput()->addHTML(Html::closeElement('table'));
     $this->showDiffStyle();
 }