2 # This file is une extension à IkiWiki
3 # permettant d’ajouter des actions aux pages.
4 # Copyright (C) 2010 Julien Moutinho
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published
8 # by the Free Software Foundation, either version 3 of the License,
9 # or any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty
13 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 # See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package IkiWiki
::Plugin
::action
;
24 ( type
=> "preprocess"
26 , call
=> \
&hook_preprocess_action
);
28 ( type
=> "pageactions"
30 , call
=> \
&hook_preprocess_pageactions
);
33 sub hook_preprocess_pageactions
(@
) {
35 my $page = $env{page
};
37 if (defined $page and exists $map{$page}) {
38 foreach (@
{$map{$page}}) {
44 sub hook_preprocess_action
(@
) {
46 my $page = $env{page
};
47 if (exists $env{html
} and defined $env{html
}) {
48 if (length $env{html
}) {
50 if not defined $map{$page};
51 push @
{$map{$page}}, "$env{html}";