ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/help.ext
(Generate patch)

Comparing deliantra/server/ext/help.ext (file contents):
Revision 1.5 by root, Thu Apr 19 21:57:19 2007 UTC vs.
Revision 1.11 by root, Sun Apr 6 17:08:51 2008 UTC

10 10
11 my @topics; 11 my @topics;
12 my $level = 1e9; 12 my $level = 1e9;
13 13
14 for my $par (@$paragraphs) { 14 for my $par (@$paragraphs) {
15 Coro::cede; 15 cf::cede_to_tick;
16 if ($par->{type} eq "head2") { 16 if ($par->{type} eq "head2") {
17 if ($par->{markup} =~ /^(\S+)/) { 17 if ($par->{markup} =~ /^(\S+)/) {
18 push @topics, $1 => [$type => $par]; 18 push @topics, $1 => [$type => $par];
19 $level = $par->{level}; 19 $level = $par->{level};
20 } 20 }
36} 36}
37 37
38cf::sync_job { 38cf::sync_job {
39 my $guard = cf::lock_acquire "ext::help::loading"; 39 my $guard = cf::lock_acquire "ext::help::loading";
40 cf::async_ext { 40 cf::async_ext {
41 $Coro::current->{desc} = "help loader";
41 reload; 42 reload;
42 undef $guard; 43 undef $guard;
43 }; 44 };
44}; 45};
46
47# for lack of a better place: "media tags"
48# b bold
49# i italic
50# ul underlined
51# fixed font
52# arcane font
53# hand font
54# strange font
55# print font (default)
56# color=xxx
45 57
46cf::register_command help => sub { 58cf::register_command help => sub {
47 my ($pl, $topic) = @_; 59 my ($pl, $topic) = @_;
48 60
49 if (cf::lock_active "ext::help::loading") { 61 if (cf::lock_active "ext::help::loading") {
61 push @{$topics{$v->[0]}}, $k; 73 push @{$topics{$v->[0]}}, $k;
62 } 74 }
63 75
64 my $res; 76 my $res;
65 while (my ($k, $v) = each %topics) { 77 while (my ($k, $v) = each %topics) {
66 $res .= "[b]$k:[/b]\n" . (join " ", sort @$v) . "\n\n"; 78 $res .= "B<$k:>\n" . (join " ", sort @$v) . "\n\n";
67 } 79 }
68 80
69 $pl->reply (undef, $res); 81 $pl->reply (undef, $res);
70 82
71 } elsif (my $topic = $TOPIC->{$topic}) { 83 } elsif (my $item = $TOPIC->{$topic}) {
72 my ($type, @pars) = @$topic; 84 my ($type, @pars) = @$item;
73 $pl->reply (undef, cf::pod::as_text \@pars); 85 $pl->reply (undef, cf::pod::as_cfpod \@pars);
74 86
75 } else { 87 } else {
76 $pl->reply (undef, "'$topic' no such help topic, try just 'help' to get a list of topics."); 88 $pl->reply (undef, "'$topic' no such help topic, try just 'help' to get a list of topics.");
77 } 89 }
78}; 90};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines