summaryrefslogtreecommitdiff
path: root/lib/VNDB/Func.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-11-15 11:51:58 +0100
committerYorhel <git@yorhel.nl>2008-11-15 11:51:58 +0100
commitdb820616d0f5c7f49e725987b6cd900944e4ffd0 (patch)
tree1c1763eaf527a70b84b5a67a0ba6ccc32ef6ff93 /lib/VNDB/Func.pm
parentdbaba80b10273270a16e91118fa12e081d4707f7 (diff)
Wrote revision and diff viewer
Character-level diffs instead of the old word-level diffs. Still only works on plaintext, though. Not really sure about the style, either.
Diffstat (limited to 'lib/VNDB/Func.pm')
-rw-r--r--lib/VNDB/Func.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm
index bc6cbc87..ef18c837 100644
--- a/lib/VNDB/Func.pm
+++ b/lib/VNDB/Func.pm
@@ -15,11 +15,13 @@ sub shorten {
}
-# argument: unix timestamp
+# argument: unix timestamp and optional format (compact/full)
# return value: yyyy-mm-dd
# (maybe an idea to use cgit-style ages for recent timestamps)
sub date {
- return strftime '%Y-%m-%d', gmtime shift;
+ my($t, $f) = @_;
+ return strftime '%Y-%m-%d', gmtime $t if !$f || $f eq 'compact';
+ return strftime '%Y-%m-%d at %R', gmtime $t;
}
@@ -56,7 +58,7 @@ sub bb2html {
my $raw = shift;
my $maxlength = shift;
$raw =~ s/\r//g;
- return '' if !$raw && $raw != 0;
+ return '' if !$raw && $raw ne "0";
my($result, $length, @open) = ('', 0, 'first');