{% macro render_nav_item(endpoint, text, badge='', use_li=False) %}
    {% if use_li %}<li class="nav-item">{% endif %}
    <a class="{% if not use_li %}nav-item{% endif %} nav-link {% if request.endpoint and request.endpoint == endpoint %}active{% endif %}"
       href="{{ url_for(endpoint, **kwargs) }}">
        {{ text }} {% if badge %}<span class="badge badge-light">{{ badge }}</span>{% endif %}
    </a>
    {% if use_li %}</li>{% endif %}
{% endmacro %}

{% macro render_breadcrumb_item(endpoint, text) %}
    {% set active = True if request.endpoint and request.endpoint == endpoint else False %}
    <li class="breadcrumb-item {% if active %}active{% endif %}" {% if active %} aria-current="page"{% endif %}>
        {% if active %}
            {{ text }}
        {% else %}
        <a href="{{ url_for(endpoint, **kwargs) }}">{{ text }}</a>
        {% endif %}
    </li>
{% endmacro %}
