first pass at a colored, unified diff, using a fake longest common subsequence algorithm that doesn't quite work exactly the way i want

This commit is contained in:
tmont 2008-10-24 10:44:24 +00:00
parent 649def05df
commit dc4cb8dcf9
3 changed files with 21 additions and 3 deletions

View File

@ -53,9 +53,7 @@
<h1>Diff r<?php echo $this->diff->oldRevision->revision; ?>/r<?php echo $this->diff->newRevision->revision;?></h1>
<div class="wikidiff">
<pre><?php echo $this->diff->getDiff(); ?></pre>
</div>
<div class="wikidiff"><?php echo $this->diff->getInlineDiff(); ?></div>
<?php

View File

@ -81,6 +81,7 @@
$link = $this->wikiPath . '/' . $this->pageName;
$link .= '?diff[' . $previous->revision . ',' . $revision .']';
$affectedBytes = strlen($history->wikitext) - strlen($previous->wikitext);
$affectedBytes = (($affectedBytes >= 0) ? '+' : '') . $affectedBytes;
$affectedBytes = '<a href="' . $link .'">' . $affectedBytes . ' bytes</a>';
}

View File

@ -180,4 +180,23 @@ ul.menu {
}
.wikicontent {
margin: 10px auto;
}
.wikidiff {
white-space: pre;
font-family: "Courier New", monospace;
font-size: 125%;
border: 2px solid #000000;
padding: 4px;
background-color: #FFFFFF;
overflow: auto;
}
.wikidiff del, .wikidiff ins {
text-decoration: none;
font-weight: bold;
}
.wikidiff del {
background-color: #FFCCEE;
}
.wikidiff ins {
background-color: #CCFFCC;
}