{% assign excludexml = site.data.info.excludexml | downcase | slice: 0 %}
{% assign excludejson = site.data.info.excludejson | downcase | slice: 0 %}
{% assign excludettl = site.data.info.excludettl | downcase | slice: 0 %}
{% assign excludemaps = site.data.info.excludemap | downcase | slice: 0 %}
{% assign excludeexamples = site.data.info.excludeexample | downcase | slice: 0 %}
{% assign sd_type = site.data.structuredefinitions.[include.id].type %}
{% assign resource_ = include.type| append: '/'| append: include.id  %}
{% assign has_history = site.data.resources[resource_].['history'] %}
{% assign basepath = include.type | append: '-' | append: include.id | append: '.html' %}
{% assign example_count = site.data.pages[basepath].examples.size %}
{% if site.data.resources[resource_].source contains "#" %}
{% assign contained_resource = 'y' %}
{% endif %}

<ul class="nav nav-tabs">
{% if include.active == 'content' %}
  <li class="active">
    <a href="#">Content</a>
  </li>
{% else %}
  <li>
    <a href="{{include.type}}-{{include.id}}.html">Content</a>
  </li>
{% endif %}

{% if include.active == 'definition' %}
  <li class="active">
    <a href="#">Detailed Descriptions</a>
  </li>
{% else %}
  <li>
    <a href="{{include.type}}-{{include.id}}-definitions.html">Detailed Descriptions</a>
  </li>
{% endif %}

{% unless excludemaps == 'y' %}
  {% if include.active == 'mapping' %}
    <li class="active">
      <a href="#">Mappings</a>
    </li>
  {% else %}
    <li>
      <a href="{{include.type}}-{{include.id}}-mappings.html">Mappings</a>
    </li>
  {% endif %}
{% endunless %}

{% if site.data.resources[resource_].['testplan'] or site.data.resources[resource_].['testscript'] %}
  {% if include.active == 'testing' %}
    <li class="active">
      <a href="#">Testing</a>
    </li>
  {% else %}
    <li>
      <a href="{{include.type}}-{{include.id}}-testing.html">Testing</a>
    </li>
  {% endif %}
{% endif %}

{% unless example_count == 0 %}
{% unless sd_type == 'Extension' %}
  {% unless excludeexamples == 'y' %}
    {% if include.active == 'example' %}
      <li class="active">
        <a href="#">Examples</a>
      </li>
    {% else %}
      <li>
        <a href="{{include.type}}-{{include.id}}-examples.html">Examples</a>
      </li>
    {% endif %}
  {% endunless %}
{% endunless %}
{% endunless %}

{% unless excludexml == 'y' or contained_resource == 'y' %}
  {% if include.active == 'xml' %}
    <li class="active">
      <a href="#">XML</a>
    </li>
  {% else %}
    <li>
      <a href="{{include.type}}-{{include.id}}.profile.xml.html">XML</a>
    </li>
  {% endif %}
{% endunless %}
{% unless excludejson == 'y' or contained_resource == 'y' %}
  {% if include.active == 'json' %}
    <li class="active">
      <a href="#">JSON</a>
    </li>
  {% else %}
    <li>
      <a href="{{include.type}}-{{include.id}}.profile.json.html">JSON</a>
    </li>
  {% endif %}
{% endunless %}
{% unless excludettl == 'y' or contained_resource == 'y' %}
  {% if include.active == 'ttl' %}
    <li class="active">
      <a href="#">TTL</a>
    </li>
  {% else %}
    <li>
      <a href="{{include.type}}-{{include.id}}.profile.ttl.html">TTL</a>
    </li>
  {% endif %}
{% endunless %}
{% if  site.data.resources[resource_].['history'] %}
  {% if include.active == 'history' %}
    <li class="active">
      <a href="#">History</a>
    </li>
  {% else %}
    <li>
      <a href="{{include.type}}-{{include.id}}.profile.history.html">History</a>
    </li>
  {% endif %}
{% endif %}
</ul>
