]> oss.titaniummirror.com Git - webber.git/blobdiff - in/hierarchy.md
webber: allow relative paths in cfg.exclude_files
[webber.git] / in / hierarchy.md
index 15b47a9567a2cbababda299883b80729b81a0876..cace9622d50c4cd0492d581e47187ab4eb5cbe4f 100644 (file)
@@ -77,23 +77,23 @@ page itself.
 
 = Generation of breadcrumbs =
 
-This is done via a suitable [[template_mako]]. The
-template uses the function "`get_breadcrumbs(linktitle)`" and returns
-(linktitle, link) tuples. As a bonus: all the links are always relative to
-the calling page.
+This is done via a suitable [[template_mako]]. The template uses the
+function "`get_breadcrumbs()`" and returns (linktitle, link) tuples. As a
+bonus: all the links are always relative to the calling page.
 
 Here's a sample Mako template excerpt:
 
        <ul>\
-       % for linktitle, link in get_breadcrumbs(file.linktitle):
-       <li><a href="${link}">${linktitle}</a></li>\
+       % for page, link in get_breadcrumbs():
+       <li><a href="${link}">${page.linktitle}</a></li>\
        % endfor
        </ul>\
 
+
 = Generation of a side-menu =
 
 This again is done via a suitable [[template_mako]]. The
-template uses the function "`get_sidemenu(linktitle)`" and returns (level,
+template uses the function "`get_sidemenu()`" and returns (level,
 part_of_path, is_current, title, link) tuples. Again all links are relative
 to the calling page.
 
@@ -108,12 +108,12 @@ to the calling page.
 Here's a sample Mako template excerpt that converts this into a HTML menu:
 
        <ul id="sidebar">
-       % for level, part_of_path, current, title, link in get_sidemenu(file.linktitle):
+       % for level, part_of_path, current, page, link in get_sidemenu():
        <li class="sidebar${level}"\
        %    if current:
-        id="sidebar_current">${title | entity}</li>
+        id="sidebar_current">${page.linktitle | entity}</li>
        %    else:
-       ><a href="${link}">${title | entity}</a></li>
+       ><a href="${link}">${page.linktitle | entity}</a></li>
        %    endif
        % endfor
        </ul>
@@ -123,16 +123,55 @@ Here's a sample Mako template excerpt that converts this into a HTML menu:
 To get a list of recently changed pages, do this:
 
        <%
-         history = get_recently(get_current_file())
+         history = get_recently())
        %>
        % if len(history)>1:
        <h2>Recent changed</h2>
-       %   for mtime,ctime,title,link in history:
-       %     if mtime > ctime:
-               Modified ${format_date(mtime)}\
+       %   for page, link in history:
+       %     if page.mtime > page.ctime:
+               Modified ${format_date(page.mtime)}\
        %     else:
-               Created ${format_date(ctime)}\
+               Created ${format_date(page.ctime)}\
        %     endif
-       : <a href="${link}">${title | entity}</a><br />
+       : <a href="${link}">${page.title | entity}</a><br />
        %   endfor
        % endif
+
+
+= Generate a sitemap =
+
+To generate a site map for your whole project, do something like
+this:
+
+       <%
+         site = get_sitemap()
+       %>
+       <ul>
+       % for level, page, link in site:
+       <li id="sidemap${level}"><a href="${link}">${page.title}</a></li>
+       % endfor
+       </ul>
+
+Now you'd need to use CSS to indent the entries. If you prefer a more
+normal "`<ul>..<li><ul><li></li></ul>..</il>`" style, you'd could do this
+with some more advanced Mako template magic:
+
+       <%
+         site = get_sitemap()
+         lvl = -1
+       %>
+       % for level, page, link in site:
+       ### Adjust level by indenting/detenting via <ul> or </ul>:
+       %   while lvl < level:
+       <ul><% lvl += 1 %>
+       %   endwhile
+       %   while lvl > level:
+       </ul><% lvl -= 1 %>
+       %   endwhile
+       ### Print out the <li>
+       <li id="sidemap${level}"><a href="${link}">${page.title}</a></li>
+       % endfor
+       ### At the end of the sitemap, detent back to level -1
+       % while lvl >= 0:
+       </ul><% lvl -= 1 %>
+       % endwhile