summaryrefslogtreecommitdiff
path: root/lib/VNDB/Util
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VNDB/Util')
-rw-r--r--lib/VNDB/Util/CommonHTML.pm9
-rw-r--r--lib/VNDB/Util/LayoutHTML.pm6
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm
index a862911d..280ceddb 100644
--- a/lib/VNDB/Util/CommonHTML.pm
+++ b/lib/VNDB/Util/CommonHTML.pm
@@ -153,7 +153,7 @@ sub htmlHiddenMessage {
# Where @fields is a list of fields as arrayrefs with:
# [ shortname, displayname, %options ],
# Where %options:
-# diff => 1/0, whether do show a diff on this field
+# diff => 1/0/regex, whether to show a diff on this field, and what to split it with (1 = character-level diff)
# 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)
@@ -226,7 +226,7 @@ sub revdiff {
my($i, $type, $old, $new, $short, %o) = @_;
$o{serialize} ||= $o{htmlize};
- $o{diff}++ if $o{split};
+ $o{diff} = 1 if $o{split};
$o{join} ||= '';
my $ser1 = $o{serialize} ? $o{serialize}->($old->{$short}, $old) : $old->{$short};
@@ -234,8 +234,9 @@ sub revdiff {
return if $ser1 eq $ser2;
if($o{diff} && $ser1 && $ser2) {
- my @ser1 = $o{split} ? $o{split}->($ser1) : map xml_escape($_), split //, $ser1;
- my @ser2 = $o{split} ? $o{split}->($ser2) : map xml_escape($_), split //, $ser2;
+ my $sep = ref $o{diff} ? qr/($o{diff})/ : qr//;
+ my @ser1 = $o{split} ? $o{split}->($ser1) : map xml_escape($_), split $sep, $ser1;
+ my @ser2 = $o{split} ? $o{split}->($ser2) : map xml_escape($_), split $sep, $ser2;
return if $o{split} && $#ser1 == $#ser2 && !grep $ser1[$_] ne $ser2[$_], 0..$#ser1;
$ser1 = $ser2 = '';
diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm
index 93a35e0e..b5dc3e9c 100644
--- a/lib/VNDB/Util/LayoutHTML.pm
+++ b/lib/VNDB/Util/LayoutHTML.pm
@@ -10,7 +10,7 @@ use VNDB::Func;
our @EXPORT = qw|htmlHeader htmlFooter|;
-sub htmlHeader { # %options->{ title, noindex, search }
+sub htmlHeader { # %options->{ title, noindex, search, feeds }
my($self, %o) = @_;
my $skin = $self->reqParam('skin') || $self->authInfo->{skin} || $self->{skin_default};
$skin = $self->{skin_default} if !$self->{skins}{$skin} || !-d "$VNDB::ROOT/static/s/$skin";
@@ -26,6 +26,8 @@ sub htmlHeader { # %options->{ title, noindex, search }
(my $css = $self->authInfo->{customcss}) =~ s/\n/ /g;
style type => 'text/css', $css;
}
+ Link rel => 'alternate', type => 'application/atom+xml', href => "/feeds/$_.atom", title => $self->{atom_feeds}{$_}[1]
+ for ($o{feeds} ? @{$o{feeds}} : ());
meta name => 'robots', content => 'noindex, follow', undef if $o{noindex};
end;
body;
@@ -153,7 +155,7 @@ sub htmlFooter {
a href => $self->{source_url}, mt '_footer_source';
end;
end; # /div maincontent
- script type => 'text/javascript', src => $self->{url_static}.'/f/script.js?'.$self->{version}, '';
+ script type => 'text/javascript', src => $self->{url_static}.'/f/js/'.$self->{l10n}->language_tag().'.js?'.$self->{version}, '';
end; # /body
end; # /html