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.18 by root, Tue Mar 25 01:46:36 2008 UTC vs.
Revision 1.21 by root, Sun Mar 30 10:18:16 2008 UTC

25sub P_INDENT (){ 0 } 25sub P_INDENT (){ 0 }
26sub P_LEVEL (){ 1 } 26sub P_LEVEL (){ 1 }
27sub P_MARKUP (){ 2 } 27sub P_MARKUP (){ 2 }
28sub P_INDEX (){ 3 } 28sub P_INDEX (){ 3 }
29 29
30*wiki = Storable::retrieve DC::find_rcfile "docwiki.pst"; 30our %wiki;
31
32sub load_docwiki {
33 *wiki = Storable::retrieve $_[0];
34}
31 35
32sub goto_document($) { 36sub goto_document($) {
33 $goto_document->(split /\//, $_[0]); 37 $goto_document->(split /\//, $_[0]);
34} 38}
35 39
38 42
39 return 1 unless @path; 43 return 1 unless @path;
40 44
41 my $kw = lc pop @path; 45 my $kw = lc pop @path;
42 46
43 $node = $node->{parent} 47 $node = $node->[N_PARENT]
44 or return 0; 48 or return 0;
45 49
50 #TODO: maybe get rid of lowercasing?
46 return scalar grep $_ eq $kw, @{ $node->{kw} }; 51 return scalar grep lc eq $kw, @{ $node->[N_KW] };
47} 52}
48 53
49sub find(@) { 54sub find(@) {
50 my (@path) = @_; 55 my (@path) = @_;
51 56
65 my ($node) = @_; 70 my ($node) = @_;
66 71
67 my @path; 72 my @path;
68 73
69 # skip toplevel hierarchy pod/, because its not a document 74 # skip toplevel hierarchy pod/, because its not a document
70 while ($node->{parent}) { 75 while ($node->[N_PARENT]) {
71 unshift @path, $node; 76 unshift @path, $node;
72 $node = $node->{parent}; 77 $node = $node->[N_PARENT];
73 } 78 }
74 79
75 @path 80 @path
76} 81}
77 82
78sub full_path($) { 83sub full_path($) {
79 join "/", map $_->{kw}[0], &full_path_of 84 join "/", map $_->[N_KW][0], &full_path_of
80} 85}
81 86
82sub section_of($) { 87sub section_of($) {
83 my ($node) = @_; 88 my ($node) = @_;
84 89
85 my $doc = $node->{doc}; 90 my $doc = $node->[N_DOC];
86 my $par = $node->{par}; 91 my $par = $node->[N_PAR];
87 my $lvl = $node->{level}; 92 my $lvl = $node->[N_LEVEL];
88 93
89 my @res; 94 my @res;
90 95
91 do { 96 do {
92 my $p = $doc->[$par]; 97 my $p = $doc->[$par];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines