aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Lipavsky <llipavsky@suse.com>2013-06-27 12:59:05 +0100
committerChristopher Baines <mail@cbaines.net>2017-09-15 20:43:44 +0100
commitdfe1a204812eb113021383900056dbe27c2e3f35 (patch)
tree10d17103f28d06dd31ac5cb7d9f3f5c6dd5a3b54
parenta60bdd73fcfffdfc9b4de8bdd3be3a5a2777c8a8 (diff)
downloadikiwiki-dfe1a204812eb113021383900056dbe27c2e3f35.tar
ikiwiki-dfe1a204812eb113021383900056dbe27c2e3f35.tar.gz
add tag support to viewers
-rw-r--r--IkiWiki/Plugin/album.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/album.pm b/IkiWiki/Plugin/album.pm
index 16de8eb97..13c4b4eaf 100644
--- a/IkiWiki/Plugin/album.pm
+++ b/IkiWiki/Plugin/album.pm
@@ -1,7 +1,10 @@
#!/usr/bin/perl
# Copyright © 2009-2011 Simon McVittie <http://smcv.pseudorandom.co.uk/>
+# Copyright © 2013 Lukas Lipavsky <lukas@lipavsky.cz>
+#
# Licensed under the GNU GPL, version 2, or any later version published by the
# Free Software Foundation
+
package IkiWiki::Plugin::album;
use warnings;
@@ -25,6 +28,7 @@ sub import {
IkiWiki::loadplugin("inline");
IkiWiki::loadplugin("trail");
IkiWiki::loadplugin("transient");
+ IkiWiki::loadplugin("tag");
}
sub getsetup () {
@@ -61,6 +65,7 @@ sub getsetup () {
# sort - as for inline
# sections - ref to array of pagespecs representing sections
# viewers - list of viewers' names
+# tags - list of tags that should be added to viewers
#
# Page state for image viewers:
#
@@ -288,6 +293,7 @@ sub preprocess_album {
my $album = $params{page};
my @viewers = scan_images($album);
+ my $tags = defined($params{tag}) ? $params{tag} : "";
# placeholder for the "remaining images" section
push @{$pagestate{$album}{album}{sections}}, ""
@@ -302,6 +308,7 @@ sub preprocess_album {
nexttemplate => $params{nexttemplate},
prevtemplate => $params{prevtemplate},
viewers => [@viewers],
+ tags => [split(' ', $tags)],
# in the render phase, we want to keep the sections that we
# accumulated during the scan phase, if any
sections => $pagestate{$album}{album}{sections},
@@ -456,6 +463,13 @@ sub preprocess_albumimage {
$img = htmllink($viewer, $params{destpage}, "/$image");
}
+ # Tags (always return "")
+ IkiWiki::Plugin::tag::preprocess_tag(
+ page => $viewer,
+ destpage => $params{destpage},
+ map { ($_ => 1) } @{$pagestate{$album}{album}{tags}},
+ );
+
my $viewertemplate = template(
$pagestate{$album}{album}{viewertemplate} or
'albumviewer.tmpl');