{% extends "static_map.html" %}
{%- macro print_type_classes(type, marked) -%}
  {%- set classes = [] -%}
  {%- if type -%}
    {%- set _ = classes.append('scrapbook-type-' + type) -%}
  {%- endif -%}
  {%- if marked -%}
    {%- set _ = classes.append('scrapbook-type-marked') -%}
  {%- endif -%}
  {{ print_attr('class', classes | join(' ')) }}
{%- endmacro -%}
{%- macro print_attr(attr, value, prefix=' ') -%}
  {%- if value -%}
    {{ prefix + attr }}="{{ value }}"
  {%- endif -%}
{%- endmacro -%}
{% block static_index -%}
<div id="item-root">
{%- set indent = '  ' -%}
{%- for item in static_index -%}
  {%- set event, level, id, type, marked, title, url, icon, source, comment = item -%}
  {%- if event == 'start-container' %}
{{ indent * level }}<ul class="scrapbook-container">
  {%- elif event == 'end-container' %}
{{ indent * level }}</ul>
  {%- elif event == 'start' %}
{{ indent * level }}<li{{ print_attr('id', 'item-' + id) }}{{ print_type_classes(type, marked) }}>
{{ indent * (level + 1) }}<div>
    {%- if type != 'separator' -%}
      {%- if not icon -%}
        {%- set icon = default_icons.get(type, default_icons['']) -%}
      {%- endif -%}
<a{{ print_attr('href', url) }}><img{{ print_attr('src', icon) }} alt="">{{ title }}</a>
      {%- if type != 'bookmark' and source -%}
<a title="{{ i18n('cache_index_source_link_title') }}" class="scrapbook-external" target="_blank" href="{{ source }}"><img src="icon/external.png" alt=""></a>
      {%- endif -%}
    {%- else -%}
<fieldset><legend>&nbsp;{{ title }}&nbsp;</legend></fieldset>
    {%- endif -%}
</div>
  {%- elif event == 'end' %}
{{ indent * level }}</li>
  {%- endif -%}
{%- endfor %}
</div>
{% endblock %}