<tal:block
  define="
    node request/node;
    
    model request/ghost_model | request/model;
    toc_depth python: int(test(node.hasAttribute('toc_depth'), node.getAttribute('toc_depth'), -1));
    public options/public | nothing;
    title_method python: test(public, 'get_title_or_id', 'get_title_editable');
    tree python: here.get_tree(model=model, toc_depth=toc_depth, public=public);
    
    append_to_url options/append_to_url | string:edit/tab_edit;
    " >

  <p class="toc">
    <tal:block repeat="obj tree">
      <tal:block
        tal:define="
          indent python:obj[0]; 
          item python:obj[1];
          title python:getattr(obj[1], title_method)();
          url string:${item/absolute_url}/${append_to_url}"
        tal:condition="python:not (hasattr(item, 'hide_from_tocs') and item.hide_from_tocs)"
        >
        <img 
          width="12" 
          height="14"
          alt=""
          tal:condition="python:indent > 0"
          tal:attributes="
            width python:indent * 24;
            src string:${here/silva_root}/globals/pixel.gif" />
          <a class="toc-link"
            href="edit"
            tal:attributes="href url"
            tal:content="title">
            title
          </a>
          <br />
      </tal:block>
    </tal:block>
  </p>
</tal:block>
