r39402 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39401‎ | r39402 | r39403 >
Date:10:46, 15 August 2008
Author:guyvdb
Status:old
Tags:
Comment:
bugfixed and improvements for the HTML differ
Modified paths:
  • /branches/visual_diff/phase3/includes/HTMLDiff.php (modified) (history)
  • /branches/visual_diff/phase3/skins/common/diff.css (modified) (history)

Diff [purge]

Index: branches/visual_diff/phase3/skins/common/diff.css
@@ -80,19 +80,16 @@
8181 */
8282 span.diff-html-added {
8383 font-size: 100%;
84 - color: black;
85 - background-color: #ccffcc; /* light green */
 84+ background-color: #20ff20
8685 }
8786
8887 span.diff-html-removed {
8988 font-size: 100%;
90 - color: black;
9189 text-decoration: line-through;
92 - background-color: #fdc6c6; /* light red */
 90+ background-color: #ff2020
9391 }
9492
9593 span.diff-html-changed {
96 - color: black;
9794 background: url(images/diffunderline.gif) bottom repeat-x;
9895 *background-color: #c6c6fd; /* light blue */
9996 }
Index: branches/visual_diff/phase3/includes/HTMLDiff.php
@@ -760,7 +760,7 @@
761761
762762 public function characters($parser, $data){
763763 //wfDebug('Parsing '. strlen($data).' characters.');
764 - $array = preg_split('//', $data, -1, PREG_SPLIT_NO_EMPTY);
 764+ $array = str_split($data);
765765 foreach($array as $c) {
766766 if (self::isDelimiter($c)) {
767767 $this->endWord();
@@ -796,9 +796,6 @@
797797 }
798798
799799 public static function isDelimiter($c) {
800 - if (WhiteSpaceNode::isWhiteSpace($c)){
801 - return true;
802 - }
803800 switch ($c) {
804801 // Basic Delimiters
805802 case '/':
@@ -827,7 +824,7 @@
828825 case ':':
829826 return true;
830827 default:
831 - return false;
 828+ return WhiteSpaceNode::isWhiteSpace($c);
832829 }
833830 }
834831
@@ -1245,7 +1242,7 @@
12461243 $nbOthers = sizeof($other->leafs);
12471244 $nbThis = sizeof($this->leafs);
12481245 if($nbOthers == 0 || $nbThis == 0){
1249 - return log(0);
 1246+ return -log(0);
12501247 }
12511248
12521249 $diffengine = new _DiffEngine();
@@ -1537,7 +1534,7 @@
15381535 $txt->addHtml('<b>');
15391536 $txt->addText(strtolower($this->getDescription()));
15401537 $txt->addHtml('</b>');
1541 - } else if (sem == TagToStringFactory::STYLE) {
 1538+ } else if ($this->sem == TagToStringFactory::STYLE) {
15421539 $txt->addHtml('<b>');
15431540 $txt->addText($this->getDescription());
15441541 $txt->addHtml('</b>');
@@ -1559,7 +1556,7 @@
15601557 $txt->addHtml('<b>');
15611558 $txt->addText(strtolower($this->getDescription()));
15621559 $txt->addHtml('</b>');
1563 - } else if (sem == TagToStringFactory::STYLE) {
 1560+ } else if ($this->sem == TagToStringFactory::STYLE) {
15641561 $txt->addHtml('<b>');
15651562 $txt->addText($this->getDescription());
15661563 $txt->addHtml('</b>');
@@ -1958,7 +1955,7 @@
19591956 function startElement($qname, /*array*/ $arguments){
19601957 echo '<'.$qname;
19611958 foreach($arguments as $key => $value){
1962 - echo ' '.$key.'="'.$value.'"';
 1959+ echo ' '.$key.'="'.Sanitizer::encodeAttribute($value).'"';
19631960 }
19641961 echo '>';
19651962 }
@@ -1984,7 +1981,7 @@
19851982 function startElement($qname, /*array*/ $arguments){
19861983 $this->delegate->addHtml('<'.$qname) ;
19871984 foreach($arguments as $key => $value){
1988 - $this->delegate->addHtml(' '.$key.'="'.$value.'"');
 1985+ $this->delegate->addHtml(' '.$key.'="'. Sanitizer::encodeAttribute($value) .'"');
19891986 }
19901987 $this->delegate->addHtml('>');
19911988 }

Status & tagging log