summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/VNDB/Handler/Docs.pm2
-rw-r--r--lib/VNDB/Util/CommonHTML.pm3
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/VNDB/Handler/Docs.pm b/lib/VNDB/Handler/Docs.pm
index 6311ba8f..5848eb2b 100644
--- a/lib/VNDB/Handler/Docs.pm
+++ b/lib/VNDB/Handler/Docs.pm
@@ -82,7 +82,7 @@ sub page {
my $prev = $rev && $rev > 1 && $self->dbDocGetRev(id => $id, rev => $rev-1)->[0];
$self->htmlRevision('d', $prev, $d,
[ title => 'Title', diff => 1 ],
- [ content => 'Content', diff => qr/\s+/ ],
+ [ content => 'Content', diff => qr/\s+/, short_diff => 1 ],
);
}
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm
index 6d0225e0..1adb726b 100644
--- a/lib/VNDB/Util/CommonHTML.pm
+++ b/lib/VNDB/Util/CommonHTML.pm
@@ -163,6 +163,7 @@ sub htmlHiddenMessage {
# [ shortname, displayname, %options ],
# Where %options:
# diff => 1/0/regex, whether to show a diff on this field, and what to split it with (1 = character-level diff)
+# short_diff=> 1/0, when set, cut off long context in diffs
# serialize => coderef, should convert the field into a readable string, no HTML allowed
# htmlize => same as serialize, but HTML is allowed and this can't be diff'ed
# split => coderef, should return an array of HTML strings that can be diff'ed. (implies diff => 1)
@@ -265,7 +266,7 @@ sub revdiff {
my $a = join($o{join}, @ser1[ $d[$i*2] .. $d[$i*2+2]-1 ]);
my $b = join($o{join}, @ser2[ $d[$i*2+1] .. $d[$i*2+3]-1 ]);
# Reduce context if we have too much
- if($i % 2 == 0 && length($a) > 300) {
+ if($o{short_diff} && $i % 2 == 0 && length($a) > 300) {
my $sep = '<b class="standout">&lt;...&gt;</b>';
my $ctx = 100;
$a = $i == 0 ? $sep.'<br>'.substr $a, -$ctx :