<%@ sitemap/functions.pl %> <%@ lib/stdlib.pl %> <%@ lib/browser.pl %> <% my $parent_document = $document; %> <% my $parent_align = $parent_document->Align; my $menu_align = ($parent_align eq 'left') ? 'right' : 'left'; %> <%-- This is the tricky bit in this template: because sitemap has got a tree structure, it needs to be processed recursively (well, could use a stack...) --%> <% sub print_recurse { my $document = shift; my $document_URI = $document->URI; my $document_Title = $document->Title; my @children = $document->Children; if (not defined $document->{Parent_ID}) { print_root ($document, @children); } elsif (@children) { if (sitemap_is_expanded ($document)) { print_expanded ($document, @children); } else { print_folded ($document); } } else { print_leaf ($document); } } %> <% sub print_leaf { my $document = shift; %>
  • • <%= encode_html ($document->Title) %>
  • <% } %> <% sub print_folded { my $document = shift; %>
  • + <%= encode_html ($document->Title) %>
  • <% } %> <% sub print_root { my $document = shift; my @children = @_; %>
  • • <%= encode_html ($document->Title) %>
  • <% } %> <% sub print_expanded { my $document = shift; my @children = @_; %>
  • - <%= encode_html ($document->Title) %>
  • <% } %> <%* foreach ($document->Ancestors) %><%= encode_html ($_->Title) %> : <%* end-foreach %> <%= encode_html ($document->Title) %> : [[Sitemap]]

    MKDoc

    [[Sitemap]]

    [[You can expand and fold branches of the sitemap by using the plus [+] and minus [-] links.]]

      <% print_recurse ($root_document) %>