diff options
author | Lukas Lipavsky <llipavsky@suse.com> | 2013-06-27 12:59:05 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-05-14 19:07:21 +0100 |
commit | a89b9de0ef5d4f5eeb2929d91b56d28c006a07a8 (patch) | |
tree | 444b92cf1fea5fb9373b128fc63b6d96930306cb | |
parent | b1662673d5df8b4474109dbcbe6a84262c81076f (diff) | |
download | ikiwiki-a89b9de0ef5d4f5eeb2929d91b56d28c006a07a8.tar ikiwiki-a89b9de0ef5d4f5eeb2929d91b56d28c006a07a8.tar.gz |
add tag support to viewers
-rw-r--r-- | IkiWiki/Plugin/album.pm | 14 |
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'); |