ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/doclet.ext
Revision: 1.2
Committed: Wed Nov 21 10:28:52 2012 UTC (11 years, 6 months ago) by root
Branch: MAIN
Changes since 1.1: +1 -1 lines
Log Message:
avoid misparsing pod as comment

File Contents

# Content
1 #! perl # mandatory
2
3 # implements the doclet exti request, to serve cfhtml strings
4
5 our %DOCLET; # $DOCLET{category} = $cb
6
7 sub register($$) {
8 my ($category, $cb) = @_;
9 $DOCLET{$category} = $cb;
10 Guard::guard { delete $DOCLET{$category} }
11 }
12
13 cf::register_async_exticmd doclet => sub {
14 my ($ns, $reply, $category, $entry) = @_;
15
16 cf::async {
17 my $cfpod;
18
19 if (my $pl = $ns->pl) {
20
21 if (my $cb = $DOCLET{$category}) {
22 $cfpod = $cb->($pl, $category, $entry);
23 } else {
24 $cfpod = "No documentation found for $category/$entry.";
25 }
26
27 $cfpod = $pl->expand_cfpod ($cfpod);
28 } else {
29 $cfpod = "(documentation not available before login)";
30 }
31
32 $reply->($cfpod);
33 };
34 };
35