line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Wiki::Simple::Plugin::NodeList; |
2
|
1
|
|
|
1
|
|
1695
|
use CGI::Wiki::Simple::Plugin(); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use HTML::Entities; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use vars qw($VERSION); |
6
|
|
|
|
|
|
|
$VERSION = 0.09; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
CGI::Wiki::Simple::Plugin::NodeList - Node that lists all existing nodes on a wiki |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
This node lists all nodes in your wiki. Think of it as the master index to your wiki. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=for example begin |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use CGI::Wiki::Simple; |
21
|
|
|
|
|
|
|
use CGI::Wiki::Simple::Plugin::NodeList( name => 'AllNodes' ); |
22
|
|
|
|
|
|
|
# nothing else is needed |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use CGI::Wiki::Simple::Plugin::NodeList( name => 'AllCategories', re => qr/^Category:(.*)$/ ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=for example end |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
use vars qw(%re); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub import { |
33
|
|
|
|
|
|
|
my ($module,%args) = @_; |
34
|
|
|
|
|
|
|
my $node = $args{name}; |
35
|
|
|
|
|
|
|
$re{$node} = $args{re} || '^(.*)$'; |
36
|
|
|
|
|
|
|
CGI::Wiki::Simple::Plugin::register_nodes(module => $module, name => $node); |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub retrieve_node { |
40
|
|
|
|
|
|
|
my (%args) = @_; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $node = $args{name}; |
43
|
|
|
|
|
|
|
my $re = $re{$node}; |
44
|
|
|
|
|
|
|
my %nodes = map { /$re/ ? ($_ => $1) : () } ($args{wiki}->list_all_nodes, keys %CGI::Wiki::Simple::magic_node); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
return ( |
47
|
|
|
|
|
|
|
" |
48
|
|
|
|
|
|
|
join ("\n", map { "" . $args{wiki}->inside_link( node => $_, title => $nodes{$_} ) . "" } |
49
|
|
|
|
|
|
|
sort { uc($nodes{$a}) cmp uc($nodes{$b}) } |
50
|
|
|
|
|
|
|
keys %nodes) |
51
|
|
|
|
|
|
|
. "",0,""); |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |