{#
    cloud/layout.html
    ~~~~~~~~~~~~~~~~~

    Sphinx layout template for the cloud theme.

    :copyright: Copyright 2009-2011 Assurance Technologies LLC
    :license: BSD

    roottarget - optional target for root link (default to toc)
    logotarget - optional target for logo link (defaults to root target)
    googleanalytics_id - if set, enabled google analytics snippet & footer
    googleanalytics_path - optional subpatch for GA cookie

#}

{% extends "basic/layout.html" %}

{% set reldelim2 = reldim2 is not defined and ' &nbsp; &nbsp;' or reldelim2 %}

{# compat hack for sphinx < 1.8 #}
{% macro compat_js_tag(asset) %}
    {% if js_tag is undefined %} {# sphinx 1.6 / 1.7 #}
        <script type="text/javascript" src="{{ pathto(asset, 1) }}"></script>
    {% else %} {# sphinx >= 1.8.0 #}
        {{ js_tag(asset) }}
    {% endif %}
{% endmacro %}

{%- block scripts %}
    {{ super() }}

    {# add script file to instrument collapsable sections  and other features #}
    {{ compat_js_tag("_static/cloud.base.js") }}
    {{ compat_js_tag("_static/cloud.js") }}

{%- endblock %}

{# make root link redirectable #}
{%- set theme_roottarget = (theme_roottarget == "<toc>" and master_doc or theme_roottarget) %}
{% block rootrellink %}
    <li><a href="{{ pathto(theme_roottarget) }}">{{shorttitle|e}}</a>{{reldelim1}}</li>
{% endblock %}

{# make logo link redirectable #}
{%- set theme_logotarget = (theme_logotarget == "<root>" and theme_roottarget or (theme_logotarget == "<toc>" and master_doc or theme_logotarget)) %}
{%- block sidebarlogo %}
    {%- if logo %}
        <p class="logo"><a href="{{ pathto(theme_logotarget) }}" title="{{ theme_logotarget }}">
          <img class="logo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/>
        </a></p>
    {%- endif %}
{%- endblock %}

{# wrap relbars in distinct classes to make themeing easier #}
{%- block relbar1 %}
    <div class="relbar-top">
        {{ super() }}
    </div>
{% endblock %}

{%- block relbar2 %}
    <div class="relbar-bottom">
        {{ super() }}
    </div>
{% endblock %}

{% block extrahead -%}
        {{ super() }}
        <meta name="viewport" content="width=device-width, initial-scale=1">
{%- endblock %}

{% block body -%}
    {# hack to insert lang=en in scope of div.body #}
    {% if theme_hyphenation_langage %}
        <div lang="{{ theme_hyphenation_language }}">{{ super() }}</div>
    {% endif %}
{%- endblock %}

{% block sidebar2 -%}
    {{ super() }}
    {# insert markup for sidebar toggle button #}
    {% block sidebartoggle %}
        <div class="sidebar-toggle-group no-js">
            {% set right = theme_rightsidebar|tobool %}
            <button class="sidebar-toggle" id="sidebar-hide" title="Hide the sidebar menu">
                {% if not right %} «{% endif %}
                <span class="show-for-small">hide menu</span>
                {% if right %} »{% endif %}
            </button>
            <button class="sidebar-toggle" id="sidebar-show" title="Show the sidebar menu">
                {% if right %} «{% endif %}
                <span class="show-for-small">menu</span>
                <span class="hide-for-small">sidebar</span>
                {% if not right %} »{% endif %}
            </button>
        </div>
    {% endblock %}
{%- endblock %}

{% block footer -%}
    {{ super() }}
    <!-- cloud_sptheme 1.4 -->
{%- endblock %}
