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.7 by root, Sun Aug 13 18:48:56 2006 UTC vs.
Revision 1.9 by root, Sun Aug 13 21:46:10 2006 UTC

1package CFPlus::Pod; 1package CFPlus::Pod;
2 2
3use strict; 3use strict;
4use utf8;
4 5
5use Storable; 6use Storable;
6 7
7our $VERSION = 1; 8our $VERSION = 1;
8 9
10our $goto_document = sub { };
9our %wiki; 11our %wiki;
10 12
11my $MA_BEG = "\x{fcd0}"; 13my $MA_BEG = "\x{fcd0}";
12my $MA_SEP = "\x{fcd1}"; 14my $MA_SEP = "\x{fcd1}";
13my $MA_END = "\x{fcd2}"; 15my $MA_END = "\x{fcd2}";
14 16
15*wiki = Storable::retrieve CFPlus::find_rcfile "docwiki.pst"; 17*wiki = Storable::retrieve CFPlus::find_rcfile "docwiki.pst";
18
19sub goto_document($) {
20 $goto_document->(split /\//, $_[0]);
21}
16 22
17sub is_prefix_of($@) { 23sub is_prefix_of($@) {
18 my ($node, @path) = @_; 24 my ($node, @path) = @_;
19 25
20 return 1 unless @path; 26 return 1 unless @path;
43} 49}
44 50
45sub full_path_of($) { 51sub full_path_of($) {
46 my ($node) = @_; 52 my ($node) = @_;
47 53
48 my $path = $node->{kw}[0]; 54 my @path;
49 $path = "$node->{kw}[0]/$path" while $node = $node->{parent}; 55
56 # skip toplevel hierarchy pod/, because its not a document
57 while ($node->{parent}) {
58 unshift @path, $node;
59 $node = $node->{parent};
60 }
61
50 $path 62 @path
63}
64
65sub full_path($) {
66 join "/", map $_->{kw}[0], &full_path_of
51} 67}
52 68
53sub section_of($) { 69sub section_of($) {
54 my ($node) = @_; 70 my ($node) = @_;
55 71
96 my ($par, $path) = @_; 112 my ($par, $path) = @_;
97 113
98 "<small>img</small>" 114 "<small>img</small>"
99 }, 115 },
100 link => sub { 116 link => sub {
101 my ($par, $link) = @_; 117 my ($par, $text, $link) = @_;
102 118
103 "<big>" . (CFPlus::asxml $link) . "</big>" 119 "<span foreground='#ffff00'>↺</span><span foreground='#c0c0ff' underline='single'>" . (CFPlus::asxml $text) . "</span>"
104 }, 120 },
105); 121);
106 122
107sub as_label(@) { 123sub as_label(@) {
108 thaw_section @_, %as_label; 124 thaw_section @_, %as_label;
122 image => sub { 138 image => sub {
123 my ($par, $path) = @_; 139 my ($par, $path) = @_;
124 140
125 push @{ $par->{widget} }, new CFPlus::UI::Image path => $path; 141 push @{ $par->{widget} }, new CFPlus::UI::Image path => $path;
126 142
127 "\x{FFFC}" 143 "\x{fffc}"
128 }, 144 },
129 link => sub { 145 link => sub {
130 my ($par, $link) = @_; 146 my ($par, $text, $link) = @_;
131 147
148 push @{ $par->{widget} }, new CFPlus::UI::Label
149 markup => "<span foreground='#ffff00'>↺</span><span foreground='#c0c0ff' underline='single'>" . (CFPlus::asxml $text) . "</span>",
150 size => 0.8,
151 can_hover => 1,
152 can_events => 1,
153 padding_x => 0,
154 padding_y => 0,
132 "<big>" . (CFPlus::asxml $link) . "</big>" 155 tooltip => "Go to <i>" . (CFPlus::asxml $link) . "</i>",
156 on_button_up => sub {
157 goto_document $link;
158 };
159
160 "\x{fffc}"
133 }, 161 },
134); 162);
135 163
136sub as_paragraphs(@) { 164sub as_paragraphs(@) {
137 thaw_section @_, %as_paragraphs; 165 thaw_section @_, %as_paragraphs;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines