MacrosΒΆ

TODO

{% macro theme_local(path) -%}

{%- endmacro %}

{%- macro _make_relative_path(path, prepend_static_url) -%}
    {%- if prepend_static_url -%}
        {{ STATIC_URL }}/{{ path }}
    {%- else -%}
        {{ path }}
    {%- endif -%}
{%- endmacro -%}

{%- macro render_less_link(path_input, prepend_static_url=True) -%}
    {%- if theme.use_precompiled_styles %}
        {% filter compress %}
            <link rel="stylesheet" href="{{ _make_relative_path(make_precompiled_reference(path_input), prepend_static_url) }}"
                  type="text/css"/>
        {% endfilter %}
    {%- elif not settings.PREPROCESS_LESS -%}
        <link rel="stylesheet/less" href="{{ _make_relative_path(path_input, prepend_static_url) }}" type="text/css"/>
    {%- else -%}
        {% if path_input.endswith('.less') %}
            {{ preprocess_less(path_input) }}
            {% set path_input=("%s.css" % path_input[:-5]) %}
        {% endif %}

        {% filter compress %}
            <link rel="stylesheet" href="{{ _make_relative_path(path_input, prepend_static_url) }}" type="text/css"/>
        {% endfilter %}
    {%- endif -%}
{%- endmacro -%}

{% macro render_script_link(path_input, prepend_static_url=True) -%}
    {% filter compress %}
        <script src="{{ _make_relative_path(path_input, prepend_static_url) }}"
                type="text/javascript">
        </script>
    {% endfilter %}
{%- endmacro -%}

{% macro navigation_link(name, url, section, active_class=None) -%}
    {% if active_class is none %}
        {% set active_class=settings.ACTIVE_NAV_CLASS %}
    {% endif %}
    <li{% if nav_context in section %} class="{{ active_class }}"{% endif %}>
        <a href="{{ url }}">{{ name }}</a></li>
{%- endmacro %}