… | |
… | |
38 | |
38 | |
39 | return 1 unless @path; |
39 | return 1 unless @path; |
40 | |
40 | |
41 | my $kw = lc pop @path; |
41 | my $kw = lc pop @path; |
42 | |
42 | |
43 | $node = $node->{parent} |
43 | $node = $node->[N_PARENT] |
44 | or return 0; |
44 | or return 0; |
45 | |
45 | |
46 | return scalar grep $_ eq $kw, @{ $node->{kw} }; |
46 | return scalar grep $_ eq $kw, @{ $node->[N_KW] }; |
47 | } |
47 | } |
48 | |
48 | |
49 | sub find(@) { |
49 | sub find(@) { |
50 | my (@path) = @_; |
50 | my (@path) = @_; |
51 | |
51 | |
… | |
… | |
65 | my ($node) = @_; |
65 | my ($node) = @_; |
66 | |
66 | |
67 | my @path; |
67 | my @path; |
68 | |
68 | |
69 | # skip toplevel hierarchy pod/, because its not a document |
69 | # skip toplevel hierarchy pod/, because its not a document |
70 | while ($node->{parent}) { |
70 | while ($node->[N_PARENT]) { |
71 | unshift @path, $node; |
71 | unshift @path, $node; |
72 | $node = $node->{parent}; |
72 | $node = $node->[N_PARENT]; |
73 | } |
73 | } |
74 | |
74 | |
75 | @path |
75 | @path |
76 | } |
76 | } |
77 | |
77 | |
78 | sub full_path($) { |
78 | sub full_path($) { |
79 | join "/", map $_->{kw}[0], &full_path_of |
79 | join "/", map $_->[N_KW][0], &full_path_of |
80 | } |
80 | } |
81 | |
81 | |
82 | sub section_of($) { |
82 | sub section_of($) { |
83 | my ($node) = @_; |
83 | my ($node) = @_; |
84 | |
84 | |
85 | my $doc = $node->{doc}; |
85 | my $doc = $node->[N_DOC]; |
86 | my $par = $node->{par}; |
86 | my $par = $node->[N_PAR]; |
87 | my $lvl = $node->{level}; |
87 | my $lvl = $node->[N_LEVEL]; |
88 | |
88 | |
89 | my @res; |
89 | my @res; |
90 | |
90 | |
91 | do { |
91 | do { |
92 | my $p = $doc->[$par]; |
92 | my $p = $doc->[$par]; |