{% extends "base.html" %}
{% import "macros.html" as utils %}

{% block title %}{{ config.METAREGISTRY_TITLE }} - {{ name }}{% endblock %}

{% block styles %}
{{ super() }}
<link href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism.css" rel="stylesheet"/>
{% endblock %}

{% block scripts %}
    {{ super() }}
    <script type="text/javascript">
        $(function () {
            $('[data-toggle="tooltip"]').tooltip()
        })
    </script>
    <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
{% endblock %}

{% set mastodon = resource.get_mastodon() %}
{% set mastodon_url = resource.get_mastodon_url() %}
{% set twitter = resource.get_twitter() %}
{% set keywords = resource.get_keywords() %}

{% macro get_banana_text() %}
    This means that you may see local unique identifiers that include a redundant prefix and delimiter (also known
    as a <i>banana</i>)
    and therefore look like a CURIE. For {{ name }}, the banana looks like
    <code>{{ banana if banana else prefix.upper() }}{{ resource.get_banana_peel() }}</code>.
    Therefore, you may see local unique identifiers for this resource that look like
    <code>{{ banana if banana else prefix.upper() }}{{ resource.get_banana_peel() }}{{ example }}</code>
    (instead of the canonical form <code>{{ example }}</code>) and CURIEs for this resource that look like
    <code>{{ resource.get_preferred_prefix() }}:{{ banana if banana else prefix.upper() }}{{ resource.get_banana_peel() }}{{ example }}</code>
    (instead of the canonical form <code>{{ resource.get_preferred_prefix() }}:{{ example }}</code>).
    The Bioregistry will automatically strip off the banana when standardizing local unique identifiers and CURIEs.
{% endmacro %}

{% macro get_tooltip(manager, prefix) %}
<a href="{{ url_for("metaregistry_ui.resource", prefix=prefix) }}"
   class="badge badge-pill badge-light" data-toggle="tooltip"
   title="{{ manager.get_name(prefix) }}">
    {{ manager.get_preferred_prefix(prefix) or prefix }}
</a>
{% endmacro %}

{% macro get_tooltips(manager, prefixes) %}
{% for rel_prefix in prefixes %}
{{ get_tooltip(manager, rel_prefix) }}
{% endfor %}
{% endmacro %}

{% block container %}
    <script type="application/ld+json">{{ bioschemas | safe }}</script>
    <div class="card">
        <div class="card-header">
            <div class="row align-items-center">
                <div class="col-8">
                    <h5 style="margin: 0"><a href="{{ url_for("metaregistry_ui.resources") }}">Registry</a> <i
                            class="fas fa-angle-right"></i> {{ name }}
                        {{ utils.render_resource_warnings(resource) }}
                    </h5>
                </div>
                <div class="col-4 text-right">
                    <div class="dropdown">
                        <button class="btn btn-sm btn-outline-dark dropdown-toggle" type="button"
                                id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true"
                                aria-expanded="false">
                            Download
                        </button>
                        <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                            {% for label, key in formats %}
                                <a class="dropdown-item"
                                   href="{{ fastapi_url_for("get_resource", prefix=prefix) }}?format={{ key }}">
                                    {{ label }} <i class="fas fa-download"></i>
                                </a>
                            {% endfor %}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="card-body">
            {% if description %}
                <p>
                {% if resource.get_logo() %}
                <img style="max-height: 70px; float: right;" src="{{ resource.get_logo() }}" alt="Logo for {{ resource.get_name() }}"/>
                {% endif %}
                {{ description }}
                </p>
            {% endif %}
            {% if provides %}
                <p>
                    This resource is a <span class="badge badge-danger">provider</span>. This means that
                    while it may have its own prefix, it actually reuses the identifiers provided by the
                    <a href="{{ url_for(".resource", prefix=provides) }}"><code>{{ provides }}</code></a>
                    prefix. For <b>all</b> use cases, you should use <a
                        href="{{ url_for(".resource", prefix=provides) }}"><code>{{ provides }}</code></a>
                    instead of <code>{{ prefix }}</code>.
                </p>
            {% endif %}
            {% if resource.proprietary %}
                <p>
                    This resource is <span class="badge badge-warning">proprietary</span>. This means that it is not
                    freely and publicly available without restriction. Such resources are still valuable to include
                    in the Bioregistry as they may appear in other non-proprietary resources.
                </p>
            {% endif %}

            <dl>
                {% if resource.comment %}
                    <dt>Comment</dt>
                    <dd>{{ markdown(resource.comment) | safe }}</dd>
                {% endif %}
                <dt>Prefix</dt>
                <dd><code>{{ prefix }}</code></dd>
                {% set preferred_prefix = resource.get_preferred_prefix() %}
                {% if preferred_prefix %}
                    <dt>Preferred Prefix</dt>
                    <dd><code>{{ preferred_prefix }}</code></dd>
                {% endif %}
                {% if synonyms %}
                    <dt>
                        Alternative Prefixes
                        <a type="button" data-toggle="modal" data-target="#synonyms-modal">
                            <i class="far fa-question-circle"></i>
                        </a>
                    </dt>
                    <dd>
                        {% for synonym in synonyms %}
                            <span class="badge badge-light">{{ synonym }}</span>
                        {% endfor %}
                    </dd>
                {% endif %}
                {% if keywords %}
                    <dt>Keywords</dt>
                    <dd>
                        {% for keyword in keywords|sort %}
                            <span class="badge badge-light">{{ keyword }}</span>
                        {% endfor %}
                    </dd>
                {% endif %}
                {% if version %}
                    <dt>
                        Version
                        <a type="button" data-toggle="modal" data-target="#version-modal">
                            <i class="far fa-question-circle"></i>
                        </a>
                    </dt>
                    <dd>{{ version }}</dd>
                {% endif %}
                {% set resource_license = resource.get_license() %}
                {% if resource_license %}
                    <dt>
                        License
                        <a type="button" data-toggle="modal" data-target="#license-modal">
                            <i class="far fa-question-circle"></i>
                        </a>
                    </dt>
                    <dd>{{ resource_license }}</dd>
                {% endif %}
                <dt>
                    Links
                    {% if homepage or obo_download or owl_download or json_download or rdf_download %}
                    <a type="button" data-toggle="modal" data-target="#links-modal">
                        <i class="far fa-question-circle"></i>
                    </a>
                    {% endif %}
                </dt>
                <dd>
                    {% if homepage %}
                        <a class="badge badge-pill badge-light" href="{{ homepage }}">
                            Homepage <i class="fas fa-home"></i>
                        </a>
                    {% else %}
                        <span class="badge badge-pill badge-warning">Missing Homepage</span>
                    {% endif %}
                    {% if repository %}
                        <a class="badge badge-pill badge-light" href="{{ repository }}">
                            Repository <i class="fab fa-github"></i>
                        </a>
                    {% endif %}
                    {% if obo_download %}
                        <a class="badge badge-pill badge-light" href="{{ obo_download }}">
                            OBO <i class="fas fa-download"></i>
                        </a>
                    {% endif %}
                    {% if owl_download %}
                        <a class="badge badge-pill badge-light" href="{{ owl_download }}">
                            OWL <i class="fas fa-download"></i>
                        </a>
                    {% endif %}
                    {% if json_download %}
                        <a class="badge badge-pill badge-light" href="{{ json_download }}">
                            OBO JSON <i class="fas fa-download"></i>
                        </a>
                    {% endif %}
                    {% if rdf_download %}
                        <a class="badge badge-pill badge-light" href="{{ rdf_download }}">
                            RDF <i class="fas fa-download"></i>
                        </a>
                    {% endif %}
                    {% if resource.github_request_issue %}
                        <a class="badge badge-pill badge-light" href="https://github.com/biopragmatics/bioregistry/issues/{{ resource.github_request_issue }}">
                            <i class="fas fa-info-circle"></i> Request Discussion
                        </a>
                    {% endif %}
                    {% if mastodon %}
                        <a class="badge badge-pill badge-light" href="{{ mastodon_url }}">
                            <i class="fab fa-mastodon"></i> @{{ mastodon }}
                        </a>
                    {% endif %}
                    {% if twitter %}
                        <a class="badge badge-pill badge-light" href="https://twitter.com/{{ twitter }}">
                            <i class="fab fa-twitter"></i> @{{ twitter }}
                        </a>
                    {% endif %}
                </dd>
                <dt>
                    Contact
                    {% if contact %}
                    <a type="button" data-toggle="modal" data-target="#contact-modal">
                        <i class="far fa-question-circle"></i>
                    </a>
                    {% endif %}
                </dt>
                <dd>
                    {% if contact %}
                        {{ utils.render_author(contact, link=none) }}
                    {% else %}
                        <span class="badge badge-pill badge-warning">Missing Contact</span>
                    {% endif %}
                </dd>
                {% if resource.owners %}
                    <dt>Identifier Space Owner{% if resource.owners | length > 1 %}s{% endif %}</dt>
                    {% for owner in resource.owners %}
                    <dd>
                    <a href="{{ owner.link }}">{{ owner.name }}</a>
                    {% if owner.partnered %}
                    <a href="https://github.com/biopragmatics/bioregistry/blob/main/docs/GOVERNANCE.md#partners"
                           class="badge badge-pill badge-info" data-toggle="tooltip"
                           title="This organization has partnered with the Bioregistry to proactively maintain this record. Click to see related project governance.">
                        Partnered
                    </a>
                    {% endif %}
                    </dd>
                    {% endfor %}
                {% endif %}
                <dt>Pattern for Local Unique Identifiers</dt>
                <dd>
                    {% if pattern %}
                        <p>
                            Local identifiers in {{ name }} should match this
                            regular expression:<br/><kbd>{{ pattern }}</kbd>
                        </p>
                    {% elif has_no_terms %}
                        <span class="badge badge-pill badge-secondary">No terms in {{ prefix }}</span>
                    {% else %}
                        <span class="badge badge-pill badge-warning">Missing LUI pattern</span>
                    {% endif %}
                </dd>
                <dt>Example Local Unique Identifier{% if resource.example_extras %}s{% endif %}</dt>
                <dd>
                    {% if example %}
                        <a href="{{ url_for("metaregistry_ui.reference", prefix=prefix, identifier=example) }}">{{ example }}</a>
                        {% if providers %}
                        &nbsp;
                        <a class="badge badge-pill badge-info" href="{{ url_for("metaregistry_ui.resolve", prefix=prefix, identifier=example) }}"><i class="fas fa-share-square"></i> Resolve</a>
                        {% endif %}
                        {% for extra_example in example_extras %}
                            <br />
                            <a href="{{ url_for("metaregistry_ui.reference", prefix=prefix, identifier=extra_example) }}">{{ extra_example }}</a>
                            {% if providers %}
                                &nbsp;
                                <a class="badge badge-pill badge-info" href="{{ url_for("metaregistry_ui.resolve", prefix=prefix, identifier=extra_example) }}"><i class="fas fa-share-square"></i> Resolve</a>
                            {% endif %}
                        {% endfor %}
                    {% elif has_no_terms %}
                        <span class="badge badge-pill badge-secondary">No Terms in {{ prefix }}</span>
                    {% else %}
                        <span class="badge badge-pill badge-warning">Missing Example Local Unique Identifier</span>
                    {% endif %}
                </dd>
                {% if pattern and curie_pattern %}
                <dt>Pattern for CURIES</dt>
                <dd>
                    <p>
                        Compact URIs (CURIEs) constructed from {{ name }} should match
                        this regular expression:<br/><kbd>{{ curie_pattern }}</kbd>
                    </p>
                </dd>
                {% endif %}
                {% if example and example_curie %}
                <dt>Example CURIE{% if resource.example_extras %}s{% endif %}</dt>
                <dd>
                    <a href="{{ url_for("metaregistry_ui.reference", prefix=prefix, identifier=example) }}">{{ example_curie }}</a>
                    {% for example_curie_extra, example_extra in zip(example_curie_extras, example_extras) %}
                        <br />
                        <a href="{{ url_for("metaregistry_ui.reference", prefix=prefix, identifier=example_extra) }}">{{ example_curie_extra }}</a>
                    {% endfor %}
                </dd>
                {% endif %}
                {% if namespace_in_lui %}
                    <dt><i class="fas fa-info-circle"></i> MIRIAM Namespace Embedded in LUI</dt>
                    <dd>
                        The legacy MIRIAM standard for generating CURIEs with this resource
                        annotates the <code>namespaceEmbeddedInLUI</code> as true.
                        {{ get_banana_text() }}
                    </dd>
                {% elif banana %}
                    <dt><i class="fas fa-info-circle"></i> Namespace Embedded in LUI</dt>
                    <dd>
                        This resource has been annotated by the Bioregistry as having a potential
                        namespace embedded in LUI.
                        {{ get_banana_text() }}
                    </dd>
                {% endif %}

                {% set publications = resource.get_publications() %}
                {% if publications %}
                    <dt>Publications</dt>
                    <dd>
                        {% if publications | length == 1 %}
                            {{ utils.render_publication(publications[0]) }}
                        {% else %}
                            <ul>
                                {% for publication in publications %}
                                    <li>{{ utils.render_publication(publication) }}</li>
                                {% endfor %}
                            </ul>
                        {% endif %}
                    </dd>
                {% endif %}
                {% if resource.references %}
                    <dt>References</dt>
                    <dd>
                        {% if resource.references | length == 1 %}
                            {{ utils.render_reference(resource.references[0]) }}
                        {% else %}
                            <ul>
                                {% for reference in resource.references %}
                                    <li>{{ utils.render_reference(reference) }}</li>
                                {% endfor %}
                            </ul>
                        {% endif %}
                    </dd>
                {% endif %}
                {% if resource.contributor or resource.contributor_extras %}
                    <dt>Contributors</dt>
                    <dd>
                        <ul>
                            {% if resource.contributor %}
                                <li>
                                    <span class="badge badge-info">submitter</span> {{ utils.render_author(resource.contributor, link=url_for('metaregistry_ui.contributor', orcid=resource.contributor.orcid)) }}
                                </li>
                            {% endif %}
                            {% for contributor in resource.contributor_extras or [] %}
                                <li>
                                    <span class="badge badge-info">contributor</span> {{ utils.render_author(contributor, link=url_for('metaregistry_ui.contributor', orcid=contributor.orcid)) }}
                                </li>
                            {% endfor %}
                        </ul>
                    </dd>
                {% endif %}
                {% if resource.reviewer %}
                    <dt>Reviewer</dt>
                    <dd>
                        {{ utils.render_author(resource.reviewer, link=url_for('metaregistry_ui.contributor', orcid=resource.reviewer.orcid)) }}
                    </dd>
                {% endif %}
            </dl>
        </div>

    </div>

    {% if provides or provided_by or part_of or has_parts or has_canonical or canonical_for or depends_on or appears_in or in_collections %}
    <div class="card" style="margin-top: 20px">
        <a id="ontology"></a>
        <h5 class="card-header">Ontology</h5>
        <div class="card-body">
            <dl>
                {% if provides %}
                    <dt>
                        Provides
                    </dt>
                    <dd>{{ get_tooltip(manager, provides) }}</dd>
                {% endif %}
                {% if provided_by %}
                    <dt>
                        Provided By
                    </dt>
                    <dd>{{ get_tooltips(manager, provided_by) }}</dd>
                {% endif %}
                {% if part_of %}
                    <dt>
                        Part Of ({{ utils.code_curie("bfo", "0000050") }})
                    </dt>
                    <dd>
                        {% if manager.get_name(part_of) %}
                            {{ get_tooltip(manager, part_of) }}
                        {% else %}
                        <span class="badge badge-pill badge-light">{{ part_of }} (not directly registered)</span>
                        {% endif %}
                    </dd>
                {% endif %}
                {% if has_parts %}
                    <dt>
                        Has Parts ({{ utils.code_curie("bfo", "0000051") }})
                    </dt>
                    <dd>{{ get_tooltips(manager, has_parts) }}</dd>
                {% endif %}
                {% if has_canonical %}
                    <dt>
                        Has Canonical ({{ utils.code_curie("bioregistry.schema", "0000016") }})
                    </dt>
                    <dd>{{ get_tooltip(manager, has_canonical) }}</dd>
                {% endif %}
                {% if canonical_for %}
                    <dt>
                        Canonical For ({{ canonical_for | length }})
                    </dt>
                    <dd>{{ get_tooltips(manager, canonical_for) }}</dd>
                {% endif %}
                {% if depends_on %}
                    <dt>
                        Depends On ({{ depends_on | length }}) ({{ utils.code_curie("bioregistry.schema", "0000017") }})
                    </dt>
                    <dd>{{ get_tooltips(manager, depends_on) }}</dd>
                {% endif %}
                {% if appears_in %}
                    <dt>
                        Appears In ({{ appears_in | length }}) ({{ utils.code_curie("bioregistry.schema", "0000018") }})
                    </dt>
                    <dd>{{ get_tooltips(manager, appears_in) }}</dd>
                {% endif %}
                {% if in_collections %}
                    <dt>In Collection</dt>
                    <dd>
                    {% for collection_id in in_collections %}
                    <a href="{{ url_for("metaregistry_ui.collection", identifier=collection_id) }}"
                       class="badge badge-pill badge-light" data-toggle="tooltip"
                       title="{{ manager.get_collection_name(collection_id) }}">
                        {{ manager.get_collection_name(collection_id) }}
                    </a>
                    {% endfor %}
                    </dd>
                {% endif %}
            </dl>
        </div>
    </div>
    {% endif %}

    {% if mappings %}
        <div class="card" style="margin-top: 20px">
            <a id="mappings"></a>
            <h5 class="card-header">
                Metaregistry <i class="fas fa-angle-right"></i> {{ name }}
            </h5>
            <div class="card-body">
                <p>
                    The metaregistry provides mappings between the Bioregistry and other registries. There are
                    {{ mappings | length }} mappings to external registries for this resource with
                    {{ mappings | map(attribute='xref') | unique | list | length }} unique external prefixes.
                </p>
            </div>
            <table class="table table-hover table-striped">
                <thead class="table-">
                <tr>
                    <th scope="col">Registry Name</th>
                    <th scope="col">Registry Metaprefix</th>
                    <th scope="col">External Prefix</th>
                    {# <th scope="col">External Name</th> #}
                    <th scope="col">Curate</th>
                </tr>
                </thead>
                <tbody>
                {% for mapping in mappings %}
                    <tr>
                        <td>
                            {% if mapping.homepage %}
                                <a href="{{ mapping.homepage }}" title="{{ mapping.name }}">{{ mapping.short_name }}</a>
                            {% else %}
                                {{ mapping.short_name }}
                            {% endif %}
                            {% if mapping.metaresource.logo_url %}
                                <img style="max-height: 1em" alt="{{ mapping.name }} logo" src="{{ mapping.metaresource.logo_url }}" />
                            {% endif %}
                        </td>
                        <td><code>{{ mapping.metaprefix }}</code></td>
                        <td>
                            {% if mapping.uri %}
                                <a href="{{ mapping.uri }}"><code>{{ mapping.xref }}</code> <i class="fas fa-link"></i></a>
                            {% else %}
                                <span title="{{ mapping.name }} does not resolve metaidentifiers"
                                      data-toggle="tooltip" data-placement="right"><code>{{ mapping.xref }}</code>
                                    <i class="fas fa-info-circle"></i></span>
                            {% endif %}
                        </td>
                        {# <td>{{ resource.get_prefix_key("name", mapping.metaprefix) or "" }}</td> #}
                        <td style="text-align: center;">
                            <a data-toggle="tooltip" data-html="true"
                               title="Report misalignment between {{ name }} and <code>{{ mapping.metaprefix }}:{{ mapping.xref }}</code>"
                               href="https://github.com/biopragmatics/bioregistry/issues/new?labels=Update%2CPrefix&template=mismatch.yml&title=Remove+incorrect+mapping+from+{{ resource.prefix }}+to+%60{{ mapping.metaprefix }}%3A{{ mapping.xref }}%60&prefix={{ resource.prefix }}&metaprefix={{ mapping.metaprefix }}&external-prefix={{ mapping.xref }}">
                                <i class="fas fa-pen"></i>
                            </a>
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
    {% endif %}

    {% if resource.get_rdf_uri_format() %}
        <div class="card" style="margin-top: 20px">
            <a id="mappings"></a>
            <h5 class="card-header">RDF Information</h5>
            <div class="card-body">
                <p>
                    When using this resource in RDF, the following URI format should be used:
                </p>
                <p>
                    <code>{{ resource.get_rdf_uri_format() }}</code>
                </p>
            </div>
        </div>
    {% endif %}

    {% if providers %}
        <div class="card" style="margin-top: 20px">
            <a id="mappings"></a>
            <h5 class="card-header">Providers</h5>
            <div class="card-body">
                <p>
                    Providers are various services that resolve CURIEs to URLs. The example CURIE
                    {{ utils.code_curie(resource.get_preferred_prefix(), example) }} is used to demonstrate the provides available for
                    this resource. Generation of OLS and BioPortal URLs requires additional programmatic
                    logic beyond string formatting.
                </p>
            </div>
            {{ utils.render_provider_table(prefix=prefix, identifier=example, providers=providers) }}
        </div>
    {% endif %}
    {% set extra_providers = resource.get_extra_providers() %}
    {% if extra_providers %}
        <div class="card" style="margin-top: 20px">
            <a id="mappings"></a>
            <h5 class="card-header">Extra Providers</h5>
            <div class="card-body">
                <p>
                    Additional providers curated in the Bioregistry are listed here.
                </p>
            </div>
            <table class="table table-hover table-striped">
                <thead class="table-">
                <tr>
                    <th scope="col">Code</th>
                    <th scope="col">Name</th>
                    <th scope="col">URL</th>
                </tr>
                </thead>
                <tbody>
                {% for provider in extra_providers %}
                    <tr>
                        <td><code>{{ provider.code }}</code></td>
                        <td>{{ provider.name }}</td>
                        {% set url = provider.resolve(example) %}
                        <td><a href="{{ url }}">{{ url }}</a></td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
    {% endif %}

    {% if synonyms %}
    <div class="modal fade" id="synonyms-modal" tabindex="-1" role="dialog" aria-labelledby="synonymsModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="synonymsModalLabel">Programmatic Access to Synonyms</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <p>
                        Normalize prefixes. This can be any capitalization or punctuation
                        variant of the synonyms listed below.
                    </p>
                    <pre><code class="language-python">&gt;&gt;&gt; import bioregistry as br
&gt;&gt;&gt; br.normalize_prefix("{{ synonyms|first }}")
'{{ prefix }}'</code></pre>
                    <p>Get all synonyms:</p>
                    {{ utils.code_example(prefix, "get_synonyms", synonyms, quote=False) }}
                </div>
            </div>
        </div>
    </div>
    {% endif %}

    {% if version %}
    <div class="modal fade" id="version-modal" tabindex="-1" role="dialog" aria-labelledby="versionModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="versionModalLabel">Programmatic Access to Version</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <p>Get the version:</p>
                    {{ utils.code_example(prefix, "get_version", version) }}
                </div>
            </div>
        </div>
    </div>
    {% endif %}

    {% if resource_license %}
    <div class="modal fade" id="license-modal" tabindex="-1" role="dialog" aria-labelledby="licenseModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="licenseModalLabel">Programmatic Access to License</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <p>Get the license:</p>
                    {{ utils.code_example(prefix, "get_license", resource_license) }}
                </div>
            </div>
        </div>
    </div>
    {% endif %}

    <div class="modal fade" id="links-modal" tabindex="-1" role="dialog" aria-labelledby="linkModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="linkModalLabel">Programmatic Access to Links</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    {% if homepage %}
                        <p>Get the homepage:</p>
                        {{ utils.code_example(prefix, "get_homepage", homepage) }}
                    {% endif %}
                    {% if repository %}
                        <p>Get the repository:</p>
                        {{ utils.code_example(prefix, "get_repository", repository) }}
                    {% endif %}
                    {% if obo_download %}
                        <p>Get the OBO download link:</p>
                        {{ utils.code_example(prefix, "get_obo_download", obo_download) }}
                    {% endif %}
                    {% if owl_download %}
                        <p>Get the OWL download link:</p>
                        {{ utils.code_example(prefix, "get_owl_download", owl_download) }}
                    {% endif %}
                    {% if json_download %}
                        <p>Get the JSON download link:</p>
                        {{ utils.code_example(prefix, "get_json_download", json_download) }}
                    {% endif %}
                    {% if rdf_download %}
                        <p>Get the RDF download link:</p>
                        {{ utils.code_example(prefix, "get_rdf_download", rdf_download) }}
                    {% endif %}
                </div>
            </div>
        </div>
    </div>

    {% if contact %}
        {{ utils.render_author_modal(prefix, contact, "contact") }}
    {% endif %}
{% endblock %}
