ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Pod.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Pod.pm (file contents):
Revision 1.13 by root, Mon Aug 14 19:17:09 2006 UTC vs.
Revision 1.17 by root, Wed Dec 26 21:03:21 2007 UTC

1package CFPlus::Pod; 1package DC::Pod;
2 2
3use strict; 3use strict;
4use utf8; 4use utf8;
5 5
6use Storable; 6use Storable;
7 7
8our $VERSION = 1; 8our $VERSION = 1.03;
9 9
10our $goto_document = sub { }; 10our $goto_document = sub { };
11our %wiki; 11our %wiki;
12 12
13my $MA_BEG = "\x{fcd0}"; 13my $MA_BEG = "\x{fcd0}";
14my $MA_SEP = "\x{fcd1}"; 14my $MA_SEP = "\x{fcd1}";
15my $MA_END = "\x{fcd2}"; 15my $MA_END = "\x{fcd2}";
16 16
17*wiki = Storable::retrieve CFPlus::find_rcfile "docwiki.pst"; 17*wiki = Storable::retrieve DC::find_rcfile "docwiki.pst";
18 18
19sub goto_document($) { 19sub goto_document($) {
20 $goto_document->(split /\//, $_[0]); 20 $goto_document->(split /\//, $_[0]);
21} 21}
22 22
43 # TODO: make sure results are unique 43 # TODO: make sure results are unique
44 44
45 grep { is_prefix_of $_, @path } 45 grep { is_prefix_of $_, @path }
46 map @$_, 46 map @$_,
47 $kw eq "*" ? @wiki{sort keys %wiki} 47 $kw eq "*" ? @wiki{sort keys %wiki}
48 : grep $_, $wiki{$kw} 48 : $wiki{$kw} || ()
49} 49}
50 50
51sub full_path_of($) { 51sub full_path_of($) {
52 my ($node) = @_; 52 my ($node) = @_;
53 53
114 "<small>img</small>" 114 "<small>img</small>"
115 }, 115 },
116 link => sub { 116 link => sub {
117 my ($par, $text, $link) = @_; 117 my ($par, $text, $link) = @_;
118 118
119 "<span foreground='#ffff00'>↺</span><span foreground='#c0c0ff' underline='single'>" . (CFPlus::asxml $text) . "</span>" 119 "<span foreground='#ffff00'>↺</span><span foreground='#c0c0ff' underline='single'>" . (DC::asxml $text) . "</span>"
120 }, 120 },
121); 121);
122 122
123sub as_label(@) { 123sub as_label(@) {
124 thaw_section @_, %as_label; 124 thaw_section @_, %as_label;
136 136
137my %as_paragraphs = ( 137my %as_paragraphs = (
138 image => sub { 138 image => sub {
139 my ($par, $path, $flags) = @_; 139 my ($par, $path, $flags) = @_;
140 140
141 push @{ $par->{widget} }, new CFPlus::UI::Image path => $path, 141 push @{ $par->{widget} }, new DC::UI::Image path => $path,
142 $flags & 1 ? (max_h => $::FONTSIZE) : (); 142 $flags & 1 ? (max_h => $::FONTSIZE) : ();
143 143
144 "\x{fffc}" 144 "\x{fffc}"
145 }, 145 },
146 link => sub { 146 link => sub {
147 my ($par, $text, $link) = @_; 147 my ($par, $text, $link) = @_;
148 148
149 push @{ $par->{widget} }, new CFPlus::UI::Label 149 push @{ $par->{widget} }, new DC::UI::Label
150 markup => "<span foreground='#ffff00'>↺</span><span foreground='#c0c0ff' underline='single'>" . (CFPlus::asxml $text) . "</span>", 150 markup => "<span foreground='#ffff00'>↺</span><span foreground='#c0c0ff' underline='single'>" . (DC::asxml $text) . "</span>",
151 fontsize => 0.8, 151 fontsize => 0.8,
152 can_hover => 1, 152 can_hover => 1,
153 can_events => 1, 153 can_events => 1,
154 padding_x => 0, 154 padding_x => 0,
155 padding_y => 0, 155 padding_y => 0,
156 tooltip => "Go to <i>" . (CFPlus::asxml $link) . "</i>", 156 tooltip => "Go to <i>" . (DC::asxml $link) . "</i>",
157 on_button_up => sub { 157 on_button_up => sub {
158 goto_document $link; 158 goto_document $link;
159 }; 159 };
160 160
161 "\x{fffc}" 161 "\x{fffc}"

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines