--- deliantra/Deliantra-Client/DC/Pod.pm 2006/08/13 19:47:05 1.8 +++ deliantra/Deliantra-Client/DC/Pod.pm 2006/08/13 21:46:10 1.9 @@ -7,7 +7,7 @@ our $VERSION = 1; -our $on_link = sub { }; +our $goto_document = sub { }; our %wiki; my $MA_BEG = "\x{fcd0}"; @@ -16,6 +16,10 @@ *wiki = Storable::retrieve CFPlus::find_rcfile "docwiki.pst"; +sub goto_document($) { + $goto_document->(split /\//, $_[0]); +} + sub is_prefix_of($@) { my ($node, @path) = @_; @@ -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($) { @@ -138,8 +152,9 @@ 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}"