--- deliantra/Deliantra-Client/DC/Pod.pm 2006/08/13 19:47:05 1.8
+++ deliantra/Deliantra-Client/DC/Pod.pm 2006/08/14 03:04:18 1.11
@@ -7,7 +7,7 @@
our $VERSION = 1;
-our $on_link = sub { };
+our $goto_document = sub { };
our %wiki;
my $MA_BEG = "\x{fcd0}";
@@ -16,12 +16,16 @@
*wiki = Storable::retrieve CFPlus::find_rcfile "docwiki.pst";
+sub goto_document($) {
+ $goto_document->(split /\//, $_[0]);
+}
+
sub is_prefix_of($@) {
my ($node, @path) = @_;
return 1 unless @path;
- my $kw = pop @path;
+ my $kw = lc pop @path;
$node = $node->{parent}
or return 0;
@@ -34,7 +38,7 @@
return unless @path;
- my $kw = pop @path;
+ my $kw = lc pop @path;
# TODO: make sure results are unique
@@ -47,9 +51,19 @@
sub full_path_of($) {
my ($node) = @_;
- my $path = $node->{kw}[0];
- $path = "$node->{kw}[0]/$path" while $node = $node->{parent};
- $path
+ my @path;
+
+ # skip toplevel hierarchy pod/, because its not a document
+ while ($node->{parent}) {
+ unshift @path, $node;
+ $node = $node->{parent};
+ }
+
+ @path
+}
+
+sub full_path($) {
+ join "/", map $_->{kw}[0], &full_path_of
}
sub section_of($) {
@@ -133,13 +147,14 @@
push @{ $par->{widget} }, new CFPlus::UI::Label
markup => "↺" . (CFPlus::asxml $text) . "",
- size => 0.8,
+ fontsize => 0.8,
can_hover => 1,
can_events => 1,
padding_x => 0,
padding_y => 0,
+ tooltip => "Go to " . (CFPlus::asxml $link) . "",
on_button_up => sub {
- $on_link->(split /\//, $link);
+ goto_document $link;
};
"\x{fffc}"