{#
Renders a citation for a package
#}

{% block citation %}
<section class="additional-info">

    <h3>{{ _('Cite this as') }}</h3>

    <div class="citation">
        <div id="citation-string" class="citation-string">
            {% block default_citation_string %}
            {{ pkg_dict['author'] }} ({{ h.package_get_year(pkg_dict) }}). <i>{{ pkg_dict['title'] }}</i> [Data set]. {{ pkg_dict['doi_publisher'] }}.
            {% block citation_link %}
            {% set doi_link = 'https://doi.org/' + pkg_dict['doi'] %}
            <a href="{{ doi_link }}" target="_blank">
                {{ doi_link }}
            </a>
            {% endblock %}
            {% endblock %}
        </div>

        {% block citation_status %}
        <div id="citation-status">
            {% if not pkg_dict['doi_status'] %}
            <div>
                <span class="dataset-private label label-inverse"
                      title="This DOI has not yet been published">
                    <i class="fa fa-lock"></i> Private DOI</span>
                <small>
                    <i class="fa fa-exclamation-sign"></i>
                    <strong>This DOI is not yet resolvable.</strong>
                </small>
            </div>
            <div>
                <small>
                    It is available for use in manuscripts, and will be published when the Dataset
                    is made public.
                </small>
            </div>
            {% else %}
            <div>
                <small>
                    Retrieved: {{ h.render_datetime(h.now(), date_format='%H:%M %d %b %Y (%Z)') }}
                </small>
            </div>
            {% if not res %}
            <div>
                {% set datacite_url = 'api.test.datacite.org' if h.doi_test_mode() else 'api.datacite.org' %}
                <a class="btn btn-mini" title="Download BibTeX" href="https://{{ datacite_url }}/dois/application/x-bibtex/{{ pkg_dict['doi'] }}">
                    <small><i class="fa fa-file"></i>BibTeX</small>
                </a>
            </div>
            {% endif %}
            {% endif %}
        </div>
        {% endblock %}
    </div>
</section>

{% endblock %}
