--- /mnt/backup/backups/2004-12-26/var/www/twiki/lib/TWiki/UI/RDiff.pm 2004-09-27 21:23:32.000000000 +0200 +++ lib/TWiki/UI/RDiff.pm 2005-01-04 00:30:20.000000000 +0100 @@ -38,6 +38,8 @@ "u" => [ "#ffffff", "twikiDiffUnchangedText"], "l" => [ "#eeeeee", "twikiDiffLineNumberHeader"] ); +my $globalDiffCount; + #SVEN - new design. #main gets the info (NO MAJOR CHANGES NEEDED) #parseDiffs reads the diffs and interprets the information into types {"+", "-", "u", "c", "l"} (add, remove, unchanged, changed, lineNumber} where line number is for diffs that skip unchanged lines (diff -u etc) @@ -181,8 +183,37 @@ return $result; } +# ========================= +=pod + +---+++ _anchor($text) ==> 'anchor' $text 'next' 'previous' + * Returns $text preceeded with an anchor and postfixed by a links to next and previous diffs + * Anchors are on the format diff001, diff002,... + * Uses $globalDiffCount to number anchors +=cut +# ------------------------- +sub _anchor +{ + $globalDiffCount++; + my $return = join('', + '' + ,$_[0] + ,' [ next'); + $return.= join('' + ,' | previous ]') if ($globalDiffCount > 1); + $return.= ' | to top ]' if($globalDiffCount==1); + + return $return; +} # ========================= + =pod ---+++ _renderSequential( $topic, $diffType, $left, $right ) ==> $result @@ -194,22 +225,25 @@ | Return: =$result= | Formatted html text | | TODO: | this should move to Render.pm | +Beware: + * =$globalDiffCount= should be set to 0 before first call, ugly - but quick fix. + * Anchors to diffs are: #diff001 , #diff002 , etc. =cut # ------------------------- sub _renderSequential { - my ( $topic, $diffType, $left, $right ) = @_; + my ( $topic, $diffType, $left, $right) = @_; my $result = ""; #note: I have made the colspan 9 to make sure that it spans all columns (thought there are only 2 now) if ( $diffType eq "-") { - $result .= qq(